complete: new algorithm for TGBAs
* src/tgbaalgos/complete.cc, src/tgbaalgos/complete.hh: New files. * src/tgbaalgos/Makefile.am: Add them.
This commit is contained in:
parent
78e76eb07d
commit
3fd49da159
3 changed files with 156 additions and 4 deletions
|
|
@ -29,13 +29,14 @@ tgbaalgosdir = $(pkgincludedir)/tgbaalgos
|
||||||
|
|
||||||
tgbaalgos_HEADERS = \
|
tgbaalgos_HEADERS = \
|
||||||
bfssteps.hh \
|
bfssteps.hh \
|
||||||
|
complete.hh \
|
||||||
compsusp.hh \
|
compsusp.hh \
|
||||||
cutscc.hh \
|
cutscc.hh \
|
||||||
cycles.hh \
|
cycles.hh \
|
||||||
dbacomp.hh \
|
dbacomp.hh \
|
||||||
degen.hh \
|
degen.hh \
|
||||||
dotty.hh \
|
|
||||||
dottydec.hh \
|
dottydec.hh \
|
||||||
|
dotty.hh \
|
||||||
dupexp.hh \
|
dupexp.hh \
|
||||||
eltl2tgba_lacim.hh \
|
eltl2tgba_lacim.hh \
|
||||||
emptiness.hh \
|
emptiness.hh \
|
||||||
|
|
@ -56,12 +57,13 @@ tgbaalgos_HEADERS = \
|
||||||
randomgraph.hh \
|
randomgraph.hh \
|
||||||
reachiter.hh \
|
reachiter.hh \
|
||||||
reducerun.hh \
|
reducerun.hh \
|
||||||
|
reductgba_sim.hh \
|
||||||
replayrun.hh \
|
replayrun.hh \
|
||||||
rundotdec.hh \
|
rundotdec.hh \
|
||||||
safety.hh \
|
safety.hh \
|
||||||
save.hh \
|
save.hh \
|
||||||
scc.hh \
|
|
||||||
sccfilter.hh \
|
sccfilter.hh \
|
||||||
|
scc.hh \
|
||||||
se05.hh \
|
se05.hh \
|
||||||
simulation.hh \
|
simulation.hh \
|
||||||
stats.hh \
|
stats.hh \
|
||||||
|
|
@ -69,12 +71,12 @@ tgbaalgos_HEADERS = \
|
||||||
tau03.hh \
|
tau03.hh \
|
||||||
tau03opt.hh \
|
tau03opt.hh \
|
||||||
translate.hh \
|
translate.hh \
|
||||||
reductgba_sim.hh \
|
|
||||||
word.hh
|
word.hh
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libtgbaalgos.la
|
noinst_LTLIBRARIES = libtgbaalgos.la
|
||||||
libtgbaalgos_la_SOURCES = \
|
libtgbaalgos_la_SOURCES = \
|
||||||
bfssteps.cc \
|
bfssteps.cc \
|
||||||
|
complete.cc \
|
||||||
compsusp.cc \
|
compsusp.cc \
|
||||||
cutscc.cc \
|
cutscc.cc \
|
||||||
cycles.cc \
|
cycles.cc \
|
||||||
|
|
@ -102,6 +104,7 @@ libtgbaalgos_la_SOURCES = \
|
||||||
randomgraph.cc \
|
randomgraph.cc \
|
||||||
reachiter.cc \
|
reachiter.cc \
|
||||||
reducerun.cc \
|
reducerun.cc \
|
||||||
|
reductgba_sim.cc \
|
||||||
replayrun.cc \
|
replayrun.cc \
|
||||||
rundotdec.cc \
|
rundotdec.cc \
|
||||||
safety.cc \
|
safety.cc \
|
||||||
|
|
@ -115,7 +118,6 @@ libtgbaalgos_la_SOURCES = \
|
||||||
tau03.cc \
|
tau03.cc \
|
||||||
tau03opt.cc \
|
tau03opt.cc \
|
||||||
translate.cc \
|
translate.cc \
|
||||||
reductgba_sim.cc \
|
|
||||||
weight.cc \
|
weight.cc \
|
||||||
weight.hh \
|
weight.hh \
|
||||||
word.cc
|
word.cc
|
||||||
|
|
|
||||||
118
src/tgbaalgos/complete.cc
Normal file
118
src/tgbaalgos/complete.cc
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2013 Laboratoire de Recherche et Développement
|
||||||
|
// de l'Epita.
|
||||||
|
//
|
||||||
|
// This file is part of Spot, a model checking library.
|
||||||
|
//
|
||||||
|
// Spot is free software; you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
// License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "complete.hh"
|
||||||
|
#include "reachiter.hh"
|
||||||
|
#include "ltlast/constant.hh"
|
||||||
|
|
||||||
|
namespace spot
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class tgbacomplete_iter:
|
||||||
|
public tgba_reachable_iterator_depth_first_stack
|
||||||
|
{
|
||||||
|
bdd_dict* dict_;
|
||||||
|
tgba_explicit_number* out_;
|
||||||
|
bdd addacc_;
|
||||||
|
|
||||||
|
typedef state_explicit_number::transition trans;
|
||||||
|
public:
|
||||||
|
tgbacomplete_iter(const tgba* a)
|
||||||
|
: tgba_reachable_iterator_depth_first_stack(a),
|
||||||
|
dict_(a->get_dict()),
|
||||||
|
out_(new tgba_explicit_number(dict_)),
|
||||||
|
addacc_(bddfalse)
|
||||||
|
{
|
||||||
|
dict_->register_all_variables_of(a, out_);
|
||||||
|
|
||||||
|
if (a->number_of_acceptance_conditions() == 0)
|
||||||
|
{
|
||||||
|
const ltl::formula* t = ltl::constant::true_instance();
|
||||||
|
int accvar =
|
||||||
|
dict_->register_acceptance_variable(t, out_);
|
||||||
|
addacc_ = bdd_ithvar(accvar);
|
||||||
|
out_->set_acceptance_conditions(addacc_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out_->set_acceptance_conditions(a->all_acceptance_conditions());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tgba_explicit_number*
|
||||||
|
result()
|
||||||
|
{
|
||||||
|
return out_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
end()
|
||||||
|
{
|
||||||
|
out_->merge_transitions();
|
||||||
|
// create a sink state if needed.
|
||||||
|
if (out_->has_state(0))
|
||||||
|
{
|
||||||
|
trans* t = out_->create_transition(0, 0);
|
||||||
|
t->condition = bddtrue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_state(const state*, int n,
|
||||||
|
tgba_succ_iterator* i)
|
||||||
|
{
|
||||||
|
// add a transition to a sink state if the state is not complete.
|
||||||
|
bdd all = bddtrue;
|
||||||
|
for (i->first(); !i->done(); i->next())
|
||||||
|
all -= i->current_condition();
|
||||||
|
if (all != bddfalse)
|
||||||
|
{
|
||||||
|
trans* t = out_->create_transition(n, 0);
|
||||||
|
t->condition = all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
process_link(const state*, int in,
|
||||||
|
const state*, int out,
|
||||||
|
const tgba_succ_iterator* si)
|
||||||
|
{
|
||||||
|
assert(in > 0);
|
||||||
|
assert(out > 0);
|
||||||
|
trans* t1 = out_->create_transition(in, out);
|
||||||
|
|
||||||
|
t1->condition = si->current_condition();
|
||||||
|
t1->acceptance_conditions =
|
||||||
|
si->current_acceptance_conditions() | addacc_;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // anonymous
|
||||||
|
|
||||||
|
tgba_explicit_number* tgba_complete(const tgba* aut)
|
||||||
|
{
|
||||||
|
tgbacomplete_iter ci(aut);
|
||||||
|
ci.run();
|
||||||
|
return ci.result();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
32
src/tgbaalgos/complete.hh
Normal file
32
src/tgbaalgos/complete.hh
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2013 Laboratoire de Recherche et Développement
|
||||||
|
// de l'Epita.
|
||||||
|
//
|
||||||
|
// This file is part of Spot, a model checking library.
|
||||||
|
//
|
||||||
|
// Spot is free software; you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
// License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef SPOT_TGBAALGOS_COMPLETE_HH
|
||||||
|
# define SPOT_TGBAALGOS_COMPLETE_HH
|
||||||
|
|
||||||
|
#include "tgba/tgbaexplicit.hh"
|
||||||
|
|
||||||
|
namespace spot
|
||||||
|
{
|
||||||
|
/// Complete a TGBA
|
||||||
|
SPOT_API tgba_explicit_number*
|
||||||
|
tgba_complete(const tgba* aut);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SPOT_TGBAALGOS_COMPLETE_HH
|
||||||
Loading…
Add table
Add a link
Reference in a new issue