* src/tgbaalgos/tau03opt.cc (tau03_opt_search): Implement the
"condition heuristic". Suggested by Heikki Tauriainen. * src/tgbatest/randtgba.cc: Test it.
This commit is contained in:
parent
6314b682ba
commit
ff8fe6802b
3 changed files with 63 additions and 26 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
2005-02-18 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
2005-02-18 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||||
|
|
||||||
|
* src/tgbaalgos/tau03opt.cc (tau03_opt_search): Implement the
|
||||||
|
"condition heuristic". Suggested by Heikki Tauriainen.
|
||||||
|
* src/tgbatest/randtgba.cc: Test it.
|
||||||
|
|
||||||
* src/tgbatest/randtgba.cc: Remplace the -O option by -A, reading
|
* src/tgbatest/randtgba.cc: Remplace the -O option by -A, reading
|
||||||
all algorithms from a file. Use the emptiness_check_instantiator
|
all algorithms from a file. Use the emptiness_check_instantiator
|
||||||
syntax as name in the output.
|
syntax as name in the output.
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <stack>
|
||||||
#include "misc/hash.hh"
|
#include "misc/hash.hh"
|
||||||
#include "tgba/tgba.hh"
|
#include "tgba/tgba.hh"
|
||||||
#include "emptiness.hh"
|
#include "emptiness.hh"
|
||||||
|
|
@ -66,7 +67,8 @@ namespace spot
|
||||||
: emptiness_check(a, o),
|
: emptiness_check(a, o),
|
||||||
current_weight(a->neg_acceptance_conditions()),
|
current_weight(a->neg_acceptance_conditions()),
|
||||||
h(size),
|
h(size),
|
||||||
all_acc(a->all_acceptance_conditions())
|
all_acc(a->all_acceptance_conditions()),
|
||||||
|
use_condition_stack(o.get("condstack"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,6 +163,9 @@ namespace spot
|
||||||
/// The unique accepting condition of the automaton \a a.
|
/// The unique accepting condition of the automaton \a a.
|
||||||
bdd all_acc;
|
bdd all_acc;
|
||||||
|
|
||||||
|
/// Whether to use the "condition stack".
|
||||||
|
bool use_condition_stack;
|
||||||
|
|
||||||
bool dfs_blue()
|
bool dfs_blue()
|
||||||
{
|
{
|
||||||
while (!st_blue.empty())
|
while (!st_blue.empty())
|
||||||
|
|
@ -266,10 +271,16 @@ namespace spot
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dfs_red(const bdd& acu)
|
bool
|
||||||
|
dfs_red(bdd acu)
|
||||||
{
|
{
|
||||||
assert(!st_red.empty());
|
assert(!st_red.empty());
|
||||||
|
|
||||||
|
// These are useful only when USE_CONDITION_STACK is set.
|
||||||
|
typedef std::pair<bdd, unsigned> cond_level;
|
||||||
|
std::stack<cond_level> condition_stack;
|
||||||
|
unsigned depth = 1;
|
||||||
|
|
||||||
while (!st_red.empty())
|
while (!st_red.empty())
|
||||||
{
|
{
|
||||||
stack_item& f = st_red.front();
|
stack_item& f = st_red.front();
|
||||||
|
|
@ -290,30 +301,38 @@ namespace spot
|
||||||
trace << " It is white, pop it" << std::endl;
|
trace << " It is white, pop it" << std::endl;
|
||||||
delete s_prime;
|
delete s_prime;
|
||||||
}
|
}
|
||||||
else if (c_prime.get_color() == CYAN &&
|
else if (c_prime.get_color() == CYAN &&
|
||||||
((current_weight - c_prime.get_weight()) |
|
((current_weight - c_prime.get_weight()) |
|
||||||
c_prime.get_acc() | acu) == all_acc)
|
c_prime.get_acc() | acu) == all_acc)
|
||||||
{
|
{
|
||||||
trace << " It is cyan and acceptance condition "
|
trace << " It is cyan and acceptance condition "
|
||||||
<< "is reached, report cycle" << std::endl;
|
<< "is reached, report cycle" << std::endl;
|
||||||
c_prime.cumulate_acc(acu);
|
c_prime.cumulate_acc(acu);
|
||||||
push(st_red, s_prime, label, acc);
|
push(st_red, s_prime, label, acc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((c_prime.get_acc() & acu) != acu)
|
else if ((c_prime.get_acc() & acu) != acu)
|
||||||
{
|
{
|
||||||
trace << " It is cyan or blue and propagation "
|
trace << " It is cyan or blue and propagation "
|
||||||
<< "is needed, go down"
|
<< "is needed, go down"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
c_prime.cumulate_acc(acu);
|
c_prime.cumulate_acc(acu);
|
||||||
push(st_red, s_prime, label, acc);
|
push(st_red, s_prime, label, acc);
|
||||||
}
|
if (use_condition_stack)
|
||||||
else
|
{
|
||||||
{
|
bdd old = acu;
|
||||||
trace << " It is cyan or blue and no propagation "
|
acu = c_prime.get_acc();
|
||||||
<< "is needed , pop it" << std::endl;
|
condition_stack.push(cond_level(acu - old, depth));
|
||||||
h.pop_notify(s_prime);
|
inc_depth();
|
||||||
}
|
}
|
||||||
|
++depth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace << " It is cyan or blue and no propagation "
|
||||||
|
<< "is needed , pop it" << std::endl;
|
||||||
|
h.pop_notify(s_prime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // Backtrack
|
else // Backtrack
|
||||||
{
|
{
|
||||||
|
|
@ -321,8 +340,21 @@ namespace spot
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
h.pop_notify(f.s);
|
h.pop_notify(f.s);
|
||||||
pop(st_red);
|
pop(st_red);
|
||||||
|
--depth;
|
||||||
|
if (use_condition_stack)
|
||||||
|
{
|
||||||
|
while (!condition_stack.empty()
|
||||||
|
&& condition_stack.top().second == depth)
|
||||||
|
{
|
||||||
|
acu -= condition_stack.top().first;
|
||||||
|
condition_stack.pop();
|
||||||
|
dec_depth();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(depth == 0);
|
||||||
|
assert(condition_stack.empty());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ const char* default_algos[] = {
|
||||||
"SE05(bsh=4K)",
|
"SE05(bsh=4K)",
|
||||||
"Tau03",
|
"Tau03",
|
||||||
"Tau03_opt",
|
"Tau03_opt",
|
||||||
|
"Tau03_opt(condstack)",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue