Back out all Thomas's changes on emptiness checks since

2004-08-23.  Some of these will need to be reintegrated more
slowly and cleanly.

* src/tgbaalgos/Makefile.am, src/tgbaalgos/gtec/ce.cc,
src/tgbaalgos/gtec/ce.hh, src/tgbatest/Makefile.am,
src/tgbatest/emptchk.test, src/tgbatest/ltl2tgba.cc: Revert.
* src/tgbaalgos/colordfs.cc, src/tgbaalgos/colordfs.hh,
src/tgbaalgos/minimalce.cc, src/tgbaalgos/minimalce.hh,
src/tgbaalgos/nesteddfs.cc, src/tgbaalgos/nesteddfs.hh,
src/tgbaalgos/nesteddfsgen.cc, src/tgbaalgos/nesteddfsgen.hh,
src/tgbaalgos/tarjan_on_fly.cc, src/tgbaalgos/tarjan_on_fly.hh:
Delete.
This commit is contained in:
Alexandre Duret-Lutz 2004-10-15 10:33:55 +00:00
parent 01987350b7
commit ed6db92642
17 changed files with 48 additions and 3492 deletions

View file

@ -35,11 +35,6 @@ namespace spot
eccf)
: ecs_(ecs)
{
std::cout << "counter_example" << std::endl;
//counter_ = new ce::counter_example(ecs->aut);
assert(!ecs_->root.empty());
assert(suffix.empty());
@ -81,10 +76,6 @@ namespace spot
assert(spi.first);
suffix.push_front(spi.first);
/////
// counter_->prefix.push_front(ce::state_ce(spi.first->clone(), bddfalse));
////
// We build a path trough each SCC in the stack. For the
// first SCC, the starting state is the initial state of the
// automaton. The destination state is the closest state
@ -122,36 +113,21 @@ namespace spot
const state* h_dest = scc[k]->has_state(dest);
if (!h_dest)
{
// If we have found a state in greater SCC which.
// If we have found a state in the next SCC.
// Unwind the path and populate SUFFIX.
h_dest = scc[k+1]->has_state(dest);
if (h_dest)
{
state_sequence seq;
///
// ce::l_state_ce seq_count;
///
seq.push_front(h_dest);
while (src->compare(start))
{
///
// seq_count.push_front(ce::state_ce(src->clone(),
// bddfalse));
///
seq.push_front(src);
src = father[src];
}
// Append SEQ to SUFFIX.
suffix.splice(suffix.end(), seq);
///
// counter_->prefix.splice(counter_->prefix.end(),
// seq_count);
///
// Exit this BFS for this SCC.
while (!todo.empty())
{
@ -190,8 +166,6 @@ namespace spot
const state* from,
const state* to)
{
//std::cout << "complete_cycle" << std::endl;
// If by change or period already ends on the state we have
// to reach back, we are done.
if (from == to
@ -237,28 +211,14 @@ namespace spot
if (h_dest == to)
{
cycle_path p;
///
// ce::l_state_ce p_counter;
// p_counter.push_front(ce::state_ce(h_dest->clone(), cond));
///
p.push_front(state_proposition(h_dest, cond));
while (src != from)
{
const state_proposition& psi = father[src];
///
// p_counter.push_front(ce::state_ce(src->clone(),
// psi.second));
///
p.push_front(state_proposition(src, psi.second));
src = psi.first;
}
period.splice(period.end(), p);
///
// counter_->cycle.splice(counter_->cycle.end(),
// p_counter);
///
// Exit the BFS, but release all iterators first.
while (!todo.empty())
@ -296,9 +256,6 @@ namespace spot
}
////////////////////////////////////////////////////////////////////////
/*
void
counter_example::accepting_path(const explicit_connected_component* scc,
const state* start, bdd acc_to_traverse)
@ -338,9 +295,9 @@ namespace spot
todo.pop();
delete iter;
seen.erase(s);
if (!todo.empty())
if (todo.size())
{
assert(!path.empty());
assert(path.size());
path.pop_back();
}
continue;
@ -377,7 +334,7 @@ namespace spot
// If we already have a best path, let see if the current
// one is better.
if (!best_path.empty())
if (best_path.size())
{
// When comparing the merits of two paths, only the
// acceptance conditions we are trying the traverse
@ -423,12 +380,7 @@ namespace spot
// Append our best path to the period.
for (cycle_path::iterator it = best_path.begin();
it != best_path.end(); ++it)
{
period.push_back(*it);
ce::state_ce ce(it->first, it->second);
counter_->cycle.push_back(ce);
counter_->cycle.push_back(*it);
}
period.push_back(*it);
// Prepare to find another path for the remaining acceptance
// conditions.
@ -441,161 +393,6 @@ namespace spot
complete_cycle(scc, start, suffix.back());
}
*/
////////////////////////////////////////////////////////////////////////
void
counter_example::accepting_path(const explicit_connected_component* scc,
const state* start, bdd acc_to_traverse)
{
//std::cout << "accepting_path" << std::endl;
// State seen during the DFS.
typedef Sgi::hash_set<const state*,
state_ptr_hash, state_ptr_equal> set_type;
set_type seen;
// DFS stack.
std::stack<triplet> todo;
while (acc_to_traverse != bddfalse)
{
//std::cout << "accepting_path : while (acc_to_traverse != bddfalse)"
// << std::endl;
// Initial state.
{
tgba_succ_iterator* i = ecs_->aut->succ_iter(start);
i->first();
todo.push(triplet(start, i, bddfalse));
seen.insert(start);
}
// The path being explored currently.
cycle_path path;
// The best path seen so far.
cycle_path best_path;
// The acceptance conditions traversed by BEST_PATH.
bdd best_acc = bddfalse;
while (!todo.empty())
{
// std::cout << "accepting_path : while (!todo.empty())"
// << std::endl;
tgba_succ_iterator* iter = todo.top().iter;
const state* s = todo.top().s;
// Nothing more to explore, backtrack.
if (iter->done())
{
todo.pop();
delete iter;
seen.erase(s);
if (!todo.empty())
{
assert(!path.empty());
path.pop_back();
}
continue;
}
// We must not escape the current SCC.
const state* dest = iter->current_state();
const state* h_dest = scc->has_state(dest);
if (!h_dest)
{
delete dest;
iter->next();
continue;
}
bdd acc = iter->current_acceptance_conditions() | todo.top().acc;
path.push_back(state_proposition(h_dest,
iter->current_condition()));
// Advance iterator for next step.
iter->next();
if (seen.find(h_dest) == seen.end())
{
// A new state: continue the DFS.
tgba_succ_iterator* di = ecs_->aut->succ_iter(h_dest);
di->first();
todo.push(triplet(h_dest, di, acc));
seen.insert(h_dest);
continue;
}
// We have completed a full cycle.
// If we already have a best path, let see if the current
// one is better.
if (!best_path.empty())
{
// When comparing the merits of two paths, only the
// acceptance conditions we are trying the traverse
// are important.
bdd acc_restrict = acc & acc_to_traverse;
bdd best_acc_restrict = best_acc & acc_to_traverse;
// If the best path and the current one traverse the
// same acceptance conditions, we keep the shorter
// path. Otherwise, we keep the path which has the
// more acceptance conditions.
if (best_acc_restrict == acc_restrict)
{
if (best_path.size() <= path.size())
goto backtrack_path;
}
else
{
// `best_acc_restrict >> acc_restrict' is true
// when the set of acceptance conditions of
// best_acc_restrict is included in the set of
// acceptance conditions of acc_restrict.
//
// FIXME: It would be better to count the number
// of acceptance conditions.
if (bddtrue != (best_acc_restrict >> acc_restrict))
goto backtrack_path;
}
}
// The current path the best one.
best_path = path;
best_acc = acc;
backtrack_path:
// Continue exploration from parent to find better paths.
// (Do not pop PATH if ITER is done, because that will be
// done at the top of the loop, among other things.)
if (!iter->done())
path.pop_back();
}
// Append our best path to the period.
for (cycle_path::iterator it = best_path.begin();
it != best_path.end(); ++it)
{
period.push_back(*it);
//ce::state_ce ce(it->first->clone(), it->second);
//counter_->cycle.push_back(ce);
//counter_->cycle.push_back(*it);
}
// Prepare to find another path for the remaining acceptance
// conditions.
acc_to_traverse -= best_acc;
start = period.back().first;
}
// Complete the path so that it goes back to its beginning,
// forming a cycle.
complete_cycle(scc, start, suffix.back());
}
/////////////
std::ostream&
counter_example::print_result(std::ostream& os, const tgba* restrict) const
{
@ -647,10 +444,4 @@ namespace spot
os << period.size() << " states in period" << std::endl;
}
ce::counter_example*
counter_example::get_counter_example() const
{
return counter_;
}
}

View file

@ -25,8 +25,6 @@
#include "status.hh"
#include "explscc.hh"
#include "tgbaalgos/minimalce.hh"
namespace spot
{
/// Compute a counter example from a spot::emptiness_check_status
@ -53,8 +51,6 @@ namespace spot
/// Output statistics about this object.
void print_stats(std::ostream& os) const;
ce::counter_example* get_counter_example() const;
protected:
/// Called by counter_example to find a path which traverses all
/// acceptance conditions in the accepted SCC.
@ -68,7 +64,6 @@ namespace spot
private:
const emptiness_check_status* ecs_;
ce::counter_example* counter_;
};
}