safra: Add compute_succ function
* spot/twaalgos/safra.cc, spot/twaalgos/safra.hh: Enables use to compute successor safra state for any edge.
This commit is contained in:
parent
be0e6bffcf
commit
1d68decaca
2 changed files with 63 additions and 41 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue