* src/tgba/tgba.hh, src/tgba/tgba.cc

(tgba::project_state): New method.
* src/tgba/tgbaproduct.hh, src/tgba/tgbaproduct.cc
(tgba_product::project_state): New method.
* src/tgba/tgbabta.hh, src/tgba/tgbabta.cc
(tgba_bta_proxy::project_state): New method.
* src/tgbaalgos/magic.cc (magic_search::print_result): Take
a restrict argument.
This commit is contained in:
Alexandre Duret-Lutz 2003-07-30 12:41:48 +00:00
parent a66ad58b5d
commit 24099078d6
10 changed files with 106 additions and 18 deletions

View file

@ -122,7 +122,7 @@ namespace spot
}
std::ostream&
magic_search::print_result(std::ostream& os) const
magic_search::print_result(std::ostream& os, const tgba* restrict) const
{
stack_type::const_reverse_iterator i;
tstack_type::const_reverse_iterator ti;
@ -133,10 +133,33 @@ namespace spot
{
if (i->first.s->compare(x) == 0)
os <<"Cycle:" <<std::endl;
os << " " << a->format_state(i->first.s) << std::endl;
const state* s = i->first.s;
if (restrict)
{
s = a->project_state(s, restrict);
assert(s);
os << " " << restrict->format_state(s) << std::endl;
delete s;
}
else
{
os << " " << a->format_state(s) << std::endl;
}
os << " | " << bdd_format_set(d, *ti) << std::endl;
}
os << " " << a->format_state(x) << std::endl;
if (restrict)
{
const state* s = a->project_state(x, restrict);
assert(s);
os << " " << restrict->format_state(s) << std::endl;
delete s;
}
else
{
os << " " << a->format_state(x) << std::endl;
}
return os;
}

View file

@ -9,7 +9,7 @@
namespace spot
{
/// \brief Emptiness check on spot::tgba_tba_proxy automata using
/// the Magic Search algorithm.
/// the Magic Search algorithm.
///
/// This algorithm comes from
/// \verbatim
@ -38,7 +38,7 @@ namespace spot
~magic_search();
/// \brief Perform a Magic Search.
///
///
/// \return true iff the algorithm has found a new accepting
/// path.
///
@ -46,8 +46,12 @@ namespace spot
/// to enumerate all accepting paths.
bool check();
/// Print the last accepting path found.
std::ostream& print_result(std::ostream& os) const;
/// \brief Print the last accepting path found.
///
/// Restrict printed states to \a the state space of restrict if
/// supplied.
std::ostream& print_result(std::ostream& os,
const tgba* restrict = 0) const;
private:
@ -60,7 +64,7 @@ namespace spot
bool seen_without : 1;
bool seen_with : 1;
};
/// \brief A state for the spot::magic_search algorithm.
struct magic_state
{
@ -73,7 +77,7 @@ namespace spot
stack_type stack; ///< Stack of visited states on the path.
typedef std::list<bdd> tstack_type;
/// \brief Stack of transitions.
/// \brief Stack of transitions.
///
/// This is an addition to the data from the paper.
tstack_type tstack;
@ -89,7 +93,7 @@ namespace spot
const tgba_tba_proxy* a; ///< The automata to check.
/// The state for which we are currently seeking an SCC.
const state* x;
const state* x;
};