Create the iterated simulations.
* src/tgbaalgos/simulation.cc: Create the iterated_simulations. (direct_simulation) Add an attribute "stat" that represents the number of states and transitions of the resulting automaton. * src/tgbaalgos/simulation.hh: Declare the iterated_simulations. * src/tgbatest/spotlbtt.test: Test the iterated_simulations. * src/tgbatest/ltl2tgba.cc: Associate the option -RIS to the iterated_simulations.
This commit is contained in:
parent
242386b19a
commit
a0cce10512
4 changed files with 101 additions and 2 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "misc/minato.hh"
|
||||
#include "tgba/bddprint.hh"
|
||||
#include "tgbaalgos/reachiter.hh"
|
||||
#include "tgbaalgos/sccfilter.hh"
|
||||
|
||||
// The way we developed this algorithm is the following: We take an
|
||||
// automaton, and reverse all these acceptance conditions. We reverse
|
||||
|
|
@ -104,6 +105,22 @@ namespace spot
|
|||
typedef std::map<bdd, std::list<const state*>,
|
||||
bdd_less_than> map_bdd_lstate;
|
||||
|
||||
struct automaton_size
|
||||
{
|
||||
automaton_size()
|
||||
: transitions(0),
|
||||
states(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline bool operator!= (const automaton_size& r)
|
||||
{
|
||||
return transitions != r.transitions || states != r.states;
|
||||
}
|
||||
|
||||
int transitions;
|
||||
int states;
|
||||
};
|
||||
|
||||
// This class takes an automaton and creates a copy with all
|
||||
// acceptance conditions complemented.
|
||||
|
|
@ -146,7 +163,6 @@ namespace spot
|
|||
int src = get_state(in_s);
|
||||
int dst = get_state(out_s);
|
||||
|
||||
|
||||
// In the case of the cosimulation, we want to have all the
|
||||
// ingoing transition, and to keep the rest of the code
|
||||
// similar, we just create equivalent transition in the other
|
||||
|
|
@ -223,7 +239,6 @@ namespace spot
|
|||
bdd init = bdd_ithvar(set_num++);
|
||||
|
||||
used_var_.push_back(init);
|
||||
all_class_var_ = init;
|
||||
|
||||
// We fetch the result the run of acc_compl_automaton which
|
||||
// has recorded all the state in a hash table, and we set all
|
||||
|
|
@ -240,6 +255,7 @@ namespace spot
|
|||
// of these in a variable all_class_var_ which will be used
|
||||
// to understand the destination part in the signature when
|
||||
// building the resulting automaton.
|
||||
all_class_var_ = init;
|
||||
for (unsigned i = set_num; i < set_num + size_a_ - 1; ++i)
|
||||
{
|
||||
free_var_.push(i);
|
||||
|
|
@ -443,6 +459,14 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
automaton_size get_stat() const
|
||||
{
|
||||
assert(stat.states != 0);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
// Build the minimal resulting automaton.
|
||||
tgba* build_result()
|
||||
{
|
||||
|
|
@ -489,6 +513,9 @@ namespace spot
|
|||
bdd2state[relation_[part]] = current_max;
|
||||
}
|
||||
|
||||
stat.states = bdd_lstate_.size();
|
||||
stat.transitions = 0;
|
||||
|
||||
// For each partition, we will create
|
||||
// all the transitions between the states.
|
||||
for (map_bdd_lstate::iterator it = bdd_lstate_.begin();
|
||||
|
|
@ -533,6 +560,8 @@ namespace spot
|
|||
bdd cond_acc_dest;
|
||||
while ((cond_acc_dest = isop.next()) != bddfalse)
|
||||
{
|
||||
++stat.transitions;
|
||||
|
||||
// Take the transition, and keep only the variable which
|
||||
// are used to represent the class.
|
||||
bdd dest = bdd_existcomp(cond_acc_dest,
|
||||
|
|
@ -665,6 +694,8 @@ namespace spot
|
|||
// Initial state of the automaton we are working on
|
||||
state* initial_state;
|
||||
|
||||
automaton_size stat;
|
||||
|
||||
};
|
||||
|
||||
} // End namespace anonymous.
|
||||
|
|
@ -685,4 +716,38 @@ namespace spot
|
|||
return simul.run();
|
||||
}
|
||||
|
||||
tgba*
|
||||
iterated_simulations(const tgba* t)
|
||||
{
|
||||
tgba* res = const_cast<tgba*> (t);
|
||||
automaton_size prev;
|
||||
automaton_size next;
|
||||
|
||||
do
|
||||
{
|
||||
prev = next;
|
||||
direct_simulation<false> simul(res);
|
||||
|
||||
tgba* after_simulation = simul.run();
|
||||
|
||||
if (res != t)
|
||||
delete res;
|
||||
|
||||
direct_simulation<true> cosimul(after_simulation);
|
||||
|
||||
tgba* after_cosimulation = cosimul.run();
|
||||
|
||||
next = cosimul.get_stat();
|
||||
|
||||
res = scc_filter(after_cosimulation, false);
|
||||
|
||||
delete after_cosimulation;
|
||||
delete after_simulation;
|
||||
}
|
||||
while (prev != next);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
} // End namespace spot.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue