Handle all automata through shared_ptr. (monstro patch)
A type such as 'const tgba_digraph*' and 'tgba_digraph*' are replaced by 'const_tgba_digraph_ptr' and 'tgba_digraph_ptr'. Additionally 'new tgba_digraph(...)' is replaced by 'make_tgba_digraph(...)'. This convention is followed by all automata types. Those smart pointers should normally be passed by const reference as input of function to avoid the atomic increments/decrements, but I probably missed a few, as this huge patch took me nearly 12h. * src/kripke/fwd.hh, src/tgba/fwd.hh: New files. * src/kripke/Makefile.am, src/tgba/Makefile.am: Adjust. * iface/dve2/dve2.cc, iface/dve2/dve2.hh, iface/dve2/dve2check.cc, src/bin/common_output.hh, src/bin/dstar2tgba.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlcross.cc, src/bin/ltlfilt.cc, src/dstarparse/dra2ba.cc, src/dstarparse/dstar2tgba.cc, src/dstarparse/dstarparse.yy, src/dstarparse/nra2nba.cc, src/dstarparse/nsa2tgba.cc, src/dstarparse/public.hh, src/graphtest/tgbagraph.cc, src/kripke/fairkripke.hh, src/kripke/kripke.hh, src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh, src/kripke/kripkeprint.cc, src/kripke/kripkeprint.hh, src/kripkeparse/kripkeparse.yy, src/kripkeparse/public.hh, src/kripketest/parse_print_test.cc, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/ltlvisit/contain.cc, src/ltlvisit/contain.hh, src/neverparse/neverclaimparse.yy, src/neverparse/public.hh, src/priv/accmap.hh, src/priv/countstates.cc, src/priv/countstates.hh, src/saba/saba.hh, src/saba/sabacomplementtgba.cc, src/saba/sabacomplementtgba.hh, src/sabaalgos/sabadotty.cc, src/sabaalgos/sabadotty.hh, src/sabaalgos/sabareachiter.cc, src/sabaalgos/sabareachiter.hh, src/sabatest/sabacomplementtgba.cc, src/ta/ta.hh, src/ta/taexplicit.cc, src/ta/taexplicit.hh, src/ta/taproduct.cc, src/ta/taproduct.hh, src/ta/tgta.hh, src/ta/tgtaexplicit.cc, src/ta/tgtaexplicit.hh, src/ta/tgtaproduct.cc, src/ta/tgtaproduct.hh, src/taalgos/dotty.cc, src/taalgos/dotty.hh, src/taalgos/emptinessta.cc, src/taalgos/emptinessta.hh, src/taalgos/minimize.cc, src/taalgos/minimize.hh, src/taalgos/reachiter.cc, src/taalgos/reachiter.hh, src/taalgos/statessetbuilder.cc, src/taalgos/statessetbuilder.hh, src/taalgos/stats.cc, src/taalgos/stats.hh, src/taalgos/tgba2ta.cc, src/taalgos/tgba2ta.hh, src/tgba/bdddict.cc, src/tgba/bdddict.hh, src/tgba/formula2bdd.hh, src/tgba/futurecondcol.cc, src/tgba/futurecondcol.hh, src/tgba/taatgba.hh, src/tgba/tgba.cc, src/tgba/tgba.hh, src/tgba/tgbagraph.hh, src/tgba/tgbakvcomplement.cc, src/tgba/tgbakvcomplement.hh, src/tgba/tgbamask.cc, src/tgba/tgbamask.hh, src/tgba/tgbaproduct.cc, src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh, src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh, src/tgba/tgbascc.cc, src/tgba/tgbascc.hh, src/tgba/tgbasgba.cc, src/tgba/tgbasgba.hh, src/tgba/wdbacomp.cc, src/tgba/wdbacomp.hh, src/tgbaalgos/bfssteps.cc, src/tgbaalgos/bfssteps.hh, src/tgbaalgos/complete.cc, src/tgbaalgos/complete.hh, src/tgbaalgos/compsusp.cc, src/tgbaalgos/compsusp.hh, src/tgbaalgos/cycles.hh, src/tgbaalgos/degen.cc, src/tgbaalgos/degen.hh, src/tgbaalgos/dotty.cc, src/tgbaalgos/dotty.hh, src/tgbaalgos/dottydec.cc, src/tgbaalgos/dottydec.hh, src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtbasat.hh, src/tgbaalgos/dtgbacomp.cc, src/tgbaalgos/dtgbacomp.hh, src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/dtgbasat.hh, src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh, src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh, src/tgbaalgos/gtec/gtec.cc, src/tgbaalgos/gtec/gtec.hh, src/tgbaalgos/gtec/status.cc, src/tgbaalgos/gtec/status.hh, src/tgbaalgos/gv04.cc, src/tgbaalgos/gv04.hh, src/tgbaalgos/isdet.cc, src/tgbaalgos/isdet.hh, src/tgbaalgos/isweakscc.cc, src/tgbaalgos/lbtt.cc, src/tgbaalgos/lbtt.hh, src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2taa.hh, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/magic.cc, src/tgbaalgos/magic.hh, src/tgbaalgos/minimize.cc, src/tgbaalgos/minimize.hh, src/tgbaalgos/ndfs_result.hxx, src/tgbaalgos/neverclaim.cc, src/tgbaalgos/neverclaim.hh, src/tgbaalgos/postproc.cc, src/tgbaalgos/postproc.hh, src/tgbaalgos/powerset.cc, src/tgbaalgos/powerset.hh, src/tgbaalgos/projrun.cc, src/tgbaalgos/projrun.hh, src/tgbaalgos/randomgraph.cc, src/tgbaalgos/randomgraph.hh, src/tgbaalgos/reachiter.cc, src/tgbaalgos/reachiter.hh, src/tgbaalgos/reducerun.cc, src/tgbaalgos/reducerun.hh, src/tgbaalgos/replayrun.cc, src/tgbaalgos/replayrun.hh, src/tgbaalgos/rundotdec.cc, src/tgbaalgos/rundotdec.hh, src/tgbaalgos/safety.cc, src/tgbaalgos/safety.hh, src/tgbaalgos/save.cc, src/tgbaalgos/save.hh, src/tgbaalgos/scc.cc, src/tgbaalgos/scc.hh, src/tgbaalgos/sccfilter.cc, src/tgbaalgos/sccfilter.hh, src/tgbaalgos/sccinfo.cc, src/tgbaalgos/sccinfo.hh, src/tgbaalgos/se05.cc, src/tgbaalgos/se05.hh, src/tgbaalgos/simulation.cc, src/tgbaalgos/simulation.hh, src/tgbaalgos/stats.cc, src/tgbaalgos/stats.hh, src/tgbaalgos/stripacc.cc, src/tgbaalgos/stripacc.hh, src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03.hh, src/tgbaalgos/tau03opt.cc, src/tgbaalgos/tau03opt.hh, src/tgbaalgos/translate.cc, src/tgbaalgos/translate.hh, src/tgbaparse/public.hh, src/tgbaparse/tgbaparse.yy, src/tgbatest/complementation.cc, src/tgbatest/explprod.cc, src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlprod.cc, src/tgbatest/maskacc.cc, src/tgbatest/powerset.cc, src/tgbatest/randtgba.cc, src/tgbatest/taatgba.cc, src/tgbatest/tgbaread.cc, src/tgbatest/tripprod.cc, wrap/python/ajax/spot.in, wrap/python/spot.i, wrap/python/tests/interdep.py: Use shared pointers for automata.
This commit is contained in:
parent
ca85d4184d
commit
51151ab271
195 changed files with 1792 additions and 1837 deletions
|
|
@ -25,7 +25,7 @@
|
|||
namespace spot
|
||||
{
|
||||
|
||||
bfs_steps::bfs_steps(const tgba* a)
|
||||
bfs_steps::bfs_steps(const const_tgba_ptr& a)
|
||||
: a_(a)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de
|
||||
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et Developpement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -42,7 +42,7 @@ namespace spot
|
|||
class SPOT_API bfs_steps
|
||||
{
|
||||
public:
|
||||
bfs_steps(const tgba* a);
|
||||
bfs_steps(const const_tgba_ptr& a);
|
||||
virtual ~bfs_steps();
|
||||
|
||||
/// \brief Start the search from \a start, and append the
|
||||
|
|
@ -99,7 +99,7 @@ namespace spot
|
|||
tgba_run::steps& l);
|
||||
|
||||
protected:
|
||||
const tgba* a_; ///< The spot::tgba we are searching into.
|
||||
const_tgba_ptr a_; ///< The spot::tgba we are searching into.
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace spot
|
||||
{
|
||||
unsigned tgba_complete_here(tgba_digraph* aut)
|
||||
unsigned tgba_complete_here(tgba_digraph_ptr aut)
|
||||
{
|
||||
unsigned n = aut->num_states();
|
||||
unsigned sink = -1U;
|
||||
|
|
@ -99,9 +99,9 @@ namespace spot
|
|||
return sink;
|
||||
}
|
||||
|
||||
tgba_digraph* tgba_complete(const tgba* aut)
|
||||
tgba_digraph_ptr tgba_complete(const const_tgba_ptr& aut)
|
||||
{
|
||||
tgba_digraph* res = tgba_dupexp_dfs(aut);
|
||||
tgba_digraph_ptr res = tgba_dupexp_dfs(aut);
|
||||
tgba_complete_here(res);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ namespace spot
|
|||
/// state added for completion, or an existing non-accepting state
|
||||
/// that has been reused as sink state because it had not outgoing
|
||||
/// transitions apart from self-loops.)
|
||||
SPOT_API unsigned tgba_complete_here(tgba_digraph* aut);
|
||||
SPOT_API unsigned tgba_complete_here(tgba_digraph_ptr aut);
|
||||
|
||||
/// \brief Clone a tgba and complete it.
|
||||
///
|
||||
/// If the tgba has no acceptance set, one will be added.
|
||||
SPOT_API tgba_digraph* tgba_complete(const tgba* aut);
|
||||
SPOT_API tgba_digraph_ptr tgba_complete(const const_tgba_ptr& aut);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_COMPLETE_HH
|
||||
|
|
|
|||
|
|
@ -212,18 +212,15 @@ namespace spot
|
|||
typedef std::deque<state_pair> pair_queue;
|
||||
|
||||
static
|
||||
tgba_digraph*
|
||||
susp_prod(tgba* left, const ltl::formula* f, bdd v)
|
||||
tgba_digraph_ptr
|
||||
susp_prod(const const_tgba_ptr& left, const ltl::formula* f, bdd v)
|
||||
{
|
||||
bdd_dict_ptr dict = left->get_dict();
|
||||
const tgba_digraph* a1 = ltl_to_tgba_fm(f, dict, true, true);
|
||||
auto right =
|
||||
iterated_simulations(scc_filter(ltl_to_tgba_fm(f, dict, true, true),
|
||||
false));
|
||||
|
||||
const tgba_digraph* a2 = scc_filter(a1, false);
|
||||
delete a1;
|
||||
const tgba_digraph* right = iterated_simulations(a2);
|
||||
delete a2;
|
||||
|
||||
tgba_digraph* res = new tgba_digraph(dict);
|
||||
tgba_digraph_ptr res = make_tgba_digraph(dict);
|
||||
dict->register_all_variables_of(left, res);
|
||||
dict->register_all_variables_of(right, res);
|
||||
dict->unregister_variable(bdd_var(v), res);
|
||||
|
|
@ -342,14 +339,12 @@ namespace spot
|
|||
right->release_iter(ri);
|
||||
}
|
||||
}
|
||||
delete left;
|
||||
delete right;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tgba_digraph*
|
||||
tgba_digraph_ptr
|
||||
compsusp(const ltl::formula* f, bdd_dict_ptr dict,
|
||||
bool no_wdba, bool no_simulation,
|
||||
bool early_susp, bool no_susp_product, bool wdba_smaller,
|
||||
|
|
@ -360,32 +355,23 @@ namespace spot
|
|||
ltl_suspender_visitor v(g2s, a2o, oblig);
|
||||
const ltl::formula* g = v.recurse(f);
|
||||
|
||||
tgba_digraph* res;
|
||||
{
|
||||
// Translate the patched formula, and remove useless SCCs.
|
||||
tgba_digraph* aut =
|
||||
spot::ltl_to_tgba_fm(g, dict, true, true, false, false, 0, 0);
|
||||
res = scc_filter(aut, false);
|
||||
delete aut;
|
||||
}
|
||||
// Translate the patched formula, and remove useless SCCs.
|
||||
tgba_digraph_ptr res =
|
||||
scc_filter(ltl_to_tgba_fm(g, dict, true, true, false, false, 0, 0),
|
||||
false);
|
||||
|
||||
if (!no_wdba)
|
||||
{
|
||||
tgba_digraph* min = minimize_obligation(res, g, 0, wdba_smaller);
|
||||
tgba_digraph_ptr min = minimize_obligation(res, g, 0, wdba_smaller);
|
||||
if (min != res)
|
||||
{
|
||||
delete res;
|
||||
res = min;
|
||||
no_simulation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!no_simulation)
|
||||
{
|
||||
tgba_digraph* sim = spot::iterated_simulations(res);
|
||||
delete res;
|
||||
res = sim;
|
||||
}
|
||||
res = iterated_simulations(res);
|
||||
|
||||
// Create a map of suspended formulae to BDD variables.
|
||||
spot::formula_bdd_map susp;
|
||||
|
|
@ -409,9 +395,8 @@ namespace spot
|
|||
suspvars &= i->second;
|
||||
|
||||
bdd allaccap = bddtrue; // set of atomic prop used in accepting SCCs.
|
||||
tgba_digraph* aut = res;
|
||||
{
|
||||
scc_info si(aut);
|
||||
scc_info si(res);
|
||||
|
||||
// Restrict suspvars to the set of suspension labels that occur
|
||||
// in accepting SCC.
|
||||
|
|
@ -422,9 +407,8 @@ namespace spot
|
|||
|
||||
bdd ignored = bdd_exist(suspvars, allaccap);
|
||||
suspvars = bdd_existcomp(suspvars, allaccap);
|
||||
res = scc_filter_susp(aut, false, suspvars, ignored, early_susp, &si);
|
||||
res = scc_filter_susp(res, false, suspvars, ignored, early_susp, &si);
|
||||
}
|
||||
delete aut;
|
||||
|
||||
// Do we need to synchronize any suspended formula?
|
||||
if (!susp.empty() && !no_susp_product)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace spot
|
|||
/// This interface is subject to change, and clients aiming for
|
||||
/// long-term stability should better use the services of the
|
||||
/// spot::translator class instead.
|
||||
SPOT_API tgba_digraph*
|
||||
SPOT_API tgba_digraph_ptr
|
||||
compsusp(const ltl::formula* f, bdd_dict_ptr dict,
|
||||
bool no_wdba = false, bool no_simulation = false,
|
||||
bool early_susp = false, bool no_susp_product = false,
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace spot
|
|||
typedef hash_type::iterator tagged_state;
|
||||
|
||||
// The automaton we are working on.
|
||||
const tgba* aut_;
|
||||
const_tgba_ptr aut_;
|
||||
// The SCC map built for aut_.
|
||||
const scc_map& sm_;
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace spot
|
|||
// SCC -- we do not care about the other) of some state.
|
||||
class outgoing_acc
|
||||
{
|
||||
const tgba* a_;
|
||||
const_tgba_ptr a_;
|
||||
typedef std::pair<bdd, bdd> cache_entry;
|
||||
typedef std::unordered_map<const state*, cache_entry,
|
||||
state_ptr_hash, state_ptr_equal> cache_t;
|
||||
|
|
@ -79,7 +79,7 @@ namespace spot
|
|||
const scc_map* sm_;
|
||||
|
||||
public:
|
||||
outgoing_acc(const tgba* a, const scc_map* sm): a_(a), sm_(sm)
|
||||
outgoing_acc(const const_tgba_ptr& a, const scc_map* sm): a_(a), sm_(sm)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -128,14 +128,14 @@ namespace spot
|
|||
// Check whether a state has an accepting self-loop, with a catch.
|
||||
class has_acc_loop
|
||||
{
|
||||
const tgba* a_;
|
||||
const_tgba_ptr a_;
|
||||
typedef std::unordered_map<const state*, bool,
|
||||
state_ptr_hash, state_ptr_equal> cache_t;
|
||||
cache_t cache_;
|
||||
state_unicity_table& uniq_;
|
||||
|
||||
public:
|
||||
has_acc_loop(const tgba* a, state_unicity_table& uniq):
|
||||
has_acc_loop(const const_tgba_ptr& a, state_unicity_table& uniq):
|
||||
a_(a),
|
||||
uniq_(uniq)
|
||||
{
|
||||
|
|
@ -250,16 +250,17 @@ namespace spot
|
|||
};
|
||||
|
||||
template<bool want_sba>
|
||||
tgba_digraph*
|
||||
degeneralize_aux(const tgba* a, bool use_z_lvl, bool use_cust_acc_orders,
|
||||
int use_lvl_cache, bool skip_levels)
|
||||
tgba_digraph_ptr
|
||||
degeneralize_aux(const const_tgba_ptr& a, bool use_z_lvl,
|
||||
bool use_cust_acc_orders, int use_lvl_cache,
|
||||
bool skip_levels)
|
||||
{
|
||||
bool use_scc = use_lvl_cache || use_cust_acc_orders || use_z_lvl;
|
||||
|
||||
bdd_dict_ptr dict = a->get_dict();
|
||||
|
||||
// The result automaton is an SBA.
|
||||
auto res = new tgba_digraph(dict);
|
||||
auto res = make_tgba_digraph(dict);
|
||||
res->copy_ap_of(a);
|
||||
res->set_single_acceptance_set();
|
||||
if (want_sba)
|
||||
|
|
@ -616,16 +617,18 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
degeneralize(const tgba* a, bool use_z_lvl, bool use_cust_acc_orders,
|
||||
tgba_digraph_ptr
|
||||
degeneralize(const const_tgba_ptr& a,
|
||||
bool use_z_lvl, bool use_cust_acc_orders,
|
||||
int use_lvl_cache, bool skip_levels)
|
||||
{
|
||||
return degeneralize_aux<true>(a, use_z_lvl, use_cust_acc_orders,
|
||||
use_lvl_cache, skip_levels);
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
degeneralize_tba(const tgba* a, bool use_z_lvl, bool use_cust_acc_orders,
|
||||
tgba_digraph_ptr
|
||||
degeneralize_tba(const const_tgba_ptr& a,
|
||||
bool use_z_lvl, bool use_cust_acc_orders,
|
||||
int use_lvl_cache, bool skip_levels)
|
||||
{
|
||||
return degeneralize_aux<false>(a, use_z_lvl, use_cust_acc_orders,
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ namespace spot
|
|||
/// The degeneralize_tba() variant produce a degeneralized automaton
|
||||
/// with transition-based acceptance.
|
||||
/// \@{
|
||||
SPOT_API tgba_digraph*
|
||||
degeneralize(const tgba* a, bool use_z_lvl = true,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
degeneralize(const const_tgba_ptr& a, bool use_z_lvl = true,
|
||||
bool use_cust_acc_orders = false,
|
||||
int use_lvl_cache = 1,
|
||||
bool skip_levels = true);
|
||||
|
||||
SPOT_API tgba_digraph*
|
||||
degeneralize_tba(const tgba* a, bool use_z_lvl = true,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
degeneralize_tba(const const_tgba_ptr& a, bool use_z_lvl = true,
|
||||
bool use_cust_acc_orders = false,
|
||||
int use_lvl_cache = 1,
|
||||
bool skip_levels = true);
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ namespace spot
|
|||
class dotty_bfs : public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
public:
|
||||
dotty_bfs(std::ostream& os, const tgba* a, bool mark_accepting_states,
|
||||
dotty_bfs(std::ostream& os, const_tgba_ptr a, bool mark_accepting_states,
|
||||
dotty_decorator* dd)
|
||||
: tgba_reachable_iterator_breadth_first(a), os_(os),
|
||||
mark_accepting_states_(mark_accepting_states), dd_(dd),
|
||||
sba_(dynamic_cast<const tgba_digraph*>(a))
|
||||
sba_(std::dynamic_pointer_cast<const tgba_digraph>(a))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -119,17 +119,17 @@ namespace spot
|
|||
std::ostream& os_;
|
||||
bool mark_accepting_states_;
|
||||
dotty_decorator* dd_;
|
||||
const tgba_digraph* sba_;
|
||||
const_tgba_digraph_ptr sba_;
|
||||
};
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
dotty_reachable(std::ostream& os, const tgba* g,
|
||||
dotty_reachable(std::ostream& os, const const_tgba_ptr& g,
|
||||
bool assume_sba, dotty_decorator* dd)
|
||||
{
|
||||
if (!dd)
|
||||
dd = dotty_decorator::instance();
|
||||
if (const tgba_digraph* gd = dynamic_cast<const tgba_digraph*>(g))
|
||||
if (auto gd = dynamic_cast<const tgba_digraph*>(g.get()))
|
||||
assume_sba |= gd->get_bprop(tgba_digraph::StateBasedAcc);
|
||||
|
||||
dotty_bfs d(os, g, assume_sba, dd);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et
|
||||
// Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
|
||||
// Developpement de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -24,6 +24,7 @@
|
|||
# define SPOT_TGBAALGOS_DOTTY_HH
|
||||
|
||||
# include <iosfwd>
|
||||
# include <tgba/fwd.hh>
|
||||
# include "misc/common.hh"
|
||||
|
||||
namespace spot
|
||||
|
|
@ -44,7 +45,7 @@ namespace spot
|
|||
/// labels the transitions are encoded in UTF-8.
|
||||
SPOT_API std::ostream&
|
||||
dotty_reachable(std::ostream& os,
|
||||
const tgba* g,
|
||||
const const_tgba_ptr& g,
|
||||
bool assume_sba = false,
|
||||
dotty_decorator* dd = 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de
|
||||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Developpement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -33,7 +34,7 @@ namespace spot
|
|||
}
|
||||
|
||||
std::string
|
||||
dotty_decorator::state_decl(const tgba*, const state*, int,
|
||||
dotty_decorator::state_decl(const const_tgba_ptr&, const state*, int,
|
||||
tgba_succ_iterator*, const std::string& label,
|
||||
bool accepting)
|
||||
{
|
||||
|
|
@ -44,7 +45,8 @@ namespace spot
|
|||
}
|
||||
|
||||
std::string
|
||||
dotty_decorator::link_decl(const tgba*, const state*, int, const state*, int,
|
||||
dotty_decorator::link_decl(const const_tgba_ptr&, const state*, int,
|
||||
const state*, int,
|
||||
const tgba_succ_iterator*,
|
||||
const std::string& label)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et
|
||||
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
|
||||
// Developpement de l'Epita (LRDE).
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
# include "misc/common.hh"
|
||||
# include <string>
|
||||
# include <tgba/fwd.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class state;
|
||||
class tgba;
|
||||
class tgba_succ_iterator;
|
||||
|
||||
/// \addtogroup tgba_dotty Decorating the dot output
|
||||
|
|
@ -57,7 +57,8 @@ namespace spot
|
|||
/// \param label the computed name of this state
|
||||
/// \param accepting whether the state is accepting (it makes sense only
|
||||
/// for state-acceptance automata)
|
||||
virtual std::string state_decl(const tgba* a, const state* s, int n,
|
||||
virtual std::string state_decl(const const_tgba_ptr& a,
|
||||
const state* s, int n,
|
||||
tgba_succ_iterator* si,
|
||||
const std::string& label,
|
||||
bool accepting);
|
||||
|
|
@ -80,7 +81,7 @@ namespace spot
|
|||
/// the current transition (owned by the caller and cannot
|
||||
/// be iterated)
|
||||
/// \param label the computed name of this state
|
||||
virtual std::string link_decl(const tgba* a,
|
||||
virtual std::string link_decl(const const_tgba_ptr& a,
|
||||
const state* in_s, int in,
|
||||
const state* out_s, int out,
|
||||
const tgba_succ_iterator* si,
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ namespace spot
|
|||
bool state_based_;
|
||||
scc_map& sm_;
|
||||
public:
|
||||
filler_dfs(const tgba* aut, dict& d, bdd ap, bool state_based,
|
||||
filler_dfs(const const_tgba_ptr& aut, dict& d, bdd ap, bool state_based,
|
||||
scc_map& sm)
|
||||
: tgba_reachable_iterator_depth_first(aut), d(d), ap_(ap),
|
||||
state_based_(state_based), sm_(sm)
|
||||
|
|
@ -324,7 +324,7 @@ namespace spot
|
|||
typedef std::pair<int, int> sat_stats;
|
||||
|
||||
static
|
||||
sat_stats dtba_to_sat(std::ostream& out, const tgba* ref,
|
||||
sat_stats dtba_to_sat(std::ostream& out, const_tgba_ptr ref,
|
||||
dict& d, bool state_based)
|
||||
{
|
||||
clause_counter nclauses;
|
||||
|
|
@ -665,12 +665,12 @@ namespace spot
|
|||
return std::make_pair(d.nvars, nclauses.nb_clauses());
|
||||
}
|
||||
|
||||
static tgba_digraph*
|
||||
static tgba_digraph_ptr
|
||||
sat_build(const satsolver::solution& solution, dict& satdict,
|
||||
const tgba* aut, bool state_based)
|
||||
const_tgba_ptr aut, bool state_based)
|
||||
{
|
||||
auto autdict = aut->get_dict();
|
||||
auto a = new tgba_digraph(autdict);
|
||||
auto a = make_tgba_digraph(autdict);
|
||||
a->copy_ap_of(aut);
|
||||
bdd acc = a->set_single_acceptance_set();
|
||||
a->new_states(satdict.cand_size);
|
||||
|
|
@ -769,8 +769,8 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
dtba_sat_synthetize(const tgba* a, int target_state_number,
|
||||
tgba_digraph_ptr
|
||||
dtba_sat_synthetize(const const_tgba_ptr& a, int target_state_number,
|
||||
bool state_based)
|
||||
{
|
||||
if (target_state_number == 0)
|
||||
|
|
@ -791,7 +791,7 @@ namespace spot
|
|||
solution = solver.get_solution();
|
||||
t.stop("solve");
|
||||
|
||||
tgba_digraph* res = nullptr;
|
||||
tgba_digraph_ptr res = nullptr;
|
||||
if (!solution.second.empty())
|
||||
res = sat_build(solution.second, d, a, state_based);
|
||||
|
||||
|
|
@ -827,46 +827,42 @@ namespace spot
|
|||
return res;
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
dtba_sat_minimize(const tgba* a, bool state_based)
|
||||
tgba_digraph_ptr
|
||||
dtba_sat_minimize(const const_tgba_ptr& a, bool state_based)
|
||||
{
|
||||
int n_states = stats_reachable(a).states;
|
||||
|
||||
tgba_digraph* prev = nullptr;
|
||||
tgba_digraph_ptr prev = nullptr;
|
||||
for (;;)
|
||||
{
|
||||
tgba_digraph* next =
|
||||
auto next =
|
||||
dtba_sat_synthetize(prev ? prev : a, --n_states, state_based);
|
||||
if (!next)
|
||||
break;
|
||||
return prev;
|
||||
else
|
||||
n_states = stats_reachable(next).states;
|
||||
|
||||
delete prev;
|
||||
prev = next;
|
||||
}
|
||||
return prev;
|
||||
SPOT_UNREACHABLE();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
dtba_sat_minimize_dichotomy(const tgba* a, bool state_based)
|
||||
tgba_digraph_ptr
|
||||
dtba_sat_minimize_dichotomy(const const_tgba_ptr& a, bool state_based)
|
||||
{
|
||||
int max_states = stats_reachable(a).states - 1;
|
||||
int min_states = 1;
|
||||
|
||||
tgba_digraph* prev = nullptr;
|
||||
tgba_digraph_ptr prev = nullptr;
|
||||
while (min_states <= max_states)
|
||||
{
|
||||
int target = (max_states + min_states) / 2;
|
||||
tgba_digraph* next =
|
||||
dtba_sat_synthetize(prev ? prev : a, target, state_based);
|
||||
auto next = dtba_sat_synthetize(prev ? prev : a, target, state_based);
|
||||
if (!next)
|
||||
{
|
||||
min_states = target + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete prev;
|
||||
prev = next;
|
||||
max_states = stats_reachable(next).states - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@ namespace spot
|
|||
///
|
||||
/// If no equivalent deterministic TBA with \a target_state_number
|
||||
/// states is found, a null pointer
|
||||
SPOT_API tgba_digraph*
|
||||
dtba_sat_synthetize(const tgba* a, int target_state_number,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dtba_sat_synthetize(const const_tgba_ptr& a,
|
||||
int target_state_number,
|
||||
bool state_based = false);
|
||||
|
||||
/// \brief Attempt to minimize a deterministic TBA with a SAT solver.
|
||||
|
|
@ -50,8 +51,8 @@ namespace spot
|
|||
/// number of states, and returns the last successfully built TBA.
|
||||
///
|
||||
/// If no smaller TBA exist, this returns a null pointer.
|
||||
SPOT_API tgba_digraph*
|
||||
dtba_sat_minimize(const tgba* a, bool state_based = false);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dtba_sat_minimize(const const_tgba_ptr& a, bool state_based = false);
|
||||
|
||||
/// \brief Attempt to minimize a deterministic TBA with a SAT solver.
|
||||
///
|
||||
|
|
@ -59,8 +60,9 @@ namespace spot
|
|||
/// find the minimum number of states using a binary search.
|
||||
//
|
||||
/// If no smaller TBA exist, this returns a null pointer.
|
||||
SPOT_API tgba_digraph*
|
||||
dtba_sat_minimize_dichotomy(const tgba* a, bool state_based = false);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dtba_sat_minimize_dichotomy(const const_tgba_ptr& a,
|
||||
bool state_based = false);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_DTBASAT_HH
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
|
||||
namespace spot
|
||||
{
|
||||
tgba_digraph* dtgba_complement(const tgba* aut)
|
||||
tgba_digraph_ptr dtgba_complement(const const_tgba_ptr& aut)
|
||||
{
|
||||
// Clone the original automaton.
|
||||
tgba_digraph* res = tgba_dupexp_dfs(aut);
|
||||
tgba_digraph_ptr res = tgba_dupexp_dfs(aut);
|
||||
|
||||
bdd oldaccs = aut->all_acceptance_conditions();
|
||||
bdd oldnegs = aut->neg_acceptance_conditions();
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ namespace spot
|
|||
/// to be complete. Acceptance can be transition-based, or
|
||||
/// state-based. The resulting automaton is very unlikely to be
|
||||
/// deterministic.
|
||||
SPOT_API tgba_digraph*
|
||||
dtgba_complement(const tgba* aut);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dtgba_complement(const const_tgba_ptr& aut);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_DTGBACOMP_HH
|
||||
|
|
|
|||
|
|
@ -243,12 +243,12 @@ namespace spot
|
|||
|
||||
struct dict
|
||||
{
|
||||
dict(const tgba* a)
|
||||
dict(const const_tgba_ptr& a)
|
||||
: aut(a)
|
||||
{
|
||||
}
|
||||
|
||||
const tgba* aut;
|
||||
const_tgba_ptr aut;
|
||||
typedef std::map<transition, int> trans_map;
|
||||
typedef std::map<transition_acc, int> trans_acc_map;
|
||||
trans_map transid;
|
||||
|
|
@ -296,7 +296,7 @@ namespace spot
|
|||
bool state_based_;
|
||||
scc_map& sm_;
|
||||
public:
|
||||
filler_dfs(const tgba* aut, dict& d, bdd ap, bool state_based,
|
||||
filler_dfs(const const_tgba_ptr& aut, dict& d, bdd ap, bool state_based,
|
||||
scc_map& sm)
|
||||
: tgba_reachable_iterator_depth_first(aut), d(d), ap_(ap),
|
||||
state_based_(state_based), sm_(sm)
|
||||
|
|
@ -466,7 +466,7 @@ namespace spot
|
|||
typedef std::pair<int, int> sat_stats;
|
||||
|
||||
static
|
||||
sat_stats dtgba_to_sat(std::ostream& out, const tgba* ref,
|
||||
sat_stats dtgba_to_sat(std::ostream& out, const_tgba_ptr ref,
|
||||
dict& d, bool state_based)
|
||||
{
|
||||
clause_counter nclauses;
|
||||
|
|
@ -837,12 +837,12 @@ namespace spot
|
|||
return std::make_pair(d.nvars, nclauses.nb_clauses());
|
||||
}
|
||||
|
||||
static tgba_digraph*
|
||||
static tgba_digraph_ptr
|
||||
sat_build(const satsolver::solution& solution, dict& satdict,
|
||||
const tgba* aut, bool state_based)
|
||||
const_tgba_ptr aut, bool state_based)
|
||||
{
|
||||
auto autdict = aut->get_dict();
|
||||
auto a = new tgba_digraph(autdict);
|
||||
auto a = make_tgba_digraph(autdict);
|
||||
a->copy_ap_of(aut);
|
||||
a->set_acceptance_conditions(satdict.all_cand_acc.back());
|
||||
|
||||
|
|
@ -935,9 +935,9 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
dtgba_sat_synthetize(const tgba* a, unsigned target_acc_number,
|
||||
int target_state_number, bool state_based)
|
||||
tgba_digraph_ptr
|
||||
dtgba_sat_synthetize (const const_tgba_ptr& a, unsigned target_acc_number,
|
||||
int target_state_number, bool state_based)
|
||||
{
|
||||
if (target_state_number == 0)
|
||||
return nullptr;
|
||||
|
|
@ -960,7 +960,7 @@ namespace spot
|
|||
solution = solver.get_solution();
|
||||
t.stop("solve");
|
||||
|
||||
tgba_digraph* res = nullptr;
|
||||
tgba_digraph_ptr res = nullptr;
|
||||
if (!solution.second.empty())
|
||||
res = sat_build(solution.second, d, a, state_based);
|
||||
|
||||
|
|
@ -996,40 +996,41 @@ namespace spot
|
|||
return res;
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
dtgba_sat_minimize(const tgba* a, unsigned target_acc_number,
|
||||
tgba_digraph_ptr
|
||||
dtgba_sat_minimize(const const_tgba_ptr& a,
|
||||
unsigned target_acc_number,
|
||||
bool state_based)
|
||||
{
|
||||
int n_states = stats_reachable(a).states;
|
||||
|
||||
tgba_digraph* prev = nullptr;
|
||||
tgba_digraph_ptr prev = nullptr;
|
||||
for (;;)
|
||||
{
|
||||
tgba_digraph* next =
|
||||
auto next =
|
||||
dtgba_sat_synthetize(prev ? prev : a, target_acc_number,
|
||||
--n_states, state_based);
|
||||
if (!next)
|
||||
break;
|
||||
return prev;
|
||||
else
|
||||
n_states = stats_reachable(next).states;
|
||||
delete prev;
|
||||
prev = next;
|
||||
}
|
||||
return prev;
|
||||
SPOT_UNREACHABLE();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
dtgba_sat_minimize_dichotomy(const tgba* a, unsigned target_acc_number,
|
||||
tgba_digraph_ptr
|
||||
dtgba_sat_minimize_dichotomy(const const_tgba_ptr& a,
|
||||
unsigned target_acc_number,
|
||||
bool state_based)
|
||||
{
|
||||
int max_states = stats_reachable(a).states - 1;
|
||||
int min_states = 1;
|
||||
|
||||
tgba_digraph* prev = nullptr;
|
||||
tgba_digraph_ptr prev = nullptr;
|
||||
while (min_states <= max_states)
|
||||
{
|
||||
int target = (max_states + min_states) / 2;
|
||||
tgba_digraph* next =
|
||||
auto next =
|
||||
dtgba_sat_synthetize(prev ? prev : a, target_acc_number, target,
|
||||
state_based);
|
||||
if (!next)
|
||||
|
|
@ -1038,7 +1039,6 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
delete prev;
|
||||
prev = next;
|
||||
max_states = stats_reachable(next).states - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,9 @@ namespace spot
|
|||
/// acceptance sets and target_state_number states that is
|
||||
/// equivalent to \a a. If no such TGBA is found, a null pointer is
|
||||
/// returned.
|
||||
SPOT_API tgba_digraph*
|
||||
dtgba_sat_synthetize(const tgba* a, unsigned target_acc_number,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dtgba_sat_synthetize(const const_tgba_ptr& a,
|
||||
unsigned target_acc_number,
|
||||
int target_state_number,
|
||||
bool state_based = false);
|
||||
|
||||
|
|
@ -55,8 +56,9 @@ namespace spot
|
|||
/// number of states, and returns the last successfully built TGBA.
|
||||
///
|
||||
/// If no smaller TGBA exist, this returns a null pointer.
|
||||
SPOT_API tgba_digraph*
|
||||
dtgba_sat_minimize(const tgba* a, unsigned target_acc_number,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dtgba_sat_minimize(const const_tgba_ptr& a,
|
||||
unsigned target_acc_number,
|
||||
bool state_based = false);
|
||||
|
||||
/// \brief Attempt to minimize a deterministic TGBA with a SAT solver.
|
||||
|
|
@ -65,8 +67,9 @@ namespace spot
|
|||
/// find the minimum number of states using a binary search.
|
||||
//
|
||||
/// If no smaller TBA exist, this returns a null pointer.
|
||||
SPOT_API tgba_digraph*
|
||||
dtgba_sat_minimize_dichotomy(const tgba* a, unsigned target_acc_number,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dtgba_sat_minimize_dichotomy(const const_tgba_ptr& a,
|
||||
unsigned target_acc_number,
|
||||
bool state_based = false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ namespace spot
|
|||
class dupexp_iter: public T
|
||||
{
|
||||
public:
|
||||
dupexp_iter(const tgba* a)
|
||||
: T(a), out_(new tgba_digraph(a->get_dict()))
|
||||
dupexp_iter(const const_tgba_ptr& a)
|
||||
: T(a), out_(make_tgba_digraph(a->get_dict()))
|
||||
{
|
||||
out_->copy_acceptance_conditions_of(a);
|
||||
out_->copy_ap_of(a);
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
tgba_digraph_ptr
|
||||
result()
|
||||
{
|
||||
return out_;
|
||||
|
|
@ -66,14 +66,15 @@ namespace spot
|
|||
}
|
||||
|
||||
protected:
|
||||
tgba_digraph* out_;
|
||||
tgba_digraph_ptr out_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class dupexp_iter_save: public dupexp_iter<T>
|
||||
{
|
||||
public:
|
||||
dupexp_iter_save(const tgba* a, std::vector<const state*>& relation)
|
||||
dupexp_iter_save(const const_tgba_ptr& a,
|
||||
std::vector<const state*>& relation)
|
||||
: dupexp_iter<T>(a), relation_(relation)
|
||||
{
|
||||
}
|
||||
|
|
@ -91,32 +92,32 @@ namespace spot
|
|||
|
||||
} // anonymous
|
||||
|
||||
tgba_digraph*
|
||||
tgba_dupexp_bfs(const tgba* aut)
|
||||
tgba_digraph_ptr
|
||||
tgba_dupexp_bfs(const const_tgba_ptr& aut)
|
||||
{
|
||||
dupexp_iter<tgba_reachable_iterator_breadth_first> di(aut);
|
||||
di.run();
|
||||
return di.result();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
tgba_dupexp_dfs(const tgba* aut)
|
||||
tgba_digraph_ptr
|
||||
tgba_dupexp_dfs(const const_tgba_ptr& aut)
|
||||
{
|
||||
dupexp_iter<tgba_reachable_iterator_depth_first> di(aut);
|
||||
di.run();
|
||||
return di.result();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
tgba_dupexp_bfs(const tgba* aut, std::vector<const state*>& rel)
|
||||
tgba_digraph_ptr
|
||||
tgba_dupexp_bfs(const const_tgba_ptr& aut, std::vector<const state*>& rel)
|
||||
{
|
||||
dupexp_iter_save<tgba_reachable_iterator_breadth_first> di(aut, rel);
|
||||
di.run();
|
||||
return di.result();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
tgba_dupexp_dfs(const tgba* aut, std::vector<const state*>& rel)
|
||||
tgba_digraph_ptr
|
||||
tgba_dupexp_dfs(const const_tgba_ptr& aut, std::vector<const state*>& rel)
|
||||
{
|
||||
dupexp_iter_save<tgba_reachable_iterator_depth_first> di(aut, rel);
|
||||
di.run();
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ namespace spot
|
|||
/// \ingroup tgba_misc
|
||||
/// \brief Build an explicit automaton from all states of \a aut,
|
||||
/// numbering states in bread first order as they are processed.
|
||||
SPOT_API tgba_digraph*
|
||||
tgba_dupexp_bfs(const tgba* aut);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tgba_dupexp_bfs(const const_tgba_ptr& aut);
|
||||
/// \ingroup tgba_misc
|
||||
/// \brief Build an explicit automaton from all states of \a aut,
|
||||
/// numbering states in depth first order as they are processed.
|
||||
SPOT_API tgba_digraph*
|
||||
tgba_dupexp_dfs(const tgba* aut);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tgba_dupexp_dfs(const const_tgba_ptr& aut);
|
||||
|
||||
/// \ingroup tgba_misc
|
||||
/// \brief Build an explicit automaton from all states of \a aut,
|
||||
|
|
@ -44,8 +44,9 @@ namespace spot
|
|||
/// \a aut the automaton to duplicate
|
||||
/// \a relation a map of all the new states (represented by
|
||||
/// their number) to the old states.
|
||||
SPOT_API tgba_digraph*
|
||||
tgba_dupexp_bfs(const tgba* aut, std::vector<const state*>& relation);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tgba_dupexp_bfs(const const_tgba_ptr& aut,
|
||||
std::vector<const state*>& relation);
|
||||
|
||||
/// \ingroup tgba_misc
|
||||
/// \brief Build an explicit automata from all states of \a aut,
|
||||
|
|
@ -53,8 +54,9 @@ namespace spot
|
|||
/// \a aut the automaton to duplicate
|
||||
/// \a relation a map of all the new states (represented by
|
||||
/// their number) to the old states.
|
||||
SPOT_API tgba_digraph*
|
||||
tgba_dupexp_dfs(const tgba* aut, std::vector<const state*>& relation);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tgba_dupexp_dfs(const const_tgba_ptr& aut,
|
||||
std::vector<const state*>& relation);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_DUPEXP_HH
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace spot
|
|||
|
||||
std::ostream&
|
||||
print_tgba_run(std::ostream& os,
|
||||
const tgba* a,
|
||||
const_tgba_ptr a,
|
||||
const tgba_run* run)
|
||||
{
|
||||
bdd_dict_ptr d = a->get_dict();
|
||||
|
|
@ -180,17 +180,16 @@ namespace spot
|
|||
|
||||
namespace
|
||||
{
|
||||
|
||||
spot::emptiness_check*
|
||||
couvreur99_cons(const spot::tgba* a, spot::option_map o)
|
||||
emptiness_check*
|
||||
make_couvreur99(const const_tgba_ptr& a, spot::option_map o)
|
||||
{
|
||||
return spot::couvreur99(a, o);
|
||||
return couvreur99(a, o);
|
||||
}
|
||||
|
||||
struct ec_algo
|
||||
{
|
||||
const char* name;
|
||||
spot::emptiness_check* (*construct)(const spot::tgba*,
|
||||
spot::emptiness_check* (*construct)(const const_tgba_ptr&,
|
||||
spot::option_map);
|
||||
unsigned int min_acc;
|
||||
unsigned int max_acc;
|
||||
|
|
@ -198,7 +197,7 @@ namespace spot
|
|||
|
||||
ec_algo ec_algos[] =
|
||||
{
|
||||
{ "Cou99", couvreur99_cons, 0, -1U },
|
||||
{ "Cou99", make_couvreur99, 0, -1U },
|
||||
{ "CVWY90", spot::magic_search, 0, 1 },
|
||||
{ "GV04", spot::explicit_gv04_check, 0, 1 },
|
||||
{ "SE05", spot::se05, 0, 1 },
|
||||
|
|
@ -226,7 +225,7 @@ namespace spot
|
|||
}
|
||||
|
||||
emptiness_check*
|
||||
emptiness_check_instantiator::instantiate(const tgba* a) const
|
||||
emptiness_check_instantiator::instantiate(const const_tgba_ptr& a) const
|
||||
{
|
||||
return static_cast<ec_algo*>(info_)->construct(a, o_);
|
||||
}
|
||||
|
|
@ -282,11 +281,11 @@ namespace spot
|
|||
// tgba_run_to_tgba
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
tgba_digraph*
|
||||
tgba_run_to_tgba(const tgba* a, const tgba_run* run)
|
||||
tgba_digraph_ptr
|
||||
tgba_run_to_tgba(const const_tgba_ptr& a, const tgba_run* run)
|
||||
{
|
||||
auto d = a->get_dict();
|
||||
auto res = new tgba_digraph(d);
|
||||
auto res = make_tgba_digraph(d);
|
||||
res->copy_ap_of(a);
|
||||
res->copy_acceptance_conditions_of(a);
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ namespace spot
|
|||
class SPOT_API emptiness_check_result
|
||||
{
|
||||
public:
|
||||
emptiness_check_result(const tgba* a, option_map o = option_map())
|
||||
emptiness_check_result(const const_tgba_ptr& a,
|
||||
option_map o = option_map())
|
||||
: a_(a), o_(o)
|
||||
{
|
||||
}
|
||||
|
|
@ -103,7 +104,7 @@ namespace spot
|
|||
virtual tgba_run* accepting_run();
|
||||
|
||||
/// The automaton on which an accepting_run() was found.
|
||||
const tgba*
|
||||
const const_tgba_ptr&
|
||||
automaton() const
|
||||
{
|
||||
return a_;
|
||||
|
|
@ -126,7 +127,7 @@ namespace spot
|
|||
/// Notify option updates.
|
||||
virtual void options_updated(const option_map& old);
|
||||
|
||||
const tgba* a_; ///< The automaton.
|
||||
const_tgba_ptr a_; ///< The automaton.
|
||||
option_map o_; ///< The options.
|
||||
};
|
||||
|
||||
|
|
@ -134,14 +135,14 @@ namespace spot
|
|||
class SPOT_API emptiness_check
|
||||
{
|
||||
public:
|
||||
emptiness_check(const tgba* a, option_map o = option_map())
|
||||
emptiness_check(const const_tgba_ptr& a, option_map o = option_map())
|
||||
: a_(a), o_(o)
|
||||
{
|
||||
}
|
||||
virtual ~emptiness_check();
|
||||
|
||||
/// The automaton that this emptiness-check inspects.
|
||||
const tgba*
|
||||
const const_tgba_ptr&
|
||||
automaton() const
|
||||
{
|
||||
return a_;
|
||||
|
|
@ -186,7 +187,7 @@ namespace spot
|
|||
virtual void options_updated(const option_map& old);
|
||||
|
||||
protected:
|
||||
const tgba* a_; ///< The automaton.
|
||||
const_tgba_ptr a_; ///< The automaton.
|
||||
option_map o_; ///< The options
|
||||
};
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ namespace spot
|
|||
const char** err);
|
||||
|
||||
/// Actually instantiate the emptiness check, for \a a.
|
||||
emptiness_check* instantiate(const tgba* a) const;
|
||||
emptiness_check* instantiate(const const_tgba_ptr& a) const;
|
||||
|
||||
/// Accessor to the options.
|
||||
/// @{
|
||||
|
|
@ -288,14 +289,14 @@ namespace spot
|
|||
/// actually exists in the automaton (and will also display any
|
||||
/// transition annotation).
|
||||
SPOT_API std::ostream&
|
||||
print_tgba_run(std::ostream& os, const tgba* a, const tgba_run* run);
|
||||
print_tgba_run(std::ostream& os, const_tgba_ptr a, const tgba_run* run);
|
||||
|
||||
/// \brief Return an explicit_tgba corresponding to \a run (i.e. comparable
|
||||
/// states are merged).
|
||||
///
|
||||
/// \pre \a run must correspond to an actual run of the automaton \a a.
|
||||
SPOT_API tgba_digraph*
|
||||
tgba_run_to_tgba(const tgba* a, const tgba_run* run);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tgba_run_to_tgba(const const_tgba_ptr& a, const tgba_run* run);
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace spot
|
|||
typedef std::pair<const spot::state*, tgba_succ_iterator*> pair_state_iter;
|
||||
}
|
||||
|
||||
couvreur99_check::couvreur99_check(const tgba* a, option_map o)
|
||||
couvreur99_check::couvreur99_check(const const_tgba_ptr& a, option_map o)
|
||||
: emptiness_check(a, o),
|
||||
removed_components(0)
|
||||
{
|
||||
|
|
@ -319,7 +319,8 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
couvreur99_check_shy::couvreur99_check_shy(const tgba* a, option_map o)
|
||||
couvreur99_check_shy::couvreur99_check_shy(const const_tgba_ptr& a,
|
||||
option_map o)
|
||||
: couvreur99_check(a, o), num(1)
|
||||
{
|
||||
group_ = o.get("group", 1);
|
||||
|
|
@ -592,7 +593,7 @@ namespace spot
|
|||
}
|
||||
|
||||
emptiness_check*
|
||||
couvreur99(const tgba* a, option_map o)
|
||||
couvreur99(const const_tgba_ptr& a, option_map o)
|
||||
{
|
||||
if (o.get("shy"))
|
||||
return new couvreur99_check_shy(a, o);
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ namespace spot
|
|||
/// choosing a successor. Otherwise, only the successor of the
|
||||
/// topmost state on the DFS stack are considered.
|
||||
SPOT_API emptiness_check*
|
||||
couvreur99(const tgba* a, option_map options = option_map());
|
||||
couvreur99(const const_tgba_ptr& a, option_map options = option_map());
|
||||
|
||||
|
||||
/// \brief An implementation of the Couvreur99 emptiness-check algorithm.
|
||||
|
|
@ -146,7 +146,7 @@ namespace spot
|
|||
class SPOT_API couvreur99_check: public emptiness_check, public ec_statistics
|
||||
{
|
||||
public:
|
||||
couvreur99_check(const tgba* a, option_map o = option_map());
|
||||
couvreur99_check(const const_tgba_ptr& a, option_map o = option_map());
|
||||
virtual ~couvreur99_check();
|
||||
|
||||
/// Check whether the automaton's language is empty.
|
||||
|
|
@ -188,7 +188,7 @@ namespace spot
|
|||
class SPOT_API couvreur99_check_shy : public couvreur99_check
|
||||
{
|
||||
public:
|
||||
couvreur99_check_shy(const tgba* a, option_map o = option_map());
|
||||
couvreur99_check_shy(const const_tgba_ptr& a, option_map o = option_map());
|
||||
virtual ~couvreur99_check_shy();
|
||||
|
||||
virtual emptiness_check_result* check();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
namespace spot
|
||||
{
|
||||
couvreur99_check_status::couvreur99_check_status(const tgba* aut)
|
||||
couvreur99_check_status::couvreur99_check_status(const const_tgba_ptr& aut)
|
||||
: aut(aut)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ namespace spot
|
|||
class SPOT_API couvreur99_check_status
|
||||
{
|
||||
public:
|
||||
couvreur99_check_status(const tgba* aut);
|
||||
couvreur99_check_status(const const_tgba_ptr& aut);
|
||||
|
||||
~couvreur99_check_status();
|
||||
|
||||
const tgba* aut;
|
||||
const_tgba_ptr aut;
|
||||
scc_stack root;
|
||||
|
||||
typedef std::unordered_map<const state*, int,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace spot
|
|||
int dftop; // Top of DFS stack.
|
||||
bool violation; // Whether an accepting run was found.
|
||||
|
||||
gv04(const tgba *a, option_map o)
|
||||
gv04(const const_tgba_ptr& a, option_map o)
|
||||
: emptiness_check(a, o), accepting(a->all_acceptance_conditions())
|
||||
{
|
||||
assert(a->number_of_acceptance_conditions() <= 1);
|
||||
|
|
@ -410,7 +410,7 @@ namespace spot
|
|||
} // anonymous
|
||||
|
||||
emptiness_check*
|
||||
explicit_gv04_check(const tgba* a, option_map o)
|
||||
explicit_gv04_check(const const_tgba_ptr& a, option_map o)
|
||||
{
|
||||
return new gv04(a, o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -23,11 +23,11 @@
|
|||
#ifndef SPOT_TGBAALGOS_GV04_HH
|
||||
# define SPOT_TGBAALGOS_GV04_HH
|
||||
|
||||
#include "misc/optionmap.hh"
|
||||
# include "misc/optionmap.hh"
|
||||
# include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgba;
|
||||
class emptiness_check;
|
||||
|
||||
/// \brief Emptiness check based on Geldenhuys and Valmari's
|
||||
|
|
@ -55,7 +55,7 @@ namespace spot
|
|||
}
|
||||
\endverbatim */
|
||||
SPOT_API emptiness_check*
|
||||
explicit_gv04_check(const tgba* a, option_map o = option_map());
|
||||
explicit_gv04_check(const const_tgba_ptr& a, option_map o = option_map());
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_GV04_HH
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace spot
|
|||
{
|
||||
static
|
||||
unsigned
|
||||
count_nondet_states_aux(const tgba* aut, bool count = true)
|
||||
count_nondet_states_aux(const const_tgba_ptr& aut, bool count = true)
|
||||
{
|
||||
unsigned res = 0;
|
||||
typedef std::deque<const state*> todo_list;
|
||||
|
|
@ -80,19 +80,19 @@ namespace spot
|
|||
}
|
||||
|
||||
unsigned
|
||||
count_nondet_states(const tgba* aut)
|
||||
count_nondet_states(const const_tgba_ptr& aut)
|
||||
{
|
||||
return count_nondet_states_aux(aut);
|
||||
}
|
||||
|
||||
bool
|
||||
is_deterministic(const tgba* aut)
|
||||
is_deterministic(const const_tgba_ptr& aut)
|
||||
{
|
||||
return !count_nondet_states_aux(aut, false);
|
||||
}
|
||||
|
||||
bool
|
||||
is_complete(const tgba* aut)
|
||||
is_complete(const const_tgba_ptr& aut)
|
||||
{
|
||||
state_set seen;
|
||||
typedef std::deque<const state*> todo_list;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace spot
|
|||
/// but it is more efficient to call is_deterministic() if you do not
|
||||
/// care about the number of nondeterministic states.
|
||||
SPOT_API unsigned
|
||||
count_nondet_states(const tgba* aut);
|
||||
count_nondet_states(const const_tgba_ptr& aut);
|
||||
|
||||
/// \brief Return true iff \a aut is deterministic.
|
||||
///
|
||||
|
|
@ -41,14 +41,14 @@ namespace spot
|
|||
/// the automaton is nondeterministic, because it can return before
|
||||
/// the entire automaton has been explored.
|
||||
SPOT_API bool
|
||||
is_deterministic(const tgba* aut);
|
||||
is_deterministic(const const_tgba_ptr& aut);
|
||||
|
||||
/// \brief Return true iff \a aut is complete.
|
||||
///
|
||||
/// An automaton is complete if its translation relation is total,
|
||||
/// i.e., each state as a successor for any possible configuration.
|
||||
SPOT_API bool
|
||||
is_complete(const tgba* aut);
|
||||
is_complete(const const_tgba_ptr& aut);
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace spot
|
|||
bool
|
||||
is_complete_scc(scc_map& map, unsigned scc)
|
||||
{
|
||||
const spot::tgba *a = map.get_aut();
|
||||
auto a = map.get_aut();
|
||||
for (auto s: map.states_of(scc))
|
||||
{
|
||||
tgba_succ_iterator* it = a->succ_iter(s);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <memory>
|
||||
#include "tgba/formula2bdd.hh"
|
||||
#include "reachiter.hh"
|
||||
#include "misc/bddlt.hh"
|
||||
|
|
@ -74,7 +73,7 @@ namespace spot
|
|||
class lbtt_bfs : public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
public:
|
||||
lbtt_bfs(const tgba* a, std::ostream& os, bool sba_format)
|
||||
lbtt_bfs(const const_tgba_ptr& a, std::ostream& os, bool sba_format)
|
||||
: tgba_reachable_iterator_breadth_first(a),
|
||||
os_(os),
|
||||
all_acc_conds_(a->all_acceptance_conditions()),
|
||||
|
|
@ -83,7 +82,7 @@ namespace spot
|
|||
// Check if the automaton can be converted into a
|
||||
// tgba_digraph. This makes the state_is_accepting()
|
||||
// function more efficient.
|
||||
sba_(dynamic_cast<const tgba_digraph*>(a))
|
||||
sba_(std::dynamic_pointer_cast<const tgba_digraph>(a))
|
||||
{
|
||||
if (sba_ && !sba_->get_bprop(tgba_digraph::SBA))
|
||||
sba_ = nullptr;
|
||||
|
|
@ -166,18 +165,18 @@ namespace spot
|
|||
bdd all_acc_conds_;
|
||||
acceptance_cond_splitter acs_;
|
||||
bool sba_format_;
|
||||
const tgba_digraph* sba_;
|
||||
const_tgba_digraph_ptr sba_;
|
||||
};
|
||||
|
||||
static
|
||||
const tgba_digraph*
|
||||
tgba_digraph_ptr
|
||||
lbtt_read_tgba(unsigned num_states, unsigned num_acc,
|
||||
std::istream& is, std::string& error,
|
||||
bdd_dict_ptr dict,
|
||||
ltl::environment& env, ltl::environment& envacc)
|
||||
{
|
||||
auto aut = std::unique_ptr<tgba_digraph>(new tgba_digraph(dict));
|
||||
acc_mapper_int acc_b(aut.get(), num_acc, envacc);
|
||||
auto aut = make_tgba_digraph(dict);
|
||||
acc_mapper_int acc_b(aut, num_acc, envacc);
|
||||
aut->new_states(num_states);
|
||||
|
||||
for (unsigned n = 0; n < num_states; ++n)
|
||||
|
|
@ -232,17 +231,17 @@ namespace spot
|
|||
aut->new_transition(src_state, dst_state, cond, acc);
|
||||
}
|
||||
}
|
||||
return aut.release();
|
||||
return aut;
|
||||
}
|
||||
|
||||
const tgba_digraph*
|
||||
tgba_digraph_ptr
|
||||
lbtt_read_gba(unsigned num_states, unsigned num_acc,
|
||||
std::istream& is, std::string& error,
|
||||
bdd_dict_ptr dict,
|
||||
ltl::environment& env, ltl::environment& envacc)
|
||||
{
|
||||
auto aut = std::unique_ptr<tgba_digraph>(new tgba_digraph(dict));
|
||||
acc_mapper_int acc_b(aut.get(), num_acc, envacc);
|
||||
auto aut = make_tgba_digraph(dict);
|
||||
acc_mapper_int acc_b(aut, num_acc, envacc);
|
||||
aut->new_states(num_states);
|
||||
aut->set_bprop(tgba_digraph::StateBasedAcc);
|
||||
|
||||
|
|
@ -298,14 +297,14 @@ namespace spot
|
|||
aut->new_transition(src_state, dst_state, cond, acc);
|
||||
}
|
||||
}
|
||||
return aut.release();
|
||||
return aut;
|
||||
}
|
||||
|
||||
} // anonymous
|
||||
|
||||
|
||||
std::ostream&
|
||||
lbtt_reachable(std::ostream& os, const tgba* g, bool sba)
|
||||
lbtt_reachable(std::ostream& os, const const_tgba_ptr& g, bool sba)
|
||||
{
|
||||
lbtt_bfs b(g, os, sba);
|
||||
b.run();
|
||||
|
|
@ -313,7 +312,7 @@ namespace spot
|
|||
}
|
||||
|
||||
|
||||
const tgba_digraph*
|
||||
tgba_digraph_ptr
|
||||
lbtt_parse(std::istream& is, std::string& error, bdd_dict_ptr dict,
|
||||
ltl::environment& env, ltl::environment& envacc)
|
||||
{
|
||||
|
|
@ -332,7 +331,7 @@ namespace spot
|
|||
{
|
||||
std::string header;
|
||||
std::getline(is, header);
|
||||
return new tgba_digraph(dict);
|
||||
return make_tgba_digraph(dict);
|
||||
}
|
||||
|
||||
unsigned num_acc = 0;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace spot
|
|||
/// \param sba Assume \a g is an SBA and use LBTT's state-based
|
||||
/// acceptance format (similar to LBT's format).
|
||||
SPOT_API std::ostream&
|
||||
lbtt_reachable(std::ostream& os, const tgba* g, bool sba = false);
|
||||
lbtt_reachable(std::ostream& os, const const_tgba_ptr& g, bool sba = false);
|
||||
|
||||
/// \ingroup tgba_io
|
||||
/// \brief Read an automaton in LBTT's format
|
||||
|
|
@ -51,7 +51,7 @@ namespace spot
|
|||
/// \param envacc The environment of acceptance conditions into which parsing
|
||||
/// should take place.
|
||||
/// \return the read tgba or 0 on error.
|
||||
SPOT_API const tgba_digraph*
|
||||
SPOT_API tgba_digraph_ptr
|
||||
lbtt_parse(std::istream& is, std::string& error,
|
||||
bdd_dict_ptr dict,
|
||||
ltl::environment& env = ltl::default_environment::instance(),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ namespace spot
|
|||
class ltl2taa_visitor : public visitor
|
||||
{
|
||||
public:
|
||||
ltl2taa_visitor(taa_tgba_formula* res, language_containment_checker* lcc,
|
||||
ltl2taa_visitor(const taa_tgba_formula_ptr& res,
|
||||
language_containment_checker* lcc,
|
||||
bool refined = false, bool negated = false)
|
||||
: res_(res), refined_(refined), negated_(negated),
|
||||
lcc_(lcc), init_(), succ_(), to_free_()
|
||||
|
|
@ -50,7 +51,7 @@ namespace spot
|
|||
{
|
||||
}
|
||||
|
||||
taa_tgba_formula*
|
||||
taa_tgba_formula_ptr&
|
||||
result()
|
||||
{
|
||||
for (unsigned i = 0; i < to_free_.size(); ++i)
|
||||
|
|
@ -345,14 +346,12 @@ namespace spot
|
|||
}
|
||||
|
||||
private:
|
||||
taa_tgba_formula* res_;
|
||||
taa_tgba_formula_ptr res_;
|
||||
bool refined_;
|
||||
bool negated_;
|
||||
language_containment_checker* lcc_;
|
||||
|
||||
typedef std::insert_iterator<
|
||||
std::vector<const formula*>
|
||||
> ii;
|
||||
typedef std::insert_iterator<std::vector<const formula*>> ii;
|
||||
|
||||
struct succ_state
|
||||
{
|
||||
|
|
@ -417,21 +416,22 @@ namespace spot
|
|||
};
|
||||
} // anonymous
|
||||
|
||||
taa_tgba*
|
||||
ltl_to_taa(const ltl::formula* f, bdd_dict_ptr dict, bool refined_rules)
|
||||
taa_tgba_formula_ptr
|
||||
ltl_to_taa(const ltl::formula* f,
|
||||
const bdd_dict_ptr& dict, bool refined_rules)
|
||||
{
|
||||
// TODO: s/unabbreviate_ltl/unabbreviate_logic/
|
||||
const ltl::formula* f1 = ltl::unabbreviate_ltl(f);
|
||||
const ltl::formula* f2 = ltl::negative_normal_form(f1);
|
||||
f1->destroy();
|
||||
|
||||
spot::taa_tgba_formula* res = new spot::taa_tgba_formula(dict);
|
||||
auto res = make_taa_tgba_formula(dict);
|
||||
language_containment_checker* lcc =
|
||||
new language_containment_checker(make_bdd_dict(),
|
||||
false, false, false, false);
|
||||
ltl2taa_visitor v(res, lcc, refined_rules);
|
||||
f2->accept(v);
|
||||
taa_tgba* taa = v.result(); // Careful: before the destroy!
|
||||
auto taa = v.result(); // Careful: before the destroy!
|
||||
f2->destroy();
|
||||
delete lcc;
|
||||
return taa;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2009, 2010, 2013 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2009, 2010, 2013, 2014 Laboratoire de Recherche et
|
||||
// Développement de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
|
|
@ -48,8 +48,8 @@ namespace spot
|
|||
/// \param dict The spot::bdd_dict the constructed automata should use.
|
||||
/// \param refined_rules If this parameter is set, refined rules are used.
|
||||
/// \return A spot::taa that recognizes the language of \a f.
|
||||
SPOT_API taa_tgba*
|
||||
ltl_to_taa(const ltl::formula* f, bdd_dict_ptr dict,
|
||||
SPOT_API taa_tgba_formula_ptr
|
||||
ltl_to_taa(const ltl::formula* f, const bdd_dict_ptr& dict,
|
||||
bool refined_rules = false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,12 +114,12 @@ namespace spot
|
|||
formula_ptr_hash>::type namer;
|
||||
public:
|
||||
ratexp_to_dfa(translate_dict& dict);
|
||||
std::tuple<const tgba_digraph*, const namer*, const state*>
|
||||
std::tuple<const_tgba_digraph_ptr, const namer*, const state*>
|
||||
succ(const formula* f);
|
||||
~ratexp_to_dfa();
|
||||
|
||||
protected:
|
||||
typedef std::pair<tgba_digraph*, const namer*> labelled_aut;
|
||||
typedef std::pair<tgba_digraph_ptr, const namer*> labelled_aut;
|
||||
labelled_aut translate(const formula* f);
|
||||
|
||||
private:
|
||||
|
|
@ -976,7 +976,6 @@ namespace spot
|
|||
{
|
||||
for (auto i: automata_)
|
||||
{
|
||||
delete i.first;
|
||||
for (auto n: i.second->names())
|
||||
n->destroy();
|
||||
delete i.second;
|
||||
|
|
@ -988,7 +987,7 @@ namespace spot
|
|||
{
|
||||
assert(f->is_in_nenoform());
|
||||
|
||||
auto a = new tgba_digraph(dict_.dict);
|
||||
auto a = make_tgba_digraph(dict_.dict);
|
||||
auto namer = a->create_namer<const formula*, formula_ptr_hash>();
|
||||
|
||||
typedef std::set<const formula*, formula_ptr_less_than> set_type;
|
||||
|
|
@ -1107,7 +1106,6 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
delete a;
|
||||
for (auto n: namer->names())
|
||||
n->destroy();
|
||||
delete namer;
|
||||
|
|
@ -1116,7 +1114,7 @@ namespace spot
|
|||
}
|
||||
|
||||
// FIXME: use the new tgba::succ() interface
|
||||
std::tuple<const tgba_digraph*,
|
||||
std::tuple<const_tgba_digraph_ptr,
|
||||
const ratexp_to_dfa::namer*,
|
||||
const state*>
|
||||
ratexp_to_dfa::succ(const formula* f)
|
||||
|
|
@ -2028,7 +2026,7 @@ namespace spot
|
|||
}
|
||||
|
||||
|
||||
tgba_digraph*
|
||||
tgba_digraph_ptr
|
||||
ltl_to_tgba_fm(const formula* f, bdd_dict_ptr dict,
|
||||
bool exprop, bool symb_merge, bool branching_postponement,
|
||||
bool fair_loop_approx, const atomic_prop_set* unobs,
|
||||
|
|
@ -2108,7 +2106,7 @@ namespace spot
|
|||
bdd all_events = observable_events | unobservable_events;
|
||||
|
||||
|
||||
tgba_digraph* a = new tgba_digraph(dict);
|
||||
tgba_digraph_ptr a = make_tgba_digraph(dict);
|
||||
auto namer = a->create_namer<const formula*, formula_ptr_hash>();
|
||||
|
||||
// This is in case the initial state is equivalent to true...
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
namespace spot
|
||||
{
|
||||
/// \ingroup tgba_ltl
|
||||
/// \brief Build a spot::tgba_digraph* from an LTL formula.
|
||||
/// \brief Build a spot::tgba_digraph_ptr from an LTL formula.
|
||||
///
|
||||
/// This is based on the following paper.
|
||||
/** \verbatim
|
||||
|
|
@ -122,7 +122,7 @@ namespace spot
|
|||
\endverbatim */
|
||||
///
|
||||
/// \return A spot::tgba_digraph that recognizes the language of \a f.
|
||||
SPOT_API tgba_digraph*
|
||||
SPOT_API tgba_digraph_ptr
|
||||
ltl_to_tgba_fm(const ltl::formula* f, bdd_dict_ptr dict,
|
||||
bool exprop = false, bool symb_merge = true,
|
||||
bool branching_postponement = false,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ namespace spot
|
|||
///
|
||||
/// \pre The automaton \a a must have at most one acceptance
|
||||
/// condition (i.e. it is a TBA).
|
||||
magic_search_(const tgba *a, size_t size, option_map o = option_map())
|
||||
magic_search_(const const_tgba_ptr& a, size_t size,
|
||||
option_map o = option_map())
|
||||
: emptiness_check(a, o),
|
||||
h(size),
|
||||
all_cond(a->all_acceptance_conditions())
|
||||
|
|
@ -583,19 +584,19 @@ namespace spot
|
|||
|
||||
} // anonymous
|
||||
|
||||
emptiness_check* explicit_magic_search(const tgba *a, option_map o)
|
||||
emptiness_check* explicit_magic_search(const const_tgba_ptr& a, option_map o)
|
||||
{
|
||||
return new magic_search_<explicit_magic_search_heap>(a, 0, o);
|
||||
}
|
||||
|
||||
emptiness_check* bit_state_hashing_magic_search(const tgba *a, size_t size,
|
||||
option_map o)
|
||||
emptiness_check* bit_state_hashing_magic_search(const const_tgba_ptr& a,
|
||||
size_t size, option_map o)
|
||||
{
|
||||
return new magic_search_<bsh_magic_search_heap>(a, size, o);
|
||||
}
|
||||
|
||||
emptiness_check*
|
||||
magic_search(const tgba *a, option_map o)
|
||||
magic_search(const const_tgba_ptr& a, option_map o)
|
||||
{
|
||||
size_t size = o.get("bsh");
|
||||
if (size)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
# define SPOT_TGBAALGOS_MAGIC_HH
|
||||
|
||||
#include <cstddef>
|
||||
#include "tgba/fwd.hh"
|
||||
#include "misc/optionmap.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgba;
|
||||
class emptiness_check;
|
||||
|
||||
/// \addtogroup emptiness_check_algorithms
|
||||
|
|
@ -98,7 +98,7 @@ namespace spot
|
|||
/// \bug The name is misleading. Magic-search is the algorithm
|
||||
/// from \c godefroid.93.pstv, not \c courcoubetis.92.fmsd.
|
||||
SPOT_API emptiness_check*
|
||||
explicit_magic_search(const tgba *a,
|
||||
explicit_magic_search(const const_tgba_ptr& a,
|
||||
option_map o = option_map());
|
||||
|
||||
/// \brief Returns an emptiness checker on the spot::tgba automaton \a a.
|
||||
|
|
@ -129,7 +129,7 @@ namespace spot
|
|||
/// \sa spot::explicit_magic_search
|
||||
///
|
||||
SPOT_API emptiness_check*
|
||||
bit_state_hashing_magic_search(const tgba *a, size_t size,
|
||||
bit_state_hashing_magic_search(const const_tgba_ptr& a, size_t size,
|
||||
option_map o = option_map());
|
||||
|
||||
/// \brief Wrapper for the two magic_search implementations.
|
||||
|
|
@ -139,7 +139,7 @@ namespace spot
|
|||
/// in the \c option_map. If \c "bsh" is set and non null, its value
|
||||
/// is used as the size of the hash map.
|
||||
SPOT_API emptiness_check*
|
||||
magic_search(const tgba *a, option_map o = option_map());
|
||||
magic_search(const const_tgba_ptr& a, option_map o = option_map());
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ namespace spot
|
|||
namespace
|
||||
{
|
||||
static std::ostream&
|
||||
dump_hash_set(const hash_set* hs, const tgba* aut, std::ostream& out)
|
||||
dump_hash_set(const hash_set* hs,
|
||||
const const_tgba_ptr& aut,
|
||||
std::ostream& out)
|
||||
{
|
||||
out << '{';
|
||||
const char* sep = "";
|
||||
|
|
@ -74,7 +76,7 @@ namespace spot
|
|||
}
|
||||
|
||||
static std::string
|
||||
format_hash_set(const hash_set* hs, const tgba* aut)
|
||||
format_hash_set(const hash_set* hs, const_tgba_ptr aut)
|
||||
{
|
||||
std::ostringstream s;
|
||||
dump_hash_set(hs, aut, s);
|
||||
|
|
@ -83,7 +85,7 @@ namespace spot
|
|||
}
|
||||
|
||||
// Find all states of an automaton.
|
||||
void build_state_set(const tgba* a, hash_set* seen)
|
||||
void build_state_set(const const_tgba_ptr& a, hash_set* seen)
|
||||
{
|
||||
std::queue<const state*> tovisit;
|
||||
// Perform breadth-first traversal.
|
||||
|
|
@ -113,12 +115,12 @@ namespace spot
|
|||
|
||||
// From the base automaton and the list of sets, build the minimal
|
||||
// resulting automaton
|
||||
tgba_digraph* build_result(const tgba* a,
|
||||
std::list<hash_set*>& sets,
|
||||
hash_set* final)
|
||||
tgba_digraph_ptr build_result(const const_tgba_ptr& a,
|
||||
std::list<hash_set*>& sets,
|
||||
hash_set* final)
|
||||
{
|
||||
auto dict = a->get_dict();
|
||||
auto res = new tgba_digraph(dict);
|
||||
auto res = make_tgba_digraph(dict);
|
||||
res->copy_ap_of(a);
|
||||
res->set_bprop(tgba_digraph::StateBasedAcc);
|
||||
|
||||
|
|
@ -181,7 +183,7 @@ namespace spot
|
|||
|
||||
struct wdba_search_acc_loop : public bfs_steps
|
||||
{
|
||||
wdba_search_acc_loop(const tgba* det_a,
|
||||
wdba_search_acc_loop(const const_tgba_ptr& det_a,
|
||||
unsigned scc_n, scc_map& sm,
|
||||
power_map& pm, const state* dest)
|
||||
: bfs_steps(det_a), scc_n(scc_n), sm(sm), pm(pm), dest(dest)
|
||||
|
|
@ -213,8 +215,9 @@ namespace spot
|
|||
|
||||
|
||||
bool
|
||||
wdba_scc_is_accepting(const tgba_digraph* det_a, unsigned scc_n,
|
||||
const tgba* orig_a, scc_map& sm, power_map& pm)
|
||||
wdba_scc_is_accepting(const const_tgba_digraph_ptr& det_a, unsigned scc_n,
|
||||
const const_tgba_ptr& orig_a, scc_map& sm,
|
||||
power_map& pm)
|
||||
{
|
||||
|
||||
// Get some state from the SCC #n.
|
||||
|
|
@ -228,23 +231,23 @@ namespace spot
|
|||
(void)reached;
|
||||
|
||||
// Build an automaton representing this loop.
|
||||
tgba_digraph loop_a(det_a->get_dict());
|
||||
auto loop_a = make_tgba_digraph(det_a->get_dict());
|
||||
tgba_run::steps::const_iterator i;
|
||||
int loop_size = loop.size();
|
||||
loop_a.new_states(loop_size);
|
||||
loop_a->new_states(loop_size);
|
||||
int n;
|
||||
for (n = 1, i = loop.begin(); n < loop_size; ++n, ++i)
|
||||
{
|
||||
loop_a.new_transition(n - 1, n, i->label);
|
||||
loop_a->new_transition(n - 1, n, i->label);
|
||||
i->s->destroy();
|
||||
}
|
||||
assert(i != loop.end());
|
||||
loop_a.new_transition(n - 1, 0, i->label);
|
||||
loop_a->new_transition(n - 1, 0, i->label);
|
||||
i->s->destroy();
|
||||
assert(++i == loop.end());
|
||||
|
||||
loop_a.set_init_state(0U);
|
||||
const state* loop_a_init = loop_a.get_init_state();
|
||||
loop_a->set_init_state(0U);
|
||||
const state* loop_a_init = loop_a->get_init_state();
|
||||
|
||||
// Check if the loop is accepting in the original automaton.
|
||||
bool accepting = false;
|
||||
|
|
@ -257,12 +260,11 @@ namespace spot
|
|||
// Contrustruct a product between
|
||||
// LOOP_A, and ORIG_A starting in *IT.
|
||||
// FIXME: This could be sped up a lot!
|
||||
tgba* p = new tgba_product_init(&loop_a, orig_a, loop_a_init, it);
|
||||
emptiness_check* ec = couvreur99(p);
|
||||
emptiness_check* ec = couvreur99(product_at(loop_a, orig_a,
|
||||
loop_a_init, it));
|
||||
emptiness_check_result* res = ec->check();
|
||||
delete res;
|
||||
delete ec;
|
||||
delete p;
|
||||
|
||||
if (res)
|
||||
{
|
||||
|
|
@ -277,8 +279,8 @@ namespace spot
|
|||
|
||||
}
|
||||
|
||||
tgba_digraph* minimize_dfa(const tgba_digraph* det_a,
|
||||
hash_set* final, hash_set* non_final)
|
||||
tgba_digraph_ptr minimize_dfa(const const_tgba_digraph_ptr& det_a,
|
||||
hash_set* final, hash_set* non_final)
|
||||
{
|
||||
typedef std::list<hash_set*> partition_t;
|
||||
partition_t cur_run;
|
||||
|
|
@ -465,7 +467,7 @@ namespace spot
|
|||
#endif
|
||||
|
||||
// Build the result.
|
||||
auto* res = build_result(det_a, done, final_copy);
|
||||
auto res = build_result(det_a, done, final_copy);
|
||||
|
||||
// Free all the allocated memory.
|
||||
delete final_copy;
|
||||
|
|
@ -478,17 +480,16 @@ namespace spot
|
|||
std::list<hash_set*>::iterator it;
|
||||
for (it = done.begin(); it != done.end(); ++it)
|
||||
delete *it;
|
||||
delete det_a;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
tgba_digraph* minimize_monitor(const tgba* a)
|
||||
tgba_digraph_ptr minimize_monitor(const const_tgba_ptr& a)
|
||||
{
|
||||
hash_set* final = new hash_set;
|
||||
hash_set* non_final = new hash_set;
|
||||
tgba_digraph* det_a;
|
||||
tgba_digraph_ptr det_a;
|
||||
|
||||
{
|
||||
power_map pm;
|
||||
|
|
@ -502,12 +503,12 @@ namespace spot
|
|||
return minimize_dfa(det_a, final, non_final);
|
||||
}
|
||||
|
||||
tgba_digraph* minimize_wdba(const tgba* a)
|
||||
tgba_digraph_ptr minimize_wdba(const const_tgba_ptr& a)
|
||||
{
|
||||
hash_set* final = new hash_set;
|
||||
hash_set* non_final = new hash_set;
|
||||
|
||||
tgba_digraph* det_a;
|
||||
tgba_digraph_ptr det_a;
|
||||
|
||||
{
|
||||
power_map pm;
|
||||
|
|
@ -601,9 +602,10 @@ namespace spot
|
|||
return minimize_dfa(det_a, final, non_final);
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
minimize_obligation(const tgba_digraph* aut_f,
|
||||
const ltl::formula* f, const tgba_digraph* aut_neg_f,
|
||||
tgba_digraph_ptr
|
||||
minimize_obligation(const const_tgba_digraph_ptr& aut_f,
|
||||
const ltl::formula* f,
|
||||
const_tgba_digraph_ptr aut_neg_f,
|
||||
bool reject_bigger)
|
||||
{
|
||||
auto min_aut_f = minimize_wdba(aut_f);
|
||||
|
|
@ -613,10 +615,7 @@ namespace spot
|
|||
// Abort if min_aut_f has more states than aut_f.
|
||||
unsigned orig_states = aut_f->num_states();
|
||||
if (orig_states < min_aut_f->num_states())
|
||||
{
|
||||
delete min_aut_f;
|
||||
return const_cast<tgba_digraph*>(aut_f);
|
||||
}
|
||||
return std::const_pointer_cast<tgba_digraph>(aut_f);
|
||||
}
|
||||
|
||||
// if f is a syntactic obligation formula, the WDBA minimization
|
||||
|
|
@ -629,8 +628,6 @@ namespace spot
|
|||
if (is_guarantee_automaton(aut_f))
|
||||
return min_aut_f;
|
||||
|
||||
const tgba* to_free = 0;
|
||||
|
||||
// Build negation automaton if not supplied.
|
||||
if (!aut_neg_f)
|
||||
{
|
||||
|
|
@ -642,22 +639,18 @@ namespace spot
|
|||
ltl::unop::instance(ltl::unop::Not, f->clone());
|
||||
aut_neg_f = ltl_to_tgba_fm(neg_f, aut_f->get_dict());
|
||||
neg_f->destroy();
|
||||
|
||||
// Remove useless SCCs.
|
||||
auto tmp = scc_filter(aut_neg_f, true);
|
||||
delete aut_neg_f;
|
||||
to_free = aut_neg_f = tmp;
|
||||
aut_neg_f = scc_filter(aut_neg_f, true);
|
||||
}
|
||||
else if (is_deterministic(aut_f))
|
||||
{
|
||||
// If the automaton is deterministic, complementing is
|
||||
// easy.
|
||||
to_free = aut_neg_f = dtgba_complement(aut_f);
|
||||
aut_neg_f = dtgba_complement(aut_f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, we cannot check if the minimization is safe.
|
||||
delete min_aut_f;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -666,50 +659,33 @@ namespace spot
|
|||
// minimization is correct.
|
||||
if (is_guarantee_automaton(aut_neg_f))
|
||||
{
|
||||
delete to_free;
|
||||
return min_aut_f;
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
|
||||
tgba* p = new tgba_product(min_aut_f, aut_neg_f);
|
||||
emptiness_check* ec = couvreur99(p);
|
||||
emptiness_check* ec = couvreur99(product(min_aut_f, aut_neg_f));
|
||||
emptiness_check_result* res = ec->check();
|
||||
if (!res)
|
||||
{
|
||||
delete ec;
|
||||
delete p;
|
||||
|
||||
// Complement the minimized WDBA.
|
||||
tgba* neg_min_aut_f = wdba_complement(min_aut_f);
|
||||
|
||||
tgba* p = new tgba_product(aut_f, neg_min_aut_f);
|
||||
emptiness_check* ec = couvreur99(p);
|
||||
auto neg_min_aut_f = wdba_complement(min_aut_f);
|
||||
ec = couvreur99(product(aut_f, neg_min_aut_f));
|
||||
res = ec->check();
|
||||
|
||||
if (!res)
|
||||
{
|
||||
// Finally, we are now sure that it was safe
|
||||
// to minimize the automaton.
|
||||
ok = true;
|
||||
}
|
||||
|
||||
delete res;
|
||||
delete ec;
|
||||
delete p;
|
||||
delete neg_min_aut_f;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete res;
|
||||
delete ec;
|
||||
delete p;
|
||||
}
|
||||
delete to_free;
|
||||
delete res;
|
||||
delete ec;
|
||||
|
||||
if (ok)
|
||||
return min_aut_f;
|
||||
delete min_aut_f;
|
||||
return const_cast<tgba_digraph*>(aut_f);
|
||||
return std::const_pointer_cast<tgba_digraph>(aut_f);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace spot
|
|||
/// \param a the automaton to convert into a minimal deterministic monitor
|
||||
/// \pre Dead SCCs should have been removed from \a a before
|
||||
/// calling this function.
|
||||
SPOT_API tgba_digraph* minimize_monitor(const tgba* a);
|
||||
SPOT_API tgba_digraph_ptr minimize_monitor(const const_tgba_ptr& a);
|
||||
|
||||
/// \brief Minimize a Büchi automaton in the WDBA class.
|
||||
///
|
||||
|
|
@ -93,7 +93,7 @@ namespace spot
|
|||
month = oct
|
||||
}
|
||||
\endverbatim */
|
||||
SPOT_API tgba_digraph* minimize_wdba(const tgba* a);
|
||||
SPOT_API tgba_digraph_ptr minimize_wdba(const const_tgba_ptr& a);
|
||||
|
||||
/// \brief Minimize an automaton if it represents an obligation property.
|
||||
///
|
||||
|
|
@ -150,10 +150,11 @@ namespace spot
|
|||
/// determinization step during minimize_wdba().) Note that
|
||||
/// checking the size of the minimized WDBA occurs before ensuring
|
||||
/// that the minimized WDBA is correct.
|
||||
SPOT_API tgba_digraph* minimize_obligation(const tgba_digraph* aut_f,
|
||||
const ltl::formula* f = 0,
|
||||
const tgba_digraph* aut_neg_f = 0,
|
||||
bool reject_bigger = false);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
minimize_obligation(const const_tgba_digraph_ptr& aut_f,
|
||||
const ltl::formula* f = 0,
|
||||
const_tgba_digraph_ptr aut_neg_f = nullptr,
|
||||
bool reject_bigger = false);
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,7 +230,8 @@ namespace spot
|
|||
typedef std::unordered_set<const state*,
|
||||
state_ptr_hash, state_ptr_equal> state_set;
|
||||
|
||||
void clean(const tgba* a, stack_type& st1, state_set& seen, state_set& dead)
|
||||
void clean(const const_tgba_ptr& a, stack_type& st1,
|
||||
state_set& seen, state_set& dead)
|
||||
{
|
||||
while (!st1.empty())
|
||||
{
|
||||
|
|
@ -372,7 +373,7 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
test_path(ars_statistics* ars,
|
||||
const tgba* a, const state* t,
|
||||
const const_tgba_ptr& a, const state* t,
|
||||
const state_set& d, const heap& h)
|
||||
: bfs_steps(a), ars(ars), target(t), dead(d), h(h)
|
||||
{
|
||||
|
|
@ -467,7 +468,8 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
min_path(ars_statistics* ars,
|
||||
const tgba* a, const m_source_trans& target, const heap& h)
|
||||
const const_tgba_ptr& a,
|
||||
const m_source_trans& target, const heap& h)
|
||||
: bfs_steps(a), ars(ars), target(target), h(h)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ namespace spot
|
|||
class never_claim_bfs : public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
public:
|
||||
never_claim_bfs(const tgba* a, std::ostream& os,
|
||||
never_claim_bfs(const const_tgba_ptr& a, std::ostream& os,
|
||||
const ltl::formula* f, bool comments)
|
||||
: tgba_reachable_iterator_breadth_first(a),
|
||||
os_(os), f_(f), accept_all_(-1), fi_needed_(false),
|
||||
comments_(comments), all_acc_conds_(a->all_acceptance_conditions()),
|
||||
sba_(dynamic_cast<const tgba_digraph*>(a))
|
||||
sba_(std::dynamic_pointer_cast<const tgba_digraph>(a))
|
||||
{
|
||||
assert(!sba_ || sba_->get_bprop(tgba_digraph::StateBasedAcc));
|
||||
}
|
||||
|
|
@ -194,12 +194,12 @@ namespace spot
|
|||
state* init_;
|
||||
bool comments_;
|
||||
bdd all_acc_conds_;
|
||||
const tgba_digraph* sba_;
|
||||
const_tgba_digraph_ptr sba_;
|
||||
};
|
||||
} // anonymous
|
||||
|
||||
std::ostream&
|
||||
never_claim_reachable(std::ostream& os, const tgba* g,
|
||||
never_claim_reachable(std::ostream& os, const const_tgba_ptr& g,
|
||||
const ltl::formula* f, bool comments)
|
||||
{
|
||||
assert(g->number_of_acceptance_conditions() <= 1);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <iosfwd>
|
||||
#include "ltlast/formula.hh"
|
||||
#include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -45,7 +46,7 @@ namespace spot
|
|||
/// with the label of the \a g automaton.
|
||||
SPOT_API std::ostream&
|
||||
never_claim_reachable(std::ostream& os,
|
||||
const tgba* g,
|
||||
const const_tgba_ptr& g,
|
||||
const ltl::formula* f = 0,
|
||||
bool comments = false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
const tgba_digraph* postprocessor::do_simul(const tgba_digraph* a, int opt)
|
||||
tgba_digraph_ptr
|
||||
postprocessor::do_simul(const tgba_digraph_ptr& a, int opt)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
|
|
@ -94,8 +95,8 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
const tgba_digraph* postprocessor::do_ba_simul(const tgba_digraph* a,
|
||||
int opt)
|
||||
tgba_digraph_ptr
|
||||
postprocessor::do_ba_simul(const tgba_digraph_ptr& a, int opt)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
|
|
@ -112,27 +113,22 @@ namespace spot
|
|||
}
|
||||
|
||||
|
||||
const tgba_digraph* postprocessor::do_degen(const tgba_digraph* a)
|
||||
tgba_digraph_ptr
|
||||
postprocessor::do_degen(const tgba_digraph_ptr& a)
|
||||
{
|
||||
auto d = degeneralize(a,
|
||||
degen_reset_, degen_order_,
|
||||
degen_cache_, degen_lskip_);
|
||||
delete a;
|
||||
if (ba_simul_ <= 0)
|
||||
return d;
|
||||
|
||||
auto s = do_ba_simul(d, ba_simul_);
|
||||
if (s != d)
|
||||
delete d;
|
||||
|
||||
return s;
|
||||
return do_ba_simul(d, ba_simul_);
|
||||
}
|
||||
|
||||
#define PREF_ (pref_ & (Small | Deterministic))
|
||||
#define COMP_ (pref_ & Complete)
|
||||
|
||||
const tgba_digraph*
|
||||
postprocessor::run(const tgba_digraph* a, const ltl::formula* f)
|
||||
tgba_digraph_ptr
|
||||
postprocessor::run(tgba_digraph_ptr a, const ltl::formula* f)
|
||||
{
|
||||
if (type_ == TGBA && PREF_ == Any && level_ == Low)
|
||||
return a;
|
||||
|
|
@ -150,64 +146,35 @@ namespace spot
|
|||
|
||||
// Remove useless SCCs.
|
||||
if (type_ == Monitor)
|
||||
{
|
||||
// Do not bother about acceptance conditions, they will be
|
||||
// ignored.
|
||||
auto s = scc_filter_states(a);
|
||||
delete a;
|
||||
a = s;
|
||||
}
|
||||
// Do not bother about acceptance conditions, they will be
|
||||
// ignored.
|
||||
a = scc_filter_states(a);
|
||||
else if (scc_filter_ > 0)
|
||||
{
|
||||
auto s = scc_filter(a, scc_filter_ > 1);
|
||||
delete a;
|
||||
a = s;
|
||||
}
|
||||
a = scc_filter(a, scc_filter_ > 1);
|
||||
|
||||
if (type_ == Monitor)
|
||||
{
|
||||
if (PREF_ == Deterministic)
|
||||
{
|
||||
auto m = minimize_monitor(a);
|
||||
delete a;
|
||||
return m;
|
||||
}
|
||||
a = minimize_monitor(a);
|
||||
else
|
||||
{
|
||||
strip_acceptance_here(const_cast<tgba_digraph*>(a));
|
||||
}
|
||||
strip_acceptance_here(a);
|
||||
|
||||
if (PREF_ == Any)
|
||||
return a;
|
||||
|
||||
auto sim = do_simul(a, simul_);
|
||||
if (a == sim)
|
||||
// simulation was disabled.
|
||||
return a;
|
||||
if (level_ != High)
|
||||
{
|
||||
delete a;
|
||||
return sim;
|
||||
}
|
||||
a = do_simul(a, simul_);
|
||||
|
||||
// For Small,High we return the smallest between the output of
|
||||
// the simulation, and that of the deterministic minimization.
|
||||
auto m = minimize_monitor(a);
|
||||
delete a;
|
||||
if (m->num_states() > sim->num_states())
|
||||
if (PREF_ == Small && level_ == High && simul_)
|
||||
{
|
||||
delete m;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete sim;
|
||||
sim = m;
|
||||
auto m = minimize_monitor(a);
|
||||
if (m->num_states() < a->num_states())
|
||||
a = m;
|
||||
}
|
||||
if (COMP_ == Complete)
|
||||
{
|
||||
auto s = tgba_complete(sim);
|
||||
delete sim;
|
||||
sim = s;
|
||||
}
|
||||
return sim;
|
||||
a = tgba_complete(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
if (PREF_ == Any)
|
||||
|
|
@ -219,8 +186,8 @@ namespace spot
|
|||
|
||||
bool dba_is_wdba = false;
|
||||
bool dba_is_minimal = false;
|
||||
const tgba_digraph* dba = 0;
|
||||
const tgba_digraph* sim = 0;
|
||||
tgba_digraph_ptr dba = 0;
|
||||
tgba_digraph_ptr sim = 0;
|
||||
|
||||
// (Small,Low) is the only configuration where we do not run
|
||||
// WDBA-minimization.
|
||||
|
|
@ -228,8 +195,8 @@ namespace spot
|
|||
{
|
||||
bool reject_bigger = (PREF_ == Small) && (level_ == Medium);
|
||||
dba = minimize_obligation(a, f, 0, reject_bigger);
|
||||
if (dba == a || dba == 0) // Minimization failed.
|
||||
dba = 0;
|
||||
if (dba == a || !dba) // Minimization failed.
|
||||
dba = nullptr;
|
||||
else
|
||||
dba_is_minimal = dba_is_wdba = true;
|
||||
// The WDBA is a BA, so no degeneralization is required.
|
||||
|
|
@ -240,18 +207,11 @@ namespace spot
|
|||
if (!dba || (level_ == High && PREF_ == Small))
|
||||
{
|
||||
sim = do_simul(a, simul_);
|
||||
if (sim != a)
|
||||
delete a;
|
||||
|
||||
// Degeneralize the result of the simulation if needed.
|
||||
// No need to do that if tba_determinisation_ will be used.
|
||||
if (type_ == BA && !tba_determinisation_)
|
||||
sim = do_degen(sim);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete a;
|
||||
}
|
||||
|
||||
// If WDBA failed, but the simulation returned a deterministic
|
||||
// automaton, use it as dba.
|
||||
|
|
@ -272,7 +232,7 @@ namespace spot
|
|||
// If we don't have a DBA, attempt tba-determinization if requested.
|
||||
if (tba_determinisation_ && !dba)
|
||||
{
|
||||
const tgba_digraph* tmpd = 0;
|
||||
tgba_digraph_ptr tmpd = nullptr;
|
||||
if (PREF_ == Deterministic
|
||||
&& f
|
||||
&& f->is_syntactic_recurrence()
|
||||
|
|
@ -297,20 +257,17 @@ namespace spot
|
|||
(PREF_ == Small) ? 2 : 8,
|
||||
1 << ((PREF_ == Small) ? 13 : 15),
|
||||
f);
|
||||
if (tmp != 0 && tmp != in)
|
||||
if (tmp && tmp != in)
|
||||
{
|
||||
// There is no point in running the reverse simulation on
|
||||
// a deterministic automaton, since all prefixes are
|
||||
// unique.
|
||||
dba = simulation(tmp);
|
||||
delete tmp;
|
||||
}
|
||||
delete tmpd;
|
||||
if (dba && PREF_ == Deterministic)
|
||||
{
|
||||
// disregard the result of the simulation.
|
||||
delete sim;
|
||||
sim = 0;
|
||||
sim = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -340,17 +297,16 @@ namespace spot
|
|||
// sure it is at least 1.
|
||||
target_acc = original_acc > 0 ? original_acc : 1;
|
||||
|
||||
const tgba_digraph* in = 0;
|
||||
const tgba_digraph* to_free = 0;
|
||||
const_tgba_digraph_ptr in = 0;
|
||||
if (target_acc == 1)
|
||||
{
|
||||
// If we are seeking a minimal DBA with unknown number of
|
||||
// states, then we should start from the degeneralized,
|
||||
// because the input TBA might be smaller.
|
||||
if (state_based_)
|
||||
to_free = in = degeneralize(dba);
|
||||
in = degeneralize(dba);
|
||||
else if (dba->number_of_acceptance_conditions() != 1)
|
||||
to_free = in = degeneralize_tba(dba);
|
||||
in = degeneralize_tba(dba);
|
||||
else
|
||||
in = dba;
|
||||
}
|
||||
|
|
@ -359,32 +315,29 @@ namespace spot
|
|||
in = dba;
|
||||
}
|
||||
|
||||
const tgba_digraph* cmp = tgba_complete(in);
|
||||
const tgba_digraph* res = 0;
|
||||
const_tgba_digraph_ptr res = tgba_complete(in);
|
||||
if (target_acc == 1)
|
||||
{
|
||||
if (sat_states_ != -1)
|
||||
res = dtba_sat_synthetize(cmp, sat_states_, state_based_);
|
||||
res = dtba_sat_synthetize(res, sat_states_, state_based_);
|
||||
else if (sat_minimize_ == 1 || sat_minimize_ == -1)
|
||||
res = dtba_sat_minimize(cmp, state_based_);
|
||||
res = dtba_sat_minimize(res, state_based_);
|
||||
else // sat_minimize_ == 2
|
||||
res = dtba_sat_minimize_dichotomy(cmp, state_based_);
|
||||
res = dtba_sat_minimize_dichotomy(res, state_based_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sat_states_ != -1)
|
||||
res = dtgba_sat_synthetize(cmp, target_acc, sat_states_,
|
||||
res = dtgba_sat_synthetize(res, target_acc, sat_states_,
|
||||
state_based_);
|
||||
else if (sat_minimize_ == 1 || sat_minimize_ == -1)
|
||||
res = dtgba_sat_minimize(cmp, target_acc, state_based_);
|
||||
res = dtgba_sat_minimize(res, target_acc, state_based_);
|
||||
else // sat_minimize_ == 2
|
||||
res = dtgba_sat_minimize_dichotomy(cmp, target_acc, state_based_);
|
||||
res = dtgba_sat_minimize_dichotomy(res, target_acc, state_based_);
|
||||
}
|
||||
delete cmp;
|
||||
delete to_free;
|
||||
if (res != 0)
|
||||
|
||||
if (res)
|
||||
{
|
||||
delete dba;
|
||||
if (state_based_)
|
||||
// FIXME: This does not simplify generalized acceptance
|
||||
// conditions, but calling scc_filter() would break the
|
||||
|
|
@ -393,7 +346,6 @@ namespace spot
|
|||
dba = scc_filter_states(res);
|
||||
else
|
||||
dba = scc_filter(res, true);
|
||||
delete res;
|
||||
dba_is_minimal = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -403,24 +355,14 @@ namespace spot
|
|||
if (dba && !dba_is_wdba && type_ == BA
|
||||
&& !(dba_is_minimal && state_based_
|
||||
&& dba->number_of_acceptance_conditions() == 1))
|
||||
{
|
||||
auto d = degeneralize(dba);
|
||||
delete dba;
|
||||
dba = d;
|
||||
}
|
||||
dba = degeneralize(dba);
|
||||
|
||||
if (dba && sim)
|
||||
{
|
||||
if (dba->num_states() > sim->num_states())
|
||||
{
|
||||
delete dba;
|
||||
dba = 0;
|
||||
}
|
||||
dba = nullptr;
|
||||
else
|
||||
{
|
||||
delete sim;
|
||||
sim = 0;
|
||||
}
|
||||
sim = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -428,28 +370,21 @@ namespace spot
|
|||
{
|
||||
if (dba && !dba_is_minimal) // WDBA is already clean.
|
||||
{
|
||||
auto s = scc_filter(dba, true);
|
||||
delete dba;
|
||||
dba = scc_filter(dba, true);
|
||||
assert(!sim);
|
||||
dba = s;
|
||||
}
|
||||
else if (sim)
|
||||
{
|
||||
auto s = scc_filter(sim, true);
|
||||
delete sim;
|
||||
sim = scc_filter(sim, true);
|
||||
assert(!dba);
|
||||
sim = s;
|
||||
}
|
||||
}
|
||||
|
||||
sim = dba ? dba : sim;
|
||||
|
||||
if (COMP_ == Complete)
|
||||
{
|
||||
auto s = tgba_complete(sim);
|
||||
delete sim;
|
||||
sim = s;
|
||||
}
|
||||
sim = tgba_complete(sim);
|
||||
|
||||
return sim;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,14 +96,17 @@ namespace spot
|
|||
level_ = level;
|
||||
}
|
||||
|
||||
/// Return the optimized automaton and delete \a input_disown.
|
||||
const tgba_digraph* run(const tgba_digraph* input_disown,
|
||||
const ltl::formula* f);
|
||||
/// \brief Optimize an automaton.
|
||||
///
|
||||
/// The returned automaton might be a new automaton,
|
||||
/// or an in-place modification of the \a input automaton.
|
||||
tgba_digraph_ptr run(tgba_digraph_ptr input,
|
||||
const ltl::formula* f);
|
||||
|
||||
protected:
|
||||
const tgba_digraph* do_simul(const tgba_digraph* input, int opt);
|
||||
const tgba_digraph* do_ba_simul(const tgba_digraph* input, int opt);
|
||||
const tgba_digraph* do_degen(const tgba_digraph* input);
|
||||
tgba_digraph_ptr do_simul(const tgba_digraph_ptr& input, int opt);
|
||||
tgba_digraph_ptr do_ba_simul(const tgba_digraph_ptr& input, int opt);
|
||||
tgba_digraph_ptr do_degen(const tgba_digraph_ptr& input);
|
||||
|
||||
output_type type_;
|
||||
int pref_;
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@
|
|||
|
||||
namespace spot
|
||||
{
|
||||
tgba_digraph*
|
||||
tgba_powerset(const tgba* aut, power_map& pm, bool merge)
|
||||
tgba_digraph_ptr
|
||||
tgba_powerset(const const_tgba_ptr& aut, power_map& pm, bool merge)
|
||||
{
|
||||
typedef power_map::power_state power_state;
|
||||
typedef std::map<power_map::power_state, int> power_set;
|
||||
|
|
@ -51,7 +51,7 @@ namespace spot
|
|||
|
||||
power_set seen;
|
||||
todo_list todo;
|
||||
auto res = new tgba_digraph(aut->get_dict());
|
||||
auto res = make_tgba_digraph(aut->get_dict());
|
||||
res->copy_ap_of(aut);
|
||||
|
||||
{
|
||||
|
|
@ -111,8 +111,8 @@ namespace spot
|
|||
return res;
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
tgba_powerset(const tgba* aut)
|
||||
tgba_digraph_ptr
|
||||
tgba_powerset(const const_tgba_ptr& aut)
|
||||
{
|
||||
power_map pm;
|
||||
return tgba_powerset(aut, pm);
|
||||
|
|
@ -130,7 +130,7 @@ namespace spot
|
|||
typedef std::set<trans*> trans_set;
|
||||
typedef std::vector<trans_set> set_set;
|
||||
protected:
|
||||
const tgba* ref_;
|
||||
const_tgba_ptr ref_;
|
||||
power_map& refmap_;
|
||||
trans_set reject_; // set of rejecting transitions
|
||||
set_set accept_; // set of cycles that are accepting
|
||||
|
|
@ -139,8 +139,8 @@ namespace spot
|
|||
unsigned cycles_left_; // count of cycles left to explore
|
||||
|
||||
public:
|
||||
fix_scc_acceptance(const scc_map& sm, const tgba* ref, power_map& refmap,
|
||||
unsigned threshold)
|
||||
fix_scc_acceptance(const scc_map& sm, const_tgba_ptr ref,
|
||||
power_map& refmap, unsigned threshold)
|
||||
: enumerate_cycles(sm), ref_(ref), refmap_(refmap),
|
||||
threshold_(threshold)
|
||||
{
|
||||
|
|
@ -173,25 +173,26 @@ namespace spot
|
|||
|
||||
bool is_cycle_accepting(cycle_iter begin, trans_set& ts) const
|
||||
{
|
||||
auto a = down_cast<tgba_digraph*>(const_cast<tgba*>(aut_));
|
||||
auto a = std::static_pointer_cast<tgba_digraph>
|
||||
(std::const_pointer_cast<tgba>(aut_));
|
||||
|
||||
// Build an automaton representing this loop.
|
||||
tgba_digraph loop_a(aut_->get_dict());
|
||||
auto loop_a = make_tgba_digraph(aut_->get_dict());
|
||||
int loop_size = std::distance(begin, dfs_.end());
|
||||
loop_a.new_states(loop_size);
|
||||
loop_a->new_states(loop_size);
|
||||
int n;
|
||||
cycle_iter i;
|
||||
for (n = 1, i = begin; n <= loop_size; ++n, ++i)
|
||||
{
|
||||
trans* t = &a->trans_data(i->succ);
|
||||
loop_a.new_transition(n - 1, n % loop_size, t->cond);
|
||||
loop_a->new_transition(n - 1, n % loop_size, t->cond);
|
||||
if (reject_.find(t) == reject_.end())
|
||||
ts.insert(t);
|
||||
}
|
||||
assert(i == dfs_.end());
|
||||
|
||||
const state* loop_a_init = loop_a.get_init_state();
|
||||
assert(loop_a.state_number(loop_a_init) == 0);
|
||||
const state* loop_a_init = loop_a->get_init_state();
|
||||
assert(loop_a->state_number(loop_a_init) == 0);
|
||||
|
||||
// Check if the loop is accepting in the original automaton.
|
||||
bool accepting = false;
|
||||
|
|
@ -202,17 +203,12 @@ namespace spot
|
|||
refmap_.states_of(a->state_number(begin->ts->first));
|
||||
for (auto s: ps)
|
||||
{
|
||||
// Construct a product between
|
||||
// LOOP_A, and ORIG_A starting in S.
|
||||
tgba* p = new tgba_product_init(&loop_a, ref_, loop_a_init, s);
|
||||
|
||||
//spot::dotty_reachable(std::cout, p);
|
||||
couvreur99_check* ec = down_cast<couvreur99_check*>(couvreur99(p));
|
||||
assert(ec);
|
||||
// Check the product between LOOP_A, and ORIG_A starting
|
||||
// in S.
|
||||
auto ec = couvreur99(product_at(loop_a, ref_, loop_a_init, s));
|
||||
emptiness_check_result* res = ec->check();
|
||||
delete res;
|
||||
delete ec;
|
||||
delete p;
|
||||
if (res)
|
||||
{
|
||||
accepting = true;
|
||||
|
|
@ -275,8 +271,8 @@ namespace spot
|
|||
};
|
||||
|
||||
static bool
|
||||
fix_dba_acceptance(tgba_digraph* det,
|
||||
const tgba* ref, power_map& refmap,
|
||||
fix_dba_acceptance(tgba_digraph_ptr det,
|
||||
const_tgba_ptr ref, power_map& refmap,
|
||||
unsigned threshold)
|
||||
{
|
||||
det->copy_acceptance_conditions_of(ref);
|
||||
|
|
@ -296,8 +292,8 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
tba_determinize(const tgba* aut,
|
||||
tgba_digraph_ptr
|
||||
tba_determinize(const const_tgba_ptr& aut,
|
||||
unsigned threshold_states, unsigned threshold_cycles)
|
||||
{
|
||||
power_map pm;
|
||||
|
|
@ -308,27 +304,20 @@ namespace spot
|
|||
|
||||
if ((threshold_states > 0)
|
||||
&& (pm.map_.size() > pm.states_.size() * threshold_states))
|
||||
{
|
||||
delete det;
|
||||
return 0;
|
||||
}
|
||||
return nullptr;
|
||||
if (fix_dba_acceptance(det, aut, pm, threshold_cycles))
|
||||
{
|
||||
delete det;
|
||||
return 0;
|
||||
}
|
||||
return nullptr;
|
||||
det->merge_transitions();
|
||||
return det;
|
||||
}
|
||||
|
||||
tgba*
|
||||
tba_determinize_check(const tgba* aut,
|
||||
tgba_digraph_ptr
|
||||
tba_determinize_check(const tgba_digraph_ptr& aut,
|
||||
unsigned threshold_states,
|
||||
unsigned threshold_cycles,
|
||||
const ltl::formula* f,
|
||||
const tgba_digraph* neg_aut)
|
||||
const_tgba_digraph_ptr neg_aut)
|
||||
{
|
||||
const tgba* built = 0;
|
||||
if (f == 0 && neg_aut == 0)
|
||||
return 0;
|
||||
if (aut->number_of_acceptance_conditions() > 1)
|
||||
|
|
@ -347,26 +336,19 @@ namespace spot
|
|||
neg_f->destroy();
|
||||
|
||||
// Remove useless SCCs.
|
||||
auto tmp = scc_filter(neg_aut, true);
|
||||
delete neg_aut;
|
||||
built = neg_aut = tmp;
|
||||
neg_aut = scc_filter(neg_aut, true);
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
|
||||
tgba* p = new tgba_product(det, neg_aut);
|
||||
emptiness_check* ec = couvreur99(p);
|
||||
emptiness_check_result* res = ec->check();
|
||||
auto ec = couvreur99(product(det, neg_aut));
|
||||
auto res = ec->check();
|
||||
if (!res)
|
||||
{
|
||||
delete ec;
|
||||
delete p;
|
||||
|
||||
// Complement the DBA.
|
||||
tgba* neg_det = dtgba_complement(det);
|
||||
|
||||
tgba* p = new tgba_product(aut, neg_det);
|
||||
emptiness_check* ec = couvreur99(p);
|
||||
ec = couvreur99(product(aut, dtgba_complement(det)));
|
||||
res = ec->check();
|
||||
|
||||
if (!res)
|
||||
|
|
@ -375,23 +357,12 @@ namespace spot
|
|||
// to determinize the automaton.
|
||||
ok = true;
|
||||
}
|
||||
|
||||
delete res;
|
||||
delete ec;
|
||||
delete p;
|
||||
delete neg_det;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete res;
|
||||
delete ec;
|
||||
delete p;
|
||||
}
|
||||
delete built;
|
||||
delete res;
|
||||
delete ec;
|
||||
|
||||
if (ok)
|
||||
return det;
|
||||
delete det;
|
||||
return const_cast<tgba*>(aut);
|
||||
return aut;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ namespace spot
|
|||
/// The \a merge argument can be set to false to prevent merging of
|
||||
/// transitions.
|
||||
//@{
|
||||
SPOT_API tgba_digraph*
|
||||
tgba_powerset(const tgba* aut, power_map& pm, bool merge = true);
|
||||
SPOT_API tgba_digraph*
|
||||
tgba_powerset(const tgba* aut);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tgba_powerset(const const_tgba_ptr& aut, power_map& pm, bool merge = true);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tgba_powerset(const const_tgba_ptr& aut);
|
||||
//@}
|
||||
|
||||
|
||||
|
|
@ -106,8 +106,8 @@ namespace spot
|
|||
/// If \a threshold_cycles is non null, abort the construction
|
||||
/// whenever an SCC of the constructed automaton has more than \a
|
||||
/// threshold_cycles cycles.
|
||||
SPOT_API tgba_digraph*
|
||||
tba_determinize(const tgba* aut,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tba_determinize(const const_tgba_ptr& aut,
|
||||
unsigned threshold_states = 0,
|
||||
unsigned threshold_cycles = 0);
|
||||
|
||||
|
|
@ -138,12 +138,12 @@ namespace spot
|
|||
/// the automaton cannot be determinized, 0 if we do not know if the
|
||||
/// determinization is correct because neither \a f nor \a neg_aut
|
||||
/// were supplied.
|
||||
SPOT_API tgba*
|
||||
tba_determinize_check(const tgba* aut,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
tba_determinize_check(const tgba_digraph_ptr& aut,
|
||||
unsigned threshold_states = 0,
|
||||
unsigned threshold_cycles = 0,
|
||||
const ltl::formula* f = 0,
|
||||
const tgba_digraph* neg_aut = 0);
|
||||
const_tgba_digraph_ptr neg_aut = 0);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2004, 2014 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -25,7 +25,9 @@ namespace spot
|
|||
{
|
||||
|
||||
tgba_run*
|
||||
project_tgba_run(const tgba* a_run, const tgba* a_proj, const tgba_run* run)
|
||||
project_tgba_run(const const_tgba_ptr& a_run,
|
||||
const const_tgba_ptr& a_proj,
|
||||
const tgba_run* run)
|
||||
{
|
||||
tgba_run* res = new tgba_run;
|
||||
for (tgba_run::steps::const_iterator i = run->prefix.begin();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
# include "misc/common.hh"
|
||||
# include <iosfwd>
|
||||
# include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
struct tgba_run;
|
||||
class tgba;
|
||||
|
||||
/// \ingroup tgba_run
|
||||
/// \brief Project a tgba_run on a tgba.
|
||||
|
|
@ -42,9 +42,9 @@ namespace spot
|
|||
/// \param a_proj the automata on which to project the run
|
||||
/// \return true iff the run could be completed
|
||||
SPOT_API tgba_run*
|
||||
project_tgba_run(const tgba* a_run, const tgba* a_proj,
|
||||
|
||||
const tgba_run* run);
|
||||
project_tgba_run(const const_tgba_ptr& a_run,
|
||||
const const_tgba_ptr& a_proj,
|
||||
const tgba_run* run);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_PROJRUN_HH
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
random_labels(tgba_digraph* aut,
|
||||
random_labels(tgba_digraph_ptr aut,
|
||||
unsigned src,
|
||||
unsigned dest,
|
||||
int* props, int props_n, float t,
|
||||
|
|
@ -80,14 +80,14 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
tgba*
|
||||
tgba_digraph_ptr
|
||||
random_graph(int n, float d,
|
||||
const ltl::atomic_prop_set* ap, bdd_dict_ptr dict,
|
||||
int n_acc, float a, float t,
|
||||
ltl::environment* env)
|
||||
{
|
||||
assert(n > 0);
|
||||
auto res = new tgba_digraph(dict);
|
||||
auto res = make_tgba_digraph(dict);
|
||||
|
||||
int props_n = ap->size();
|
||||
int* props = new int[props_n];
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ namespace spot
|
|||
/// \f$1+(n-1)d\f$ and variance \f$(n-1)d(1-d)\f$. (This is less
|
||||
/// accurate, but faster than considering all possible \a n
|
||||
/// successors one by one.)
|
||||
SPOT_API tgba*
|
||||
SPOT_API tgba_digraph_ptr
|
||||
random_graph(int n, float d,
|
||||
const ltl::atomic_prop_set* ap, bdd_dict_ptr dict,
|
||||
int n_acc = 0, float a = 0.1, float t = 0.5,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace spot
|
|||
// tgba_reachable_iterator
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
tgba_reachable_iterator::tgba_reachable_iterator(const tgba* a)
|
||||
tgba_reachable_iterator::tgba_reachable_iterator(const const_tgba_ptr& a)
|
||||
: aut_(a)
|
||||
{
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ namespace spot
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
tgba_reachable_iterator_breadth_first::
|
||||
tgba_reachable_iterator_breadth_first(const tgba* a)
|
||||
tgba_reachable_iterator_breadth_first(const const_tgba_ptr& a)
|
||||
: tgba_reachable_iterator(a)
|
||||
{
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ namespace spot
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
tgba_reachable_iterator_depth_first::
|
||||
tgba_reachable_iterator_depth_first(const tgba* a)
|
||||
tgba_reachable_iterator_depth_first(const const_tgba_ptr& a)
|
||||
: aut_(a)
|
||||
{
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ namespace spot
|
|||
|
||||
|
||||
tgba_reachable_iterator_depth_first_stack::
|
||||
tgba_reachable_iterator_depth_first_stack(const tgba* a)
|
||||
tgba_reachable_iterator_depth_first_stack(const const_tgba_ptr& a)
|
||||
: tgba_reachable_iterator_depth_first(a)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace spot
|
|||
class SPOT_API tgba_reachable_iterator
|
||||
{
|
||||
public:
|
||||
tgba_reachable_iterator(const tgba* a);
|
||||
tgba_reachable_iterator(const const_tgba_ptr& a);
|
||||
virtual ~tgba_reachable_iterator();
|
||||
|
||||
/// \brief Iterate over all reachable states of a spot::tgba.
|
||||
|
|
@ -89,7 +89,7 @@ namespace spot
|
|||
const tgba_succ_iterator* si);
|
||||
|
||||
protected:
|
||||
const tgba* aut_; ///< The spot::tgba to explore.
|
||||
const_tgba_ptr aut_; ///< The spot::tgba to explore.
|
||||
|
||||
typedef std::unordered_map<const state*, int,
|
||||
state_ptr_hash, state_ptr_equal> seen_map;
|
||||
|
|
@ -103,7 +103,7 @@ namespace spot
|
|||
public tgba_reachable_iterator
|
||||
{
|
||||
public:
|
||||
tgba_reachable_iterator_breadth_first(const tgba* a);
|
||||
tgba_reachable_iterator_breadth_first(const const_tgba_ptr& a);
|
||||
|
||||
virtual void add_state(const state* s);
|
||||
virtual const state* next_state();
|
||||
|
|
@ -117,7 +117,7 @@ namespace spot
|
|||
class SPOT_API tgba_reachable_iterator_depth_first
|
||||
{
|
||||
public:
|
||||
tgba_reachable_iterator_depth_first(const tgba* a);
|
||||
tgba_reachable_iterator_depth_first(const const_tgba_ptr& a);
|
||||
virtual ~tgba_reachable_iterator_depth_first();
|
||||
|
||||
/// \brief Iterate over all reachable states of a spot::tgba.
|
||||
|
|
@ -159,7 +159,7 @@ namespace spot
|
|||
const tgba_succ_iterator* si);
|
||||
|
||||
protected:
|
||||
const tgba* aut_; ///< The spot::tgba to explore.
|
||||
const_tgba_ptr aut_; ///< The spot::tgba to explore.
|
||||
|
||||
typedef std::unordered_map<const state*, int,
|
||||
state_ptr_hash, state_ptr_equal> seen_map;
|
||||
|
|
@ -187,7 +187,7 @@ namespace spot
|
|||
: public tgba_reachable_iterator_depth_first
|
||||
{
|
||||
public:
|
||||
tgba_reachable_iterator_depth_first_stack(const tgba* a);
|
||||
tgba_reachable_iterator_depth_first_stack(const const_tgba_ptr& a);
|
||||
/// \brief Whether state sn is on the DFS stack.
|
||||
///
|
||||
/// Note the destination state of a transition is only pushed to
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace spot
|
|||
class shortest_path: public bfs_steps
|
||||
{
|
||||
public:
|
||||
shortest_path(const tgba* a)
|
||||
shortest_path(const const_tgba_ptr& a)
|
||||
: bfs_steps(a), target(0)
|
||||
{
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ namespace spot
|
|||
}
|
||||
|
||||
tgba_run*
|
||||
reduce_run(const tgba* a, const tgba_run* org)
|
||||
reduce_run(const const_tgba_ptr& a, const tgba_run* org)
|
||||
{
|
||||
tgba_run* res = new tgba_run;
|
||||
state_set ss;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2010, 2013 Laboratoire de Recherche et Développement de
|
||||
// l'Epita.
|
||||
// Copyright (C) 2010, 2013, 2014 Laboratoire de Recherche et
|
||||
// Développement de l'Epita.
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
# define SPOT_TGBAALGOS_REDUCERUN_HH
|
||||
|
||||
# include "misc/common.hh"
|
||||
# include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgba;
|
||||
struct tgba_run;
|
||||
|
||||
/// \ingroup tgba_run
|
||||
|
|
@ -36,7 +36,7 @@ namespace spot
|
|||
/// Return a run which is accepting for \a a and that is no longer
|
||||
/// than \a org.
|
||||
SPOT_API tgba_run*
|
||||
reduce_run(const tgba* a, const tgba_run* org);
|
||||
reduce_run(const const_tgba_ptr& a, const tgba_run* org);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_REDUCERUN_HH
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace spot
|
|||
namespace
|
||||
{
|
||||
void
|
||||
print_annotation(std::ostream& os, const tgba* a,
|
||||
print_annotation(std::ostream& os, const_tgba_ptr a,
|
||||
const tgba_succ_iterator* i)
|
||||
{
|
||||
std::string s = a->transition_annotation(i);
|
||||
|
|
@ -43,8 +43,8 @@ namespace spot
|
|||
}
|
||||
|
||||
bool
|
||||
replay_tgba_run(std::ostream& os, const tgba* a, const tgba_run* run,
|
||||
bool debug)
|
||||
replay_tgba_run(std::ostream& os, const const_tgba_ptr& a,
|
||||
const tgba_run* run, bool debug)
|
||||
{
|
||||
const state* s = a->get_init_state();
|
||||
int serial = 1;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
# include "misc/common.hh"
|
||||
# include <iosfwd>
|
||||
# include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
struct tgba_run;
|
||||
class tgba;
|
||||
|
||||
/// \ingroup tgba_run
|
||||
/// \brief Replay a tgba_run on a tgba.
|
||||
|
|
@ -47,7 +47,8 @@ namespace spot
|
|||
/// debugging informations will be output on failure
|
||||
/// \return true iff the run could be completed
|
||||
SPOT_API bool
|
||||
replay_tgba_run(std::ostream& os, const tgba* a, const tgba_run* run,
|
||||
replay_tgba_run(std::ostream& os,
|
||||
const const_tgba_ptr& a, const tgba_run* run,
|
||||
bool debug = false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ namespace spot
|
|||
}
|
||||
|
||||
std::string
|
||||
tgba_run_dotty_decorator::state_decl(const tgba*, const state* s, int,
|
||||
tgba_run_dotty_decorator::state_decl(const const_tgba_ptr&,
|
||||
const state* s, int,
|
||||
tgba_succ_iterator*,
|
||||
const std::string& label,
|
||||
bool accepting)
|
||||
|
|
@ -80,7 +81,7 @@ namespace spot
|
|||
}
|
||||
|
||||
std::string
|
||||
tgba_run_dotty_decorator::link_decl(const tgba*,
|
||||
tgba_run_dotty_decorator::link_decl(const const_tgba_ptr&,
|
||||
const state* in_s, int,
|
||||
const state* out_s, int,
|
||||
const tgba_succ_iterator* si,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -41,11 +41,12 @@ namespace spot
|
|||
tgba_run_dotty_decorator(const tgba_run* run);
|
||||
virtual ~tgba_run_dotty_decorator();
|
||||
|
||||
virtual std::string state_decl(const tgba* a, const state* s, int n,
|
||||
virtual std::string state_decl(const const_tgba_ptr& a,
|
||||
const state* s, int n,
|
||||
tgba_succ_iterator* si,
|
||||
const std::string& label,
|
||||
bool accepting);
|
||||
virtual std::string link_decl(const tgba* a,
|
||||
virtual std::string link_decl(const const_tgba_ptr& a,
|
||||
const state* in_s, int in,
|
||||
const state* out_s, int out,
|
||||
const tgba_succ_iterator* si,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
namespace spot
|
||||
{
|
||||
bool
|
||||
is_guarantee_automaton(const tgba* aut, const scc_map* sm)
|
||||
is_guarantee_automaton(const const_tgba_ptr& aut, const scc_map* sm)
|
||||
{
|
||||
// Create an scc_map of the user did not give one to us.
|
||||
bool need_sm = !sm;
|
||||
|
|
@ -69,7 +69,7 @@ namespace spot
|
|||
return result;
|
||||
}
|
||||
|
||||
bool is_safety_mwdba(const tgba* aut)
|
||||
bool is_safety_mwdba(const const_tgba_ptr& aut)
|
||||
{
|
||||
state_unicity_table seen; // States already seen.
|
||||
std::deque<const state*> todo; // A queue of states yet to explore.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace spot
|
|||
/// built otherwise. If you supply an scc_map you should call
|
||||
/// build_map() before passing it to this function.
|
||||
SPOT_API bool
|
||||
is_guarantee_automaton(const tgba* aut, const scc_map* sm = 0);
|
||||
is_guarantee_automaton(const const_tgba_ptr& aut, const scc_map* sm = 0);
|
||||
|
||||
/// \brief Whether a minimized WDBA represents a safety property.
|
||||
///
|
||||
|
|
@ -57,7 +57,7 @@ namespace spot
|
|||
///
|
||||
/// \param aut the automaton to check
|
||||
SPOT_API bool
|
||||
is_safety_mwdba(const tgba* aut);
|
||||
is_safety_mwdba(const const_tgba_ptr& aut);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace spot
|
|||
class save_bfs: public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
public:
|
||||
save_bfs(const tgba* a, std::ostream& os)
|
||||
save_bfs(const const_tgba_ptr& a, std::ostream& os)
|
||||
: tgba_reachable_iterator_breadth_first(a), os_(os)
|
||||
{
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ namespace spot
|
|||
}
|
||||
|
||||
std::ostream&
|
||||
tgba_save_reachable(std::ostream& os, const tgba* g)
|
||||
tgba_save_reachable(std::ostream& os, const_tgba_ptr g)
|
||||
{
|
||||
save_bfs b(g, os);
|
||||
b.run();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace spot
|
|||
/// \ingroup tgba_io
|
||||
/// \brief Save reachable states in text format.
|
||||
SPOT_API std::ostream&
|
||||
tgba_save_reachable(std::ostream& os, const tgba* g);
|
||||
tgba_save_reachable(std::ostream& os, const_tgba_ptr g);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_SAVE_HH
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace spot
|
|||
}
|
||||
|
||||
|
||||
scc_map::scc_map(const tgba* aut)
|
||||
scc_map::scc_map(const const_tgba_ptr& aut)
|
||||
: aut_(aut)
|
||||
{
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ namespace spot
|
|||
return acc_set_of(n) == aut_->all_acceptance_conditions();
|
||||
}
|
||||
|
||||
const tgba*
|
||||
const_tgba_ptr
|
||||
scc_map::get_aut() const
|
||||
{
|
||||
return aut_;
|
||||
|
|
@ -460,7 +460,7 @@ namespace spot
|
|||
}
|
||||
|
||||
scc_stats
|
||||
build_scc_stats(const tgba* a)
|
||||
build_scc_stats(const const_tgba_ptr& a)
|
||||
{
|
||||
scc_map m(a);
|
||||
m.build_map();
|
||||
|
|
@ -549,7 +549,7 @@ namespace spot
|
|||
}
|
||||
|
||||
std::ostream&
|
||||
dump_scc_dot(const tgba* a, std::ostream& out, bool verbose)
|
||||
dump_scc_dot(const const_tgba_ptr& a, std::ostream& out, bool verbose)
|
||||
{
|
||||
scc_map m(a);
|
||||
m.build_map();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Laboratoire de
|
||||
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de
|
||||
// Recherche et Développement de l'Epita.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -77,7 +77,7 @@ namespace spot
|
|||
///
|
||||
/// This will note compute the map initially. You should call
|
||||
/// build_map() to do so.
|
||||
scc_map(const tgba* aut);
|
||||
scc_map(const const_tgba_ptr& aut);
|
||||
|
||||
~scc_map();
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ namespace spot
|
|||
void build_map();
|
||||
|
||||
/// Get the automaton for which the map has been constructed.
|
||||
const tgba* get_aut() const;
|
||||
const_tgba_ptr get_aut() const;
|
||||
|
||||
/// \brief Get the number of SCC in the automaton.
|
||||
///
|
||||
|
|
@ -216,7 +216,7 @@ namespace spot
|
|||
bdd useful_acc;
|
||||
};
|
||||
|
||||
const tgba* aut_; // Automata to decompose.
|
||||
const_tgba_ptr aut_; // Automata to decompose.
|
||||
typedef std::list<scc> stack_type;
|
||||
stack_type root_; // Stack of SCC roots.
|
||||
std::stack<bdd> arc_acc_; // A stack of acceptance conditions
|
||||
|
|
@ -248,12 +248,13 @@ namespace spot
|
|||
};
|
||||
|
||||
SPOT_API scc_stats
|
||||
build_scc_stats(const tgba* a);
|
||||
build_scc_stats(const const_tgba_ptr& a);
|
||||
SPOT_API scc_stats
|
||||
build_scc_stats(const scc_map& m);
|
||||
|
||||
SPOT_API std::ostream&
|
||||
dump_scc_dot(const tgba* a, std::ostream& out, bool verbose = false);
|
||||
dump_scc_dot(const const_tgba_ptr& a,
|
||||
std::ostream& out, bool verbose = false);
|
||||
SPOT_API std::ostream&
|
||||
dump_scc_dot(const scc_map& m, std::ostream& out, bool verbose = false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ namespace spot
|
|||
std::vector<bdd> useful_table(scc_count);
|
||||
std::vector<bdd> useless_table(scc_count);
|
||||
unsigned max_num = 1;
|
||||
const tgba_digraph* aut = this->si->get_aut();
|
||||
const_tgba_digraph_ptr aut = this->si->get_aut();
|
||||
|
||||
std::vector<bdd> used_acc = this->si->used_acc();
|
||||
|
||||
|
|
@ -431,10 +431,10 @@ namespace spot
|
|||
|
||||
|
||||
template<class F, typename... Args>
|
||||
tgba_digraph* scc_filter_apply(const tgba_digraph* aut,
|
||||
tgba_digraph_ptr scc_filter_apply(const_tgba_digraph_ptr aut,
|
||||
scc_info* given_si, Args&&... args)
|
||||
{
|
||||
tgba_digraph* filtered = new tgba_digraph(aut->get_dict());
|
||||
tgba_digraph_ptr filtered = make_tgba_digraph(aut->get_dict());
|
||||
unsigned in_n = aut->num_states(); // Number of input states.
|
||||
if (in_n == 0) // Nothing to filter.
|
||||
return filtered;
|
||||
|
|
@ -495,8 +495,8 @@ namespace spot
|
|||
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
scc_filter_states(const tgba_digraph* aut, scc_info* given_si)
|
||||
tgba_digraph_ptr
|
||||
scc_filter_states(const const_tgba_digraph_ptr& aut, scc_info* given_si)
|
||||
{
|
||||
bool sb = aut->get_bprop(tgba_digraph::StateBasedAcc);
|
||||
auto res = scc_filter_apply<state_filter<>>(aut, given_si);
|
||||
|
|
@ -505,11 +505,11 @@ namespace spot
|
|||
return res;
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
scc_filter(const tgba_digraph* aut, bool remove_all_useless,
|
||||
tgba_digraph_ptr
|
||||
scc_filter(const const_tgba_digraph_ptr& aut, bool remove_all_useless,
|
||||
scc_info* given_si)
|
||||
{
|
||||
tgba_digraph* res;
|
||||
tgba_digraph_ptr res;
|
||||
if (remove_all_useless)
|
||||
res = scc_filter_apply<state_filter
|
||||
<acc_filter_all
|
||||
|
|
@ -522,12 +522,12 @@ namespace spot
|
|||
return res;
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
scc_filter_susp(const tgba_digraph* aut, bool remove_all_useless,
|
||||
tgba_digraph_ptr
|
||||
scc_filter_susp(const const_tgba_digraph_ptr& aut, bool remove_all_useless,
|
||||
bdd suspvars, bdd ignoredvars, bool early_susp,
|
||||
scc_info* given_si)
|
||||
{
|
||||
tgba_digraph* res;
|
||||
tgba_digraph_ptr res;
|
||||
if (remove_all_useless)
|
||||
res = scc_filter_apply<susp_filter
|
||||
<state_filter
|
||||
|
|
|
|||
|
|
@ -22,12 +22,11 @@
|
|||
|
||||
#include "misc/common.hh"
|
||||
#include <bdd.h>
|
||||
#include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class scc_map;
|
||||
class tgba;
|
||||
class tgba_digraph;
|
||||
class scc_info;
|
||||
|
||||
|
||||
|
|
@ -60,8 +59,8 @@ namespace spot
|
|||
/// (i.e., transitions leaving accepting states are all marked as
|
||||
/// accepting) may destroy this property. Use scc_filter_states()
|
||||
/// instead.
|
||||
SPOT_API tgba_digraph*
|
||||
scc_filter(const tgba_digraph* aut, bool remove_all_useless = false,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
scc_filter(const const_tgba_digraph_ptr& aut, bool remove_all_useless = false,
|
||||
scc_info* given_si = 0);
|
||||
|
||||
/// \brief Prune unaccepting SCCs.
|
||||
|
|
@ -72,8 +71,8 @@ namespace spot
|
|||
/// Especially, if the input TGBA has the SBA property, (i.e.,
|
||||
/// transitions leaving accepting states are all marked as
|
||||
/// accepting), then the output TGBA will also have that property.
|
||||
SPOT_API tgba_digraph*
|
||||
scc_filter_states(const tgba_digraph* aut, scc_info* given_si = 0);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
scc_filter_states(const const_tgba_digraph_ptr& aut, scc_info* given_si = 0);
|
||||
|
||||
/// \brief Prune unaccepting SCCs, superfluous acceptance
|
||||
/// sets, and suspension variables.
|
||||
|
|
@ -85,8 +84,8 @@ namespace spot
|
|||
///
|
||||
/// This is used by compsusp(), and is probably useless for any
|
||||
/// other use.
|
||||
SPOT_API tgba_digraph*
|
||||
scc_filter_susp(const tgba_digraph* aut, bool remove_all_useless,
|
||||
SPOT_API tgba_digraph_ptr
|
||||
scc_filter_susp(const const_tgba_digraph_ptr& aut, bool remove_all_useless,
|
||||
bdd suspvars, bdd ignoredvars, bool early_susp,
|
||||
scc_info* given_si = 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace spot
|
|||
};
|
||||
}
|
||||
|
||||
scc_info::scc_info(const tgba_digraph* aut)
|
||||
scc_info::scc_info(const_tgba_digraph_ptr aut)
|
||||
: aut_(aut)
|
||||
{
|
||||
unsigned n = aut->num_states();
|
||||
|
|
@ -261,7 +261,7 @@ namespace spot
|
|||
|
||||
std::ostream&
|
||||
dump_scc_info_dot(std::ostream& out,
|
||||
const tgba_digraph* aut, scc_info* sccinfo)
|
||||
const_tgba_digraph_ptr aut, scc_info* sccinfo)
|
||||
{
|
||||
scc_info* m = sccinfo ? sccinfo : new scc_info(aut);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace spot
|
|||
|
||||
std::vector<unsigned> sccof_;
|
||||
std::vector<scc_node> node_;
|
||||
const tgba_digraph* aut_;
|
||||
const_tgba_digraph_ptr aut_;
|
||||
|
||||
|
||||
const scc_node& node(unsigned scc) const
|
||||
|
|
@ -76,9 +76,9 @@ namespace spot
|
|||
}
|
||||
|
||||
public:
|
||||
scc_info(const tgba_digraph* aut);
|
||||
scc_info(const_tgba_digraph_ptr aut);
|
||||
|
||||
const tgba_digraph* get_aut() const
|
||||
const_tgba_digraph_ptr get_aut() const
|
||||
{
|
||||
return aut_;
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ namespace spot
|
|||
/// If \a sccinfo is not given, it will be computed.
|
||||
SPOT_API std::ostream&
|
||||
dump_scc_info_dot(std::ostream& out,
|
||||
const tgba_digraph* aut, scc_info* sccinfo = nullptr);
|
||||
const_tgba_digraph_ptr aut, scc_info* sccinfo = nullptr);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ namespace spot
|
|||
///
|
||||
/// \pre The automaton \a a must have at most one acceptance
|
||||
/// condition (i.e. it is a TBA).
|
||||
se05_search(const tgba *a, size_t size, option_map o = option_map())
|
||||
se05_search(const const_tgba_ptr a, size_t size,
|
||||
option_map o = option_map())
|
||||
: emptiness_check(a, o),
|
||||
h(size),
|
||||
all_cond(a->all_acceptance_conditions())
|
||||
|
|
@ -674,19 +675,20 @@ namespace spot
|
|||
|
||||
} // anonymous
|
||||
|
||||
emptiness_check* explicit_se05_search(const tgba *a, option_map o)
|
||||
emptiness_check* explicit_se05_search(const const_tgba_ptr& a, option_map o)
|
||||
{
|
||||
return new se05_search<explicit_se05_search_heap>(a, 0, o);
|
||||
}
|
||||
|
||||
emptiness_check* bit_state_hashing_se05_search(const tgba *a, size_t size,
|
||||
option_map o)
|
||||
emptiness_check* bit_state_hashing_se05_search(const const_tgba_ptr& a,
|
||||
size_t size,
|
||||
option_map o)
|
||||
{
|
||||
return new se05_search<bsh_se05_search_heap>(a, size, o);
|
||||
}
|
||||
|
||||
emptiness_check*
|
||||
se05(const tgba *a, option_map o)
|
||||
se05(const const_tgba_ptr& a, option_map o)
|
||||
{
|
||||
size_t size = o.get("bsh");
|
||||
if (size)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Developpement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6
|
||||
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
||||
|
|
@ -23,12 +23,12 @@
|
|||
#ifndef SPOT_TGBAALGOS_SE05_HH
|
||||
# define SPOT_TGBAALGOS_SE05_HH
|
||||
|
||||
#include <cstddef>
|
||||
#include "misc/optionmap.hh"
|
||||
# include <cstddef>
|
||||
# include "misc/optionmap.hh"
|
||||
# include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgba;
|
||||
class emptiness_check;
|
||||
|
||||
/// \addtogroup emptiness_check_algorithms
|
||||
|
|
@ -103,7 +103,7 @@ namespace spot
|
|||
/// \sa spot::explicit_magic_search
|
||||
///
|
||||
SPOT_API emptiness_check*
|
||||
explicit_se05_search(const tgba *a, option_map o = option_map());
|
||||
explicit_se05_search(const const_tgba_ptr& a, option_map o = option_map());
|
||||
|
||||
/// \brief Returns an emptiness checker on the spot::tgba automaton \a a.
|
||||
///
|
||||
|
|
@ -133,7 +133,7 @@ namespace spot
|
|||
/// \sa spot::explicit_se05_search
|
||||
///
|
||||
SPOT_API emptiness_check*
|
||||
bit_state_hashing_se05_search(const tgba *a, size_t size,
|
||||
bit_state_hashing_se05_search(const const_tgba_ptr& a, size_t size,
|
||||
option_map o = option_map());
|
||||
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ namespace spot
|
|||
/// in the \c option_map. If \c "bsh" is set and non null, its value
|
||||
/// is used as the size of the hash map.
|
||||
SPOT_API emptiness_check*
|
||||
se05(const tgba *a, option_map o);
|
||||
se05(const const_tgba_ptr& a, option_map o);
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,6 +156,18 @@ namespace spot
|
|||
{
|
||||
}
|
||||
|
||||
automaton_size(const tgba_digraph_ptr& a)
|
||||
: transitions(a->num_transitions()),
|
||||
states(a->num_states())
|
||||
{
|
||||
}
|
||||
|
||||
void set_size(const tgba_digraph_ptr& a)
|
||||
{
|
||||
states = a->num_states();
|
||||
transitions = a->num_transitions();
|
||||
}
|
||||
|
||||
inline bool operator!=(const automaton_size& r)
|
||||
{
|
||||
return transitions != r.transitions || states != r.states;
|
||||
|
|
@ -204,7 +216,8 @@ namespace spot
|
|||
// Shortcut used in update_po and go_to_next_it.
|
||||
typedef std::map<bdd, bdd, bdd_less_than> map_bdd_bdd;
|
||||
public:
|
||||
direct_simulation(const tgba* t, const map_constraint* map_cst = 0)
|
||||
direct_simulation(const const_tgba_ptr& t,
|
||||
const map_constraint* map_cst = 0)
|
||||
: a_(0),
|
||||
po_size_(0),
|
||||
all_class_var_(bddtrue),
|
||||
|
|
@ -230,7 +243,7 @@ namespace spot
|
|||
{
|
||||
if (Cosimulation)
|
||||
{
|
||||
a_ = new tgba_digraph(a_->get_dict());
|
||||
a_ = make_tgba_digraph(a_->get_dict());
|
||||
a_->copy_ap_of(old_a_);
|
||||
a_->copy_acceptance_conditions_of(old_a_);
|
||||
}
|
||||
|
|
@ -311,11 +324,6 @@ namespace spot
|
|||
{
|
||||
a_->get_dict()->unregister_all_my_variables(this);
|
||||
delete scc_map_;
|
||||
|
||||
delete old_a_;
|
||||
// a_ is a new automaton only if we are doing a cosimulation.
|
||||
if (Cosimulation)
|
||||
delete a_;
|
||||
}
|
||||
|
||||
// Update the name of the classes.
|
||||
|
|
@ -363,7 +371,7 @@ namespace spot
|
|||
}
|
||||
|
||||
// The core loop of the algorithm.
|
||||
tgba_digraph* run()
|
||||
tgba_digraph_ptr run()
|
||||
{
|
||||
main_loop();
|
||||
return build_result();
|
||||
|
|
@ -518,13 +526,6 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
automaton_size get_stat() const
|
||||
{
|
||||
assert(stat.states != 0);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
bool result_is_deterministic() const
|
||||
{
|
||||
assert(stat.states != 0);
|
||||
|
|
@ -535,7 +536,7 @@ namespace spot
|
|||
|
||||
|
||||
// Build the minimal resulting automaton.
|
||||
tgba_digraph* build_result()
|
||||
tgba_digraph_ptr build_result()
|
||||
{
|
||||
// We have all the a_'s acceptances conditions
|
||||
// complemented. So we need to complement it when adding a
|
||||
|
|
@ -545,7 +546,7 @@ namespace spot
|
|||
acc_compl reverser(all_acceptance_conditions_,
|
||||
a_->neg_acceptance_conditions());
|
||||
|
||||
tgba_digraph* res = new tgba_digraph(a_->get_dict());
|
||||
tgba_digraph_ptr res = make_tgba_digraph(a_->get_dict());
|
||||
res->copy_ap_of(a_);
|
||||
res->set_acceptance_conditions(all_acceptance_conditions_);
|
||||
if (Sba)
|
||||
|
|
@ -728,8 +729,8 @@ namespace spot
|
|||
|
||||
protected:
|
||||
// The automaton which is simulated.
|
||||
tgba_digraph* a_;
|
||||
tgba_digraph* old_a_;
|
||||
tgba_digraph_ptr a_;
|
||||
tgba_digraph_ptr old_a_;
|
||||
|
||||
// Relation is aimed to represent the same thing than
|
||||
// rel_. The difference is in the way it does.
|
||||
|
|
@ -775,7 +776,7 @@ namespace spot
|
|||
|
||||
const map_constraint* map_cst_;
|
||||
|
||||
const tgba* original_;
|
||||
const_tgba_ptr original_;
|
||||
|
||||
bdd all_acceptance_conditions_;
|
||||
|
||||
|
|
@ -795,7 +796,7 @@ namespace spot
|
|||
|
||||
|
||||
public:
|
||||
direct_simulation_dont_care(const tgba* t)
|
||||
direct_simulation_dont_care(const const_tgba_ptr& t)
|
||||
: direct_simulation<false, false>(t)
|
||||
{
|
||||
// This variable is used in the new signature.
|
||||
|
|
@ -1098,12 +1099,7 @@ namespace spot
|
|||
return res;
|
||||
}
|
||||
|
||||
inline automaton_size get_stat() const
|
||||
{
|
||||
return min_size_;
|
||||
}
|
||||
|
||||
tgba_digraph* run()
|
||||
tgba_digraph_ptr run()
|
||||
{
|
||||
// Iterate the simulation until the end. We just don't return
|
||||
// an automaton. This allows us to get all the information
|
||||
|
|
@ -1188,14 +1184,14 @@ namespace spot
|
|||
assert(previous_class_[i.second] == i.first);
|
||||
#endif
|
||||
|
||||
tgba_digraph* min = 0;
|
||||
tgba_digraph_ptr min = nullptr;
|
||||
|
||||
map_constraint cstr;
|
||||
|
||||
if (has_limit_)
|
||||
rec(cc, cstr, &min, limit_);
|
||||
rec(cc, cstr, min, limit_);
|
||||
else
|
||||
rec(cc, cstr, &min);
|
||||
rec(cc, cstr, min);
|
||||
|
||||
return min;
|
||||
}
|
||||
|
|
@ -1247,7 +1243,7 @@ namespace spot
|
|||
// Compute recursively all the combinations.
|
||||
void rec(constraint_list constraints,
|
||||
map_constraint cstr,
|
||||
tgba_digraph** min,
|
||||
tgba_digraph_ptr& min,
|
||||
int max_depth = std::numeric_limits<int>::max())
|
||||
{
|
||||
assert(max_depth > 0);
|
||||
|
|
@ -1265,19 +1261,14 @@ namespace spot
|
|||
empty_seen_ = true;
|
||||
|
||||
direct_simulation<false, false> dir_sim(original_, &cstr);
|
||||
tgba_digraph* tmp = dir_sim.run();
|
||||
automaton_size cur_size = dir_sim.get_stat();
|
||||
if (*min == 0 || min_size_ > cur_size)
|
||||
tgba_digraph_ptr tmp = dir_sim.run();
|
||||
automaton_size cur_size(tmp);
|
||||
if (!min || min_size_ > cur_size)
|
||||
{
|
||||
delete *min;
|
||||
*min = tmp;
|
||||
min = tmp;
|
||||
min_size_ = cur_size;
|
||||
res_is_deterministic = dir_sim.result_is_deterministic();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void set_limit(int n)
|
||||
|
|
@ -1309,29 +1300,29 @@ namespace spot
|
|||
} // End namespace anonymous.
|
||||
|
||||
|
||||
tgba_digraph*
|
||||
simulation(const tgba* t)
|
||||
tgba_digraph_ptr
|
||||
simulation(const const_tgba_ptr& t)
|
||||
{
|
||||
direct_simulation<false, false> simul(t);
|
||||
return simul.run();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
simulation_sba(const tgba* t)
|
||||
tgba_digraph_ptr
|
||||
simulation_sba(const const_tgba_ptr& t)
|
||||
{
|
||||
direct_simulation<false, true> simul(t);
|
||||
return simul.run();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
cosimulation(const tgba* t)
|
||||
tgba_digraph_ptr
|
||||
cosimulation(const const_tgba_ptr& t)
|
||||
{
|
||||
direct_simulation<true, false> simul(t);
|
||||
return simul.run();
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
cosimulation_sba(const tgba* t)
|
||||
tgba_digraph_ptr
|
||||
cosimulation_sba(const const_tgba_ptr& t)
|
||||
{
|
||||
direct_simulation<true, true> simul(t);
|
||||
return simul.run();
|
||||
|
|
@ -1339,10 +1330,10 @@ namespace spot
|
|||
|
||||
|
||||
template<bool Sba>
|
||||
tgba_digraph*
|
||||
iterated_simulations_(const tgba* t)
|
||||
tgba_digraph_ptr
|
||||
iterated_simulations_(const const_tgba_ptr& t)
|
||||
{
|
||||
tgba_digraph* res = 0;
|
||||
tgba_digraph_ptr res = 0;
|
||||
automaton_size prev;
|
||||
automaton_size next;
|
||||
|
||||
|
|
@ -1350,80 +1341,59 @@ namespace spot
|
|||
{
|
||||
prev = next;
|
||||
direct_simulation<false, Sba> simul(res ? res : t);
|
||||
tgba_digraph* after_simulation = simul.run();
|
||||
delete res;
|
||||
|
||||
res = simul.run();
|
||||
if (simul.result_is_deterministic())
|
||||
{
|
||||
res = after_simulation;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
direct_simulation<true, Sba> cosimul(after_simulation);
|
||||
tgba_digraph* after_cosimulation = cosimul.run();
|
||||
next = cosimul.get_stat();
|
||||
delete after_simulation;
|
||||
direct_simulation<true, Sba> cosimul(res);
|
||||
res = cosimul.run();
|
||||
next.set_size(res);
|
||||
|
||||
if (Sba)
|
||||
res = scc_filter_states(after_cosimulation);
|
||||
res = scc_filter_states(res);
|
||||
else
|
||||
res = scc_filter(after_cosimulation, false);
|
||||
delete after_cosimulation;
|
||||
res = scc_filter(res, false);
|
||||
}
|
||||
while (prev != next);
|
||||
return res;
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
iterated_simulations(const tgba* t)
|
||||
tgba_digraph_ptr
|
||||
iterated_simulations(const const_tgba_ptr& t)
|
||||
{
|
||||
return iterated_simulations_<false>(t);
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
iterated_simulations_sba(const tgba* t)
|
||||
tgba_digraph_ptr
|
||||
iterated_simulations_sba(const const_tgba_ptr& t)
|
||||
{
|
||||
return iterated_simulations_<true>(t);
|
||||
}
|
||||
|
||||
tgba_digraph*
|
||||
dont_care_simulation(const tgba* t, int limit)
|
||||
tgba_digraph_ptr
|
||||
dont_care_simulation(const const_tgba_ptr& t, int limit)
|
||||
{
|
||||
direct_simulation<false, false> sim(t);
|
||||
tgba_digraph* tmp = sim.run();
|
||||
|
||||
direct_simulation_dont_care s(tmp);
|
||||
direct_simulation_dont_care s(sim.run());
|
||||
if (limit > 0)
|
||||
s.set_limit(limit);
|
||||
|
||||
tgba_digraph* res = s.run();
|
||||
delete tmp;
|
||||
|
||||
return res;
|
||||
return s.run();
|
||||
}
|
||||
|
||||
|
||||
tgba_digraph*
|
||||
dont_care_iterated_simulations(const tgba* t, int limit)
|
||||
tgba_digraph_ptr
|
||||
dont_care_iterated_simulations(const const_tgba_ptr& t, int limit)
|
||||
{
|
||||
tgba_digraph* res = 0;
|
||||
tgba_digraph_ptr res = 0;
|
||||
automaton_size prev;
|
||||
automaton_size next;
|
||||
|
||||
do
|
||||
{
|
||||
prev = next;
|
||||
tgba_digraph* after_simulation =
|
||||
dont_care_simulation(res ? res : t, limit);
|
||||
delete res;
|
||||
|
||||
direct_simulation<true, false> cosimul(after_simulation);
|
||||
tgba_digraph* after_cosimulation = cosimul.run();
|
||||
delete after_simulation;
|
||||
|
||||
next = cosimul.get_stat();
|
||||
res = scc_filter(after_cosimulation, true);
|
||||
delete after_cosimulation;
|
||||
res = cosimulation(dont_care_simulation(res ? res : t, limit));
|
||||
res = scc_filter(res, true);
|
||||
next.set_size(res);
|
||||
}
|
||||
while (prev != next);
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ namespace spot
|
|||
/// \param automaton the automaton to simulate.
|
||||
/// \return a new automaton which is at worst a copy of the received
|
||||
/// one
|
||||
SPOT_API tgba_digraph* simulation(const tgba* automaton);
|
||||
SPOT_API tgba_digraph* simulation_sba(const tgba* automaton);
|
||||
SPOT_API tgba_digraph_ptr simulation(const const_tgba_ptr& automaton);
|
||||
SPOT_API tgba_digraph_ptr simulation_sba(const const_tgba_ptr& automaton);
|
||||
/// @}
|
||||
|
||||
/// @{
|
||||
|
|
@ -121,8 +121,8 @@ namespace spot
|
|||
/// \param automaton the automaton to simulate.
|
||||
/// \return a new automaton which is at worst a copy of the received
|
||||
/// one
|
||||
SPOT_API tgba_digraph* cosimulation(const tgba* automaton);
|
||||
SPOT_API tgba_digraph* cosimulation_sba(const tgba* automaton);
|
||||
SPOT_API tgba_digraph_ptr cosimulation(const const_tgba_ptr& automaton);
|
||||
SPOT_API tgba_digraph_ptr cosimulation_sba(const const_tgba_ptr& automaton);
|
||||
/// @}
|
||||
|
||||
/// @{
|
||||
|
|
@ -140,16 +140,18 @@ namespace spot
|
|||
/// \param automaton the automaton to simulate.
|
||||
/// \return a new automaton which is at worst a copy of the received
|
||||
/// one
|
||||
SPOT_API tgba_digraph* iterated_simulations(const tgba* automaton);
|
||||
SPOT_API tgba_digraph* iterated_simulations_sba(const tgba* automaton);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
iterated_simulations(const const_tgba_ptr& automaton);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
iterated_simulations_sba(const const_tgba_ptr& automaton);
|
||||
/// @}
|
||||
|
||||
|
||||
SPOT_API tgba_digraph*
|
||||
dont_care_simulation(const tgba* t, int limit = -1);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dont_care_simulation(const const_tgba_ptr& t, int limit = -1);
|
||||
|
||||
SPOT_API tgba_digraph*
|
||||
dont_care_iterated_simulations(const tgba* t, int limit = -1);
|
||||
SPOT_API tgba_digraph_ptr
|
||||
dont_care_iterated_simulations(const const_tgba_ptr& t, int limit = -1);
|
||||
|
||||
|
||||
/// @}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace spot
|
|||
class stats_bfs: public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
public:
|
||||
stats_bfs(const tgba* a, tgba_statistics& s)
|
||||
stats_bfs(const const_tgba_ptr& a, tgba_statistics& s)
|
||||
: tgba_reachable_iterator_breadth_first(a), s_(s)
|
||||
{
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ namespace spot
|
|||
class sub_stats_bfs: public stats_bfs
|
||||
{
|
||||
public:
|
||||
sub_stats_bfs(const tgba* a, tgba_sub_statistics& s)
|
||||
sub_stats_bfs(const const_tgba_ptr& a, tgba_sub_statistics& s)
|
||||
: stats_bfs(a, s), s_(s), seen_(bddtrue)
|
||||
{
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ namespace spot
|
|||
}
|
||||
|
||||
tgba_statistics
|
||||
stats_reachable(const tgba* g)
|
||||
stats_reachable(const const_tgba_ptr& g)
|
||||
{
|
||||
tgba_statistics s;
|
||||
stats_bfs d(g, s);
|
||||
|
|
@ -125,7 +125,7 @@ namespace spot
|
|||
}
|
||||
|
||||
tgba_sub_statistics
|
||||
sub_stats_reachable(const tgba* g)
|
||||
sub_stats_reachable(const const_tgba_ptr& g)
|
||||
{
|
||||
tgba_sub_statistics s;
|
||||
sub_stats_bfs d(g, s);
|
||||
|
|
@ -157,7 +157,7 @@ namespace spot
|
|||
}
|
||||
|
||||
std::ostream&
|
||||
stat_printer::print(const tgba* aut,
|
||||
stat_printer::print(const const_tgba_ptr& aut,
|
||||
const ltl::formula* f,
|
||||
double run_time)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ namespace spot
|
|||
};
|
||||
|
||||
/// \brief Compute statistics for an automaton.
|
||||
SPOT_API tgba_statistics stats_reachable(const tgba* g);
|
||||
SPOT_API tgba_statistics stats_reachable(const const_tgba_ptr& g);
|
||||
/// \brief Compute subended statistics for an automaton.
|
||||
SPOT_API tgba_sub_statistics sub_stats_reachable(const tgba* g);
|
||||
SPOT_API tgba_sub_statistics sub_stats_reachable(const const_tgba_ptr& g);
|
||||
|
||||
|
||||
class SPOT_API printable_formula: public printable_value<const ltl::formula*>
|
||||
|
|
@ -85,7 +85,7 @@ namespace spot
|
|||
/// The \a f argument is not needed if the Formula does not need
|
||||
/// to be output, and so is \a run_time).
|
||||
std::ostream&
|
||||
print(const tgba* aut, const ltl::formula* f = 0,
|
||||
print(const const_tgba_ptr& aut, const ltl::formula* f = 0,
|
||||
double run_time = -1.);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace spot
|
||||
{
|
||||
void strip_acceptance_here(tgba_digraph* a)
|
||||
void strip_acceptance_here(tgba_digraph_ptr a)
|
||||
{
|
||||
unsigned n = a->num_states();
|
||||
for (unsigned s = 0; s < n; ++s)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace spot
|
|||
///
|
||||
/// This is equivalent to marking all states/transitions as accepting.
|
||||
SPOT_API void
|
||||
strip_acceptance_here(tgba_digraph* a);
|
||||
strip_acceptance_here(tgba_digraph_ptr a);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_STRIPACC_HH
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
/// \brief Initialize the search algorithm on the automaton \a a
|
||||
tau03_search(const tgba *a, size_t size, option_map o)
|
||||
tau03_search(const const_tgba_ptr a, size_t size, option_map o)
|
||||
: emptiness_check(a, o),
|
||||
h(size),
|
||||
all_cond(a->all_acceptance_conditions())
|
||||
|
|
@ -374,7 +374,7 @@ namespace spot
|
|||
|
||||
} // anonymous
|
||||
|
||||
emptiness_check* explicit_tau03_search(const tgba *a, option_map o)
|
||||
emptiness_check* explicit_tau03_search(const const_tgba_ptr& a, option_map o)
|
||||
{
|
||||
return new tau03_search<explicit_tau03_search_heap>(a, 0, o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013 Laboratoire de Recherche et Développement de
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -23,11 +23,11 @@
|
|||
#ifndef SPOT_TGBAALGOS_TAU03_HH
|
||||
# define SPOT_TGBAALGOS_TAU03_HH
|
||||
|
||||
#include "misc/optionmap.hh"
|
||||
# include "misc/optionmap.hh"
|
||||
# include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgba;
|
||||
class emptiness_check;
|
||||
|
||||
/// \addtogroup emptiness_check_algorithms
|
||||
|
|
@ -97,7 +97,7 @@ namespace spot
|
|||
\endverbatim */
|
||||
///
|
||||
SPOT_API emptiness_check*
|
||||
explicit_tau03_search(const tgba *a, option_map o = option_map());
|
||||
explicit_tau03_search(const const_tgba_ptr& a, option_map o = option_map());
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace spot
|
|||
{
|
||||
public:
|
||||
/// \brief Initialize the search algorithm on the automaton \a a
|
||||
tau03_opt_search(const tgba *a, size_t size, option_map o)
|
||||
tau03_opt_search(const const_tgba_ptr& a, size_t size, option_map o)
|
||||
: emptiness_check(a, o),
|
||||
current_weight(a->neg_acceptance_conditions()),
|
||||
h(size),
|
||||
|
|
@ -572,7 +572,8 @@ namespace spot
|
|||
|
||||
} // anonymous
|
||||
|
||||
emptiness_check* explicit_tau03_opt_search(const tgba *a, option_map o)
|
||||
emptiness_check* explicit_tau03_opt_search(const const_tgba_ptr& a,
|
||||
option_map o)
|
||||
{
|
||||
return new tau03_opt_search<explicit_tau03_opt_search_heap>(a, 0, o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013 Laboratoire de Recherche et Développement de
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -23,11 +23,11 @@
|
|||
#ifndef SPOT_TGBAALGOS_TAU03OPT_HH
|
||||
# define SPOT_TGBAALGOS_TAU03OPT_HH
|
||||
|
||||
#include "misc/optionmap.hh"
|
||||
# include "misc/optionmap.hh"
|
||||
# include "tgba/fwd.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class tgba;
|
||||
class emptiness_check;
|
||||
|
||||
/// \addtogroup emptiness_check_algorithms
|
||||
|
|
@ -99,7 +99,8 @@ namespace spot
|
|||
/// state of this stack.
|
||||
///
|
||||
SPOT_API emptiness_check*
|
||||
explicit_tau03_opt_search(const tgba *a, option_map o = option_map());
|
||||
explicit_tau03_opt_search(const const_tgba_ptr& a,
|
||||
option_map o = option_map());
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace spot
|
|||
simpl_owned_ = simpl_ = new ltl::ltl_simplifier(options, dict);
|
||||
}
|
||||
|
||||
const tgba_digraph* translator::run(const ltl::formula** f)
|
||||
const_tgba_digraph_ptr translator::run(const ltl::formula** f)
|
||||
{
|
||||
const ltl::formula* r = simpl_->simplify(*f);
|
||||
(*f)->destroy();
|
||||
|
|
@ -71,7 +71,7 @@ namespace spot
|
|||
// natural way (improving the degeneralization).
|
||||
simpl_->clear_as_bdd_cache();
|
||||
|
||||
const tgba_digraph* aut;
|
||||
tgba_digraph_ptr aut;
|
||||
if (comp_susp_ > 0)
|
||||
{
|
||||
int skel_wdba = skel_wdba_;
|
||||
|
|
@ -91,7 +91,7 @@ namespace spot
|
|||
return aut;
|
||||
}
|
||||
|
||||
const tgba_digraph* translator::run(const ltl::formula* f)
|
||||
const_tgba_digraph_ptr translator::run(const ltl::formula* f)
|
||||
{
|
||||
f->clone();
|
||||
auto aut = run(&f);
|
||||
|
|
|
|||
|
|
@ -103,14 +103,14 @@ namespace spot
|
|||
///
|
||||
/// The formula \a f is simplified internally, but it is not
|
||||
/// not destroyed (this is the responsibility of the caller).
|
||||
const tgba_digraph* run(const ltl::formula* f);
|
||||
const_tgba_digraph_ptr run(const ltl::formula* f);
|
||||
|
||||
/// \brief Convert \a f into an automaton, and update f.
|
||||
///
|
||||
/// The formula <code>*f</code> is destroyed, and replaced
|
||||
/// by the simplified version, which should be destroyed by
|
||||
/// the caller.
|
||||
const tgba_digraph* run(const ltl::formula** f);
|
||||
const_tgba_digraph_ptr run(const ltl::formula** f);
|
||||
|
||||
protected:
|
||||
void setup_opt(const option_map* opt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue