The computation of the counter example fails the valgrind tests
and is wrong into two ways: the search stack is generally not a path, and does not run until the end of the STL container. Remove it. * src/tgbaalgos/tarjan_on_fly.cc, src/tgbaalgos/tarjan_on_fly.hh (tarjan_on_fly): Do not inherit from the emptiness_search class, because the check method will no longer return a counter example. (tarjan_on_fly::check): Return only a boolean. (tarjan_on_fly::build_counter): Delete. * src/tgbatest/ltl2tgba.cc: Adjust.
This commit is contained in:
parent
ca27267c69
commit
e8e2bec243
4 changed files with 30 additions and 88 deletions
|
|
@ -51,7 +51,7 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
ce::counter_example*
|
||||
bool
|
||||
tarjan_on_fly::check()
|
||||
{
|
||||
tgba_succ_iterator* iter = 0;
|
||||
|
|
@ -96,12 +96,7 @@ namespace spot
|
|||
pop();
|
||||
}
|
||||
|
||||
if (violation)
|
||||
return build_counter();
|
||||
|
||||
//std::cout << "NO COUNTER EXAMPLE FOUND" << std::endl;
|
||||
|
||||
return 0;
|
||||
return violation;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -148,12 +143,6 @@ namespace spot
|
|||
void
|
||||
tarjan_on_fly::pop()
|
||||
{
|
||||
/*
|
||||
const state *s = stack[dftop].s;
|
||||
hash_type::iterator hi = h.find(s);
|
||||
hi->second = -1;
|
||||
*/
|
||||
|
||||
int p = stack[dftop].pre;
|
||||
|
||||
if (p >= 0)
|
||||
|
|
@ -183,14 +172,6 @@ namespace spot
|
|||
{
|
||||
int n = 0;
|
||||
|
||||
/*
|
||||
hash_type::const_iterator hi = h.find(s);
|
||||
if (hi != h.end())
|
||||
n = hi->second;
|
||||
else
|
||||
n = -1;
|
||||
*/
|
||||
|
||||
stack_type::const_iterator i;
|
||||
for (i = stack.begin(); i != stack.end(); ++i, ++n)
|
||||
if (s->compare(i->s) == 0)
|
||||
|
|
@ -202,38 +183,10 @@ namespace spot
|
|||
return n;
|
||||
}
|
||||
|
||||
ce::counter_example*
|
||||
tarjan_on_fly::build_counter()
|
||||
{
|
||||
ce = new ce::counter_example(a);
|
||||
|
||||
stack_type::iterator i;
|
||||
for (i = stack.begin(); i != stack.end(); ++i)
|
||||
{
|
||||
if (x && x->compare(i->s) == 0)
|
||||
break;
|
||||
|
||||
ce->prefix.push_back(ce::state_ce(i->s->clone(),
|
||||
i->lasttr->current_condition()));
|
||||
}
|
||||
|
||||
for (; i != stack.end(); ++i)
|
||||
{
|
||||
ce->cycle.push_back(ce::state_ce(i->s->clone(),
|
||||
i->lasttr->current_condition()));
|
||||
}
|
||||
|
||||
return ce;
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
tarjan_on_fly::print_stat(std::ostream& os) const
|
||||
{
|
||||
int ce_size = 0;
|
||||
if (ce)
|
||||
ce_size = ce->size();
|
||||
os << "Size of Counter Example : " << ce_size << std::endl
|
||||
<< "States explored : " << h.size() << std::endl;
|
||||
os << "States explored : " << h.size() << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,13 +27,11 @@
|
|||
#include <utility>
|
||||
#include <ostream>
|
||||
#include "tgba/tgbatba.hh"
|
||||
//#include "tgba/bddprint.hh"
|
||||
#include "tgbaalgos/minimalce.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
class tarjan_on_fly: public emptiness_search
|
||||
class tarjan_on_fly
|
||||
{
|
||||
|
||||
public:
|
||||
|
|
@ -41,8 +39,8 @@ namespace spot
|
|||
tarjan_on_fly(const tgba_tba_proxy *a);
|
||||
virtual ~tarjan_on_fly();
|
||||
|
||||
/// \brief Find a counter example.
|
||||
virtual ce::counter_example* check();
|
||||
/// \brief Return true if there exits an accepting path.
|
||||
bool check();
|
||||
|
||||
/// \brief Print Stat.
|
||||
std::ostream& print_stat(std::ostream& os) const;
|
||||
|
|
@ -56,8 +54,6 @@ namespace spot
|
|||
int lowlink;
|
||||
int pre;
|
||||
int acc;
|
||||
|
||||
//int pos;
|
||||
};
|
||||
|
||||
//typedef std::pair<int, tgba_succ_iterator*> state_iter_pair;
|
||||
|
|
@ -65,8 +61,6 @@ namespace spot
|
|||
state_ptr_hash, state_ptr_equal> hash_type;
|
||||
hash_type h; ///< Map of visited states.
|
||||
|
||||
|
||||
//typedef std::pair<const state*, struct_state> pair_type;
|
||||
typedef std::vector<struct_state> stack_type;
|
||||
stack_type stack; ///< Stack of visited states on the path.
|
||||
|
||||
|
|
@ -77,16 +71,11 @@ namespace spot
|
|||
bool violation;
|
||||
|
||||
const state* x;
|
||||
ce::counter_example* ce;
|
||||
|
||||
void push(const state* s);
|
||||
void pop();
|
||||
void lowlinkupdate(int f, int t);
|
||||
int in_stack(const state* s) const;
|
||||
|
||||
ce::counter_example* build_counter();
|
||||
//clock_t tps_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue