* src/tgbaalgos/magic.cc: Fix a stupid bug.

* src/tgbaalgos/se05.cc: Fix the same bug.
* src/tgbatest/Makefile.am: Signify that emptchkr.test pass.
This commit is contained in:
Denis Poitrenaud 2004-11-15 18:15:42 +00:00
parent 5d16bb63b4
commit dd4d8dea01
4 changed files with 84 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2004-11-15 Poitrenaud Denis <denis@src.lip6.fr>
* src/tgbaalgos/magic.cc: Fix a stupid bug.
* src/tgbaalgos/se05.cc: Fix the same bug.
* src/tgbatest/Makefile.am: Signify that emptchkr.test pass.
2004-11-15 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-11-15 Alexandre Duret-Lutz <adl@src.lip6.fr>
* tgbatest/randtgba.cc: Add options -e and -r. * tgbatest/randtgba.cc: Add options -e and -r.

View file

@ -191,8 +191,8 @@ namespace spot
} }
else // Backtrack the edge (f.s, <label, acc>, s_prime) else // Backtrack the edge (f.s, <label, acc>, s_prime)
{ {
if (c.get() == BLUE && acc == all_cond) if (c.get() != RED && acc == all_cond)
// the test 'c.get() == BLUE' is added to limit // the test 'c.get() != RED' is added to limit
// the number of runs reported by successive // the number of runs reported by successive
// calls to the check method. Without this // calls to the check method. Without this
// functionnality, the test can be ommited. // functionnality, the test can be ommited.
@ -217,9 +217,9 @@ namespace spot
st_blue.pop_front(); st_blue.pop_front();
typename heap::color_ref c = h.get_color_ref(f_dest.s); typename heap::color_ref c = h.get_color_ref(f_dest.s);
assert(!c.is_white()); assert(!c.is_white());
if (c.get() == BLUE && f_dest.acc == all_cond if (c.get() != RED && f_dest.acc == all_cond
&& !st_blue.empty()) && !st_blue.empty())
// the test 'c.get() == BLUE' is added to limit // the test 'c.get() != RED' is added to limit
// the number of runs reported by successive // the number of runs reported by successive
// calls to the check method. Without this // calls to the check method. Without this
// functionnality, the test can be ommited. // functionnality, the test can be ommited.

View file

@ -19,7 +19,11 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA. // 02111-1307, USA.
//#define TRACE
#ifdef TRACE
#include <iostream> #include <iostream>
#endif
#include "misc/hash.hh" #include "misc/hash.hh"
#include <list> #include <list>
#include <iterator> #include <iterator>
@ -175,12 +179,20 @@ namespace spot
while (!st_blue.empty()) while (!st_blue.empty())
{ {
stack_item& f = st_blue.front(); stack_item& f = st_blue.front();
#ifdef TRACE
std::cout << "DFS_BLUE treats: "
<< a->format_state(f.s) << std::endl;
#endif
if (!f.it->done()) if (!f.it->done())
{ {
++nbt; ++nbt;
const state *s_prime = f.it->current_state(); const state *s_prime = f.it->current_state();
bdd label = f.it->current_condition(); bdd label = f.it->current_condition();
bdd acc = f.it->current_acceptance_conditions(); bdd acc = f.it->current_acceptance_conditions();
#ifdef TRACE
std::cout << " Visit the successor: "
<< a->format_state(s_prime) << std::endl;
#endif
f.it->next(); f.it->next();
typename heap::color_ref c = h.get_color_ref(s_prime); typename heap::color_ref c = h.get_color_ref(s_prime);
if (c.is_white()) if (c.is_white())
@ -189,6 +201,9 @@ namespace spot
if (acc == all_cond) if (acc == all_cond)
++current_weight; ++current_weight;
++nbn; ++nbn;
#ifdef TRACE
std::cout << " It is white, go down" << std::endl;
#endif
h.add_new_state(s_prime, CYAN, current_weight); h.add_new_state(s_prime, CYAN, current_weight);
push(st_blue, s_prime, label, acc); push(st_blue, s_prime, label, acc);
} }
@ -197,13 +212,21 @@ namespace spot
if (c.get() == CYAN && if (c.get() == CYAN &&
(acc == all_cond || current_weight > c.get_weight())) (acc == all_cond || current_weight > c.get_weight()))
{ {
#ifdef TRACE
std::cout << " It is cyan and a cycle has been found"
<< std::endl;
#endif
c.set(RED); c.set(RED);
push(st_red, s_prime, label, acc); push(st_red, s_prime, label, acc);
return true; return true;
} }
else if (c.get() == BLUE && acc == all_cond) else if (c.get() != RED && acc == all_cond)
{ {
// the test 'c.get() == BLUE' is added to limit #ifdef TRACE
std::cout << " It is blue and the arc is accepting"
<< ", start a red dfs" << std::endl;
#endif
// the test 'c.get() != RED' is added to limit
// the number of runs reported by successive // the number of runs reported by successive
// calls to the check method. Without this // calls to the check method. Without this
// functionnality, the test can be ommited. // functionnality, the test can be ommited.
@ -213,6 +236,10 @@ namespace spot
return true; return true;
} }
else else
#ifdef TRACE
std::cout << " It is blue or red, pop it"
<< std::endl;
#endif
h.pop_notify(s_prime); h.pop_notify(s_prime);
} }
} }
@ -220,6 +247,10 @@ namespace spot
// Backtrack the edge // Backtrack the edge
// (predecessor of f.s in st_blue, <f.label, f.acc>, f.s) // (predecessor of f.s in st_blue, <f.label, f.acc>, f.s)
{ {
#ifdef TRACE
std::cout << " All the successors have been visited"
<< std::endl;
#endif
--sts; --sts;
stack_item f_dest(f); stack_item f_dest(f);
delete f.it; delete f.it;
@ -228,13 +259,19 @@ namespace spot
--current_weight; --current_weight;
typename heap::color_ref c = h.get_color_ref(f_dest.s); typename heap::color_ref c = h.get_color_ref(f_dest.s);
assert(!c.is_white()); assert(!c.is_white());
if (c.get() == BLUE && f_dest.acc == all_cond if (c.get() != RED && f_dest.acc == all_cond
&& !st_blue.empty()) && !st_blue.empty())
// the test 'c.get() == BLUE' is added to limit // the test 'c.get() != RED' is added to limit
// the number of runs reported by successive // the number of runs reported by successive
// calls to the check method. Without this // calls to the check method. Without this
// functionnality, the test can be ommited. // functionnality, the test can be ommited.
{ {
#ifdef TRACE
std::cout << " The arc from "
<< a->format_state(st_blue.front().s)
<< " to the current state is accepting,"
<< " start a red dfs" << std::endl;
#endif
c.set(RED); c.set(RED);
push(st_red, f_dest.s, f_dest.label, f_dest.acc); push(st_red, f_dest.s, f_dest.label, f_dest.acc);
if (dfs_red()) if (dfs_red())
@ -242,6 +279,9 @@ namespace spot
} }
else else
{ {
#ifdef TRACE
std::cout << " Set it blue and pop it" << std::endl;
#endif
c.set(BLUE); c.set(BLUE);
h.pop_notify(f_dest.s); h.pop_notify(f_dest.s);
} }
@ -257,12 +297,20 @@ namespace spot
while (!st_red.empty()) while (!st_red.empty())
{ {
stack_item& f = st_red.front(); stack_item& f = st_red.front();
#ifdef TRACE
std::cout << "DFS_RED treats: "
<< a->format_state(f.s) << std::endl;
#endif
if (!f.it->done()) if (!f.it->done())
{ {
++nbt; ++nbt;
const state *s_prime = f.it->current_state(); const state *s_prime = f.it->current_state();
bdd label = f.it->current_condition(); bdd label = f.it->current_condition();
bdd acc = f.it->current_acceptance_conditions(); bdd acc = f.it->current_acceptance_conditions();
#ifdef TRACE
std::cout << " Visit the successor: "
<< a->format_state(s_prime) << std::endl;
#endif
f.it->next(); f.it->next();
typename heap::color_ref c = h.get_color_ref(s_prime); typename heap::color_ref c = h.get_color_ref(s_prime);
if (c.is_white()) if (c.is_white())
@ -271,6 +319,9 @@ namespace spot
// this functionnality => assert(c.is_white()) // this functionnality => assert(c.is_white())
// Go down the edge (f.s, <label, acc>, s_prime) // Go down the edge (f.s, <label, acc>, s_prime)
{ {
#ifdef TRACE
std::cout << " It is white, go down" << std::endl;
#endif
++nbn; ++nbn;
h.add_new_state(s_prime, RED); h.add_new_state(s_prime, RED);
push(st_red, s_prime, label, acc); push(st_red, s_prime, label, acc);
@ -279,21 +330,36 @@ namespace spot
{ {
if (c.get() == CYAN) if (c.get() == CYAN)
{ {
#ifdef TRACE
std::cout << " It is cyan, report a cycle"
<< std::endl;
#endif
c.set(RED); c.set(RED);
push(st_red, s_prime, label, acc); push(st_red, s_prime, label, acc);
return true; return true;
} }
if (c.get() == BLUE) if (c.get() == BLUE)
{ {
#ifdef TRACE
std::cout << " It is blue, go down" << std::endl;
#endif
c.set(RED); c.set(RED);
push(st_red, s_prime, label, acc); push(st_red, s_prime, label, acc);
} }
else else
#ifdef TRACE
std::cout << " It is red, pop it"
<< std::endl;
#endif
h.pop_notify(s_prime); h.pop_notify(s_prime);
} }
} }
else // Backtrack else // Backtrack
{ {
#ifdef TRACE
std::cout << " All the successors have been visited"
<< ", pop it" << std::endl;
#endif
--sts; --sts;
h.pop_notify(f.s); h.pop_notify(f.s);
delete f.it; delete f.it;

View file

@ -85,7 +85,6 @@ TESTS = \
dfs.test \ dfs.test \
emptchkr.test \ emptchkr.test \
spotlbtt.test spotlbtt.test
XFAIL_TESTS = emptchkr.test
EXTRA_DIST = $(TESTS) ltl2baw.pl EXTRA_DIST = $(TESTS) ltl2baw.pl