emptiness: Upgrade to tgba_digraph.
* src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh: Use tgba_digraph instead of tgba_explicit_string.
This commit is contained in:
parent
97e3eb7655
commit
ee087b5996
2 changed files with 23 additions and 42 deletions
|
|
@ -24,7 +24,6 @@
|
||||||
#include "emptiness.hh"
|
#include "emptiness.hh"
|
||||||
#include "tgba/tgba.hh"
|
#include "tgba/tgba.hh"
|
||||||
#include "tgba/bddprint.hh"
|
#include "tgba/bddprint.hh"
|
||||||
#include "tgba/tgbaexplicit.hh"
|
|
||||||
#include "tgbaalgos/gtec/gtec.hh"
|
#include "tgbaalgos/gtec/gtec.hh"
|
||||||
#include "tgbaalgos/gv04.hh"
|
#include "tgbaalgos/gv04.hh"
|
||||||
#include "tgbaalgos/magic.hh"
|
#include "tgbaalgos/magic.hh"
|
||||||
|
|
@ -283,30 +282,21 @@ namespace spot
|
||||||
// tgba_run_to_tgba
|
// tgba_run_to_tgba
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace
|
tgba_digraph*
|
||||||
{
|
|
||||||
std::string format_state(const tgba* a, const state* s, int n)
|
|
||||||
{
|
|
||||||
std::ostringstream os;
|
|
||||||
os << a->format_state(s) << " (" << n << ')';
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tgba*
|
|
||||||
tgba_run_to_tgba(const tgba* a, const tgba_run* run)
|
tgba_run_to_tgba(const tgba* a, const tgba_run* run)
|
||||||
{
|
{
|
||||||
tgba_explicit_string* res = new tgba_explicit_string(a->get_dict());
|
auto d = a->get_dict();
|
||||||
res->copy_acceptance_conditions_of(a);
|
auto res = new tgba_digraph(d);
|
||||||
|
auto& g = res->get_graph();
|
||||||
|
d->register_all_variables_of(a, res);
|
||||||
|
|
||||||
const state* s = a->get_init_state();
|
const state* s = a->get_init_state();
|
||||||
int number = 1;
|
unsigned src;
|
||||||
state_explicit_string* source;
|
unsigned dst;
|
||||||
state_explicit_string* dest;
|
|
||||||
const tgba_run::steps* l;
|
const tgba_run::steps* l;
|
||||||
bdd seen_acc = bddfalse;
|
bdd seen_acc = bddfalse;
|
||||||
|
|
||||||
typedef std::unordered_map<const state*, state_explicit_string*,
|
typedef std::unordered_map<const state*, unsigned,
|
||||||
state_ptr_hash, state_ptr_equal> state_map;
|
state_ptr_hash, state_ptr_equal> state_map;
|
||||||
state_map seen;
|
state_map seen;
|
||||||
|
|
||||||
|
|
@ -318,9 +308,8 @@ namespace spot
|
||||||
tgba_run::steps::const_iterator i = l->begin();
|
tgba_run::steps::const_iterator i = l->begin();
|
||||||
|
|
||||||
assert(s->compare(i->s) == 0);
|
assert(s->compare(i->s) == 0);
|
||||||
source = res->set_init_state(format_state(a, i->s, number));
|
src = g.new_state();
|
||||||
++number;
|
seen.insert(std::make_pair(i->s, src));
|
||||||
seen.insert(std::make_pair(i->s, source));
|
|
||||||
|
|
||||||
for (; i != l->end();)
|
for (; i != l->end();)
|
||||||
{
|
{
|
||||||
|
|
@ -366,32 +355,23 @@ namespace spot
|
||||||
s->destroy();
|
s->destroy();
|
||||||
s = the_next;
|
s = the_next;
|
||||||
|
|
||||||
state_map::const_iterator its = seen.find(next);
|
|
||||||
if (its == seen.end())
|
|
||||||
{
|
|
||||||
dest = res->add_state(format_state(a, next, number));
|
|
||||||
++number;
|
|
||||||
seen.insert(std::make_pair(next, dest));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dest = its->second;
|
|
||||||
|
|
||||||
state_explicit_string::transition* t =
|
auto p = seen.insert(std::make_pair(next, 0));
|
||||||
res->create_transition(source, dest);
|
if (p.second)
|
||||||
res->add_conditions(t, label);
|
p.first->second = g.new_state();
|
||||||
res->add_acceptance_conditions(t, acc);
|
dst = p.first->second;
|
||||||
source = dest;
|
|
||||||
|
g.new_transition(src, dst, label, acc);
|
||||||
|
src = dst;
|
||||||
|
|
||||||
// Sum acceptance conditions.
|
// Sum acceptance conditions.
|
||||||
if (l == &run->cycle && i != l->begin())
|
if (l == &run->cycle && i != l->begin())
|
||||||
seen_acc |= acc;
|
seen_acc |= acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->destroy();
|
s->destroy();
|
||||||
|
|
||||||
assert(seen_acc == a->all_acceptance_conditions());
|
assert(seen_acc == a->all_acceptance_conditions());
|
||||||
|
|
||||||
res->merge_transitions();
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
|
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
|
||||||
// de l'Epita (LRDE).
|
// Developpement de l'Epita (LRDE).
|
||||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include <bdd.h>
|
#include <bdd.h>
|
||||||
#include "misc/optionmap.hh"
|
#include "misc/optionmap.hh"
|
||||||
#include "tgba/state.hh"
|
#include "tgba/state.hh"
|
||||||
|
#include "tgba/tgbagraph.hh"
|
||||||
#include "emptiness_stats.hh"
|
#include "emptiness_stats.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
|
|
@ -293,7 +294,7 @@ namespace spot
|
||||||
/// states are merged).
|
/// states are merged).
|
||||||
///
|
///
|
||||||
/// \pre \a run must correspond to an actual run of the automaton \a a.
|
/// \pre \a run must correspond to an actual run of the automaton \a a.
|
||||||
SPOT_API tgba*
|
SPOT_API tgba_digraph*
|
||||||
tgba_run_to_tgba(const tgba* a, const tgba_run* run);
|
tgba_run_to_tgba(const tgba* a, const tgba_run* run);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue