Commit 1d68deca authored by Alexandre Lewkowicz's avatar Alexandre Lewkowicz Committed by Alexandre Duret-Lutz

safra: Add compute_succ function

* spot/twaalgos/safra.cc, spot/twaalgos/safra.hh:  Enables use to
compute successor safra state for any edge.
parent be0e6bff
......@@ -182,24 +182,16 @@ safra_state::find_scc_brace_id(unsigned scc_id, const scc_info& scc)
return -1U;
}
void
safra_state::compute_succs(const const_twa_graph_ptr& aut,
succs_t& res,
safra_state
safra_state::compute_succ(const const_twa_graph_ptr& aut,
const bdd& ap,
const scc_info& scc,
const std::map<int, bdd>& implications,
const std::vector<bool>& is_connected,
std::unordered_map<bdd, unsigned, bdd_hash>& bdd2num,
std::vector<bdd>& all_bdds,
bool scc_opt,
bool use_bisimulation) const
{
// Given a bdd returns index of associated safra_state in res
std::map<unsigned, unsigned> bdd_idx2node_idx;
for (auto& ap: all_bdds)
{
unsigned bdd_idx = bdd2num[ap];
res.emplace_back(safra_state(nb_braces_.size()), bdd_idx);
safra_state& ss = res.back().first;
safra_state ss = safra_state(nb_braces_.size());
for (auto& node: nodes_)
{
for (auto& t: aut->out(node.first))
......@@ -236,6 +228,27 @@ safra_state::compute_succs(const const_twa_graph_ptr& aut,
ss.merge_redundant_states(implications, scc, is_connected);
ss.ungreenify_last_brace();
ss.color_ = ss.finalize_construction();
return ss;
}
void
safra_state::compute_succs(const const_twa_graph_ptr& aut,
succs_t& res,
const scc_info& scc,
const std::map<int, bdd>& implications,
const std::vector<bool>& is_connected,
std::unordered_map<bdd, unsigned, bdd_hash>& bdd2num,
std::vector<bdd>& all_bdds,
bool scc_opt,
bool use_bisimulation) const
{
for (auto& ap: all_bdds)
{
safra_state ss = compute_succ(aut, ap, scc, implications, is_connected,
scc_opt, use_bisimulation);
unsigned bdd_idx = bdd2num[ap];
res.emplace_back(ss, bdd_idx);
}
}
......
......@@ -64,6 +64,15 @@ namespace spot
std::vector<bdd>& all_bdds,
bool scc_opt,
bool use_bisimulation) const;
// Compute successor for transition ap
safra_state
compute_succ(const const_twa_graph_ptr& aut,
const bdd& ap,
const scc_info& scc,
const std::map<int, bdd>& implications,
const std::vector<bool>& is_connected,
bool scc_opt,
bool use_bisimulation) const;
// scc_id has to be an accepting SCC. This function tries to find a node
// who lives in that SCC and if it does, we return the brace_id of that SCC.
unsigned find_scc_brace_id(unsigned scc_id, const scc_info& scc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment