postproc: add the possibility to output a monitor
* src/tgbaalgos/stripacc.cc, src/tgbaalgos/stripacc.hh: New files. * src/tgbaalgos/Makefile.am: Add them. * src/tgbaalgos/postproc.cc, src/tgbaalgos/postproc.hh: Add a Monitor output option. * src/bin/ltl2tgba.cc: Add a --monitor/-M option. * NEWS: Mention monitors. * src/tgba/tgbaexplicit.hh (is_accepting_state): Fix for the case where the automaton has no acceptance set.
This commit is contained in:
parent
5f6c262ae5
commit
76787b23c0
8 changed files with 169 additions and 15 deletions
|
|
@ -63,6 +63,7 @@ tgbaalgos_HEADERS = \
|
|||
se05.hh \
|
||||
simulation.hh \
|
||||
stats.hh \
|
||||
stripacc.hh \
|
||||
tau03.hh \
|
||||
tau03opt.hh \
|
||||
reductgba_sim.hh \
|
||||
|
|
@ -105,6 +106,7 @@ libtgbaalgos_la_SOURCES = \
|
|||
se05.cc \
|
||||
simulation.cc \
|
||||
stats.cc \
|
||||
stripacc.cc \
|
||||
tau03.cc \
|
||||
tau03opt.cc \
|
||||
reductgba_sim.cc \
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "sccfilter.hh"
|
||||
#include "degen.hh"
|
||||
#include "stats.hh"
|
||||
#include "stripacc.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -46,6 +47,49 @@ namespace spot
|
|||
a = s;
|
||||
}
|
||||
|
||||
if (type_ == Monitor)
|
||||
{
|
||||
if (pref_ == Deterministic)
|
||||
{
|
||||
const tgba* m = minimize_monitor(a);
|
||||
delete a;
|
||||
return m;
|
||||
}
|
||||
else
|
||||
{
|
||||
const tgba* m = strip_acceptance(a);
|
||||
delete a;
|
||||
a = m;
|
||||
}
|
||||
if (pref_ == Any)
|
||||
return a;
|
||||
|
||||
const tgba* sim;
|
||||
if (level_ == Low)
|
||||
sim = simulation(a);
|
||||
else
|
||||
sim = iterated_simulations(a);
|
||||
if (level_ != High)
|
||||
{
|
||||
delete a;
|
||||
return sim;
|
||||
}
|
||||
// For Small,High we return the smallest between the output of
|
||||
// the simulation, and that of the deterministic minimization.
|
||||
const tgba* m = minimize_monitor(a);
|
||||
delete a;
|
||||
if (count_states(m) > count_states(sim))
|
||||
{
|
||||
delete m;
|
||||
return sim;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete sim;
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
if (pref_ == Any)
|
||||
{
|
||||
if (type_ == BA)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ namespace spot
|
|||
/// \addtogroup tgba_reduction
|
||||
/// @{
|
||||
|
||||
/// \brief Wrap TGBA/BA post-processing algorithms in an easy interface.
|
||||
/// \brief Wrap TGBA/BA/Monitor post-processing algorithms in an
|
||||
/// easy interface.
|
||||
///
|
||||
/// This class is a shell around scc_filter(),
|
||||
/// minimize_obligation(), simulation(), iterated_simulations(), and
|
||||
|
|
@ -61,7 +62,7 @@ namespace spot
|
|||
{
|
||||
}
|
||||
|
||||
enum output_type { TGBA, BA };
|
||||
enum output_type { TGBA, BA, Monitor };
|
||||
void
|
||||
set_type(output_type type)
|
||||
{
|
||||
|
|
|
|||
63
src/tgbaalgos/stripacc.cc
Normal file
63
src/tgbaalgos/stripacc.cc
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2012 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
//
|
||||
// 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 "stripacc.hh"
|
||||
#include "reachiter.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace
|
||||
{
|
||||
class strip_iter: public tgba_reachable_iterator_depth_first
|
||||
{
|
||||
public:
|
||||
strip_iter(const tgba* a)
|
||||
: tgba_reachable_iterator_depth_first(a),
|
||||
out_(new sba_explicit_number(a->get_dict()))
|
||||
{
|
||||
}
|
||||
|
||||
sba_explicit_number*
|
||||
result()
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
|
||||
void
|
||||
process_link(const state*, int in,
|
||||
const state*, int out,
|
||||
const tgba_succ_iterator* si)
|
||||
{
|
||||
state_explicit_number::transition* t = out_->create_transition(in, out);
|
||||
out_->add_conditions(t, si->current_condition());
|
||||
}
|
||||
|
||||
private:
|
||||
sba_explicit_number* out_;
|
||||
};
|
||||
}
|
||||
|
||||
sba_explicit_number*
|
||||
strip_acceptance(const tgba* a)
|
||||
{
|
||||
strip_iter si(a);
|
||||
si.run();
|
||||
return si.result();
|
||||
}
|
||||
}
|
||||
34
src/tgbaalgos/stripacc.hh
Normal file
34
src/tgbaalgos/stripacc.hh
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2012 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
//
|
||||
// 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_STRIPACC_HH
|
||||
# define SPOT_TGBAALGOS_STRIPACC_HH
|
||||
|
||||
# include "tgba/tgbaexplicit.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
/// \brief Duplicate automaton \a a, removing all acceptance sets.
|
||||
///
|
||||
/// This is equivalent to marking all states/transitions as accepting.
|
||||
/// \ingroup tgba_misc
|
||||
sba_explicit_number* strip_acceptance(const tgba* a);
|
||||
}
|
||||
|
||||
#endif // SPOT_TGBAALGOS_STRIPACC_HH
|
||||
Loading…
Add table
Add a link
Reference in a new issue