Remove the old broken game-theory-based simulation reductions.

This implementation of direct simulation was only working on
degeneralized automata, and produce automata that are inferiors to
those output by the new direct simulation implementation (in
tgba/simulation.hh) which can also work on TGBA.  The delayed
simulation has never been reliable.  It's time for some spring
cleaning.

* src/tgba/tgbareduc.hh, src/tgba/tgbareduc.cc: Delete.
* src/tgba/Makefile.am: Adjust.
* src/tgbaalgos/reductgba_sim.cc, src/tgbaalgos/reductgba_sim.hh:
Remove all code, and keep only a deprecated replacement
from reduc_tgba_sim().
* src/tgbaalgos/reductgba_sim_del.cc: Delete.
* src/tgbaalgos/Makefile.am: Adjust.
* src/tgbatest/reduccmp.test, src/tgbatest/reductgba.cc,
src/tgbatest/reductgba.test: Delete.
* src/tgbatest/Makefile.am: Adjust.
* src/tgbatest/ltl2tgba.cc: Undocument options -R1s, -R1t,
-R2s, -R2t, and implement them using the new direct simulation.
Remove options -Rd and -RD.
* src/tgbatest/spotlbtt.test: Remove entry using these old options.
* wrap/python/spot.i: Do not process tgbaalgos/reductgba_sim.cc.
This commit is contained in:
Alexandre Duret-Lutz 2012-04-27 17:11:53 +02:00
parent 7ba4ab7931
commit 7e5875845a
14 changed files with 69 additions and 2713 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -25,14 +25,9 @@
#ifndef SPOT_TGBAALGOS_REDUCTGBA_SIM_HH
#define SPOT_TGBAALGOS_REDUCTGBA_SIM_HH
#include "tgba/tgbareduc.hh"
#include "tgbaalgos/reachiter.hh"
#include <vector>
#include <list>
#include <sstream>
namespace spot
{
class tgba;
/// \addtogroup tgba_reduction
/// @{
@ -62,280 +57,34 @@ namespace spot
#endif
};
/// \brief Remove some node of the automata using a simulation
/// relation.
#if __GNUC__
/// \brief Simplify the automaton using a simulation relation.
///
/// \param a the automata to reduce.
/// Do not use this obsolete function.
///
/// \param a the automata to reduce
/// \param opt a conjonction of spot::reduce_tgba_options specifying
/// which optimizations to apply.
/// \return the reduced automata.
/// which optimizations to apply. Actually any
/// simulation-related flag will cause direct simulation
/// to be applied.
/// \return the reduced automaton
/// \deprecated Use scc_filter(), minimize_wdba(), or simulation().
const tgba* reduc_tgba_sim(const tgba* a, int opt = Reduce_All)
__attribute__ ((deprecated));
#else
/// \brief Simplify the automaton using a simulation relation.
///
/// Do not use this obsolete function.
///
/// \param a the automata to reduce
/// \param opt a conjonction of spot::reduce_tgba_options specifying
/// which optimizations to apply. Actually any
/// simulation-related flag will cause direct simulation
/// to be applied.
/// \return the reduced automaton
/// \deprecated Use scc_filter(), minimize_wdba(), or simulation().
const tgba* reduc_tgba_sim(const tgba* a, int opt = Reduce_All);
#ifndef SWIG
/// \brief Compute a direct simulation relation on state of tgba \a f.
direct_simulation_relation* get_direct_relation_simulation(const tgba* a,
std::ostream& os,
int opt = -1);
/// Compute a delayed simulation relation on state of tgba \a f.
/// \bug Does not work for generalized automata.
delayed_simulation_relation* get_delayed_relation_simulation(const tgba* a,
std::ostream& os,
int opt = -1);
/// To free a simulation relation.
void free_relation_simulation(direct_simulation_relation* rel);
/// To free a simulation relation.
void free_relation_simulation(delayed_simulation_relation* rel);
///////////////////////////////////////////////////////////////////////
// simulation.
class spoiler_node;
class duplicator_node;
typedef std::vector<spoiler_node*> sn_v;
typedef std::vector<duplicator_node*> dn_v;
typedef std::vector<const state*> s_v;
/// \brief Parity game graph which compute a simulation relation.
class parity_game_graph : public tgba_reachable_iterator_breadth_first
{
public:
parity_game_graph(const tgba* a);
virtual ~parity_game_graph();
virtual simulation_relation* get_relation() = 0;
void print(std::ostream& os);
protected:
sn_v spoiler_vertice_;
dn_v duplicator_vertice_;
s_v tgba_state_;
int nb_node_parity_game;
void process_state(const state* s, int n, tgba_succ_iterator* si);
/// \brief Compute each node of the graph.
virtual void build_graph() = 0;
/// \brief Remove edge from spoiler to duplicator that make
/// duplicator loose.
/// Spoiler node whose still have some link, reveal
/// a direct simulation relation.
virtual void lift() = 0;
};
///////////////////////////////////////////////////////////////////////
// Direct simulation.
/// Spoiler node of parity game graph.
class spoiler_node
{
public:
spoiler_node(const state* d_node,
const state* s_node,
int num);
virtual ~spoiler_node();
/// \brief Add a successor.
/// Return true if \a n wasn't yet in the list of successor,
/// false eitherwise.
bool add_succ(spoiler_node* n);
void del_succ(spoiler_node* n);
virtual void add_pred(spoiler_node* n);
virtual void del_pred();
int get_nb_succ();
bool prune();
virtual bool set_win();
virtual std::string to_string(const tgba* a);
virtual std::string succ_to_string();
virtual bool compare(spoiler_node* n);
const state* get_spoiler_node();
const state* get_duplicator_node();
state_couple* get_pair();
bool not_win;
int num_; // for the dot display.
protected:
sn_v* lnode_succ;
sn_v* lnode_pred;
state_couple* sc_;
};
/// Duplicator node of parity game graph.
class duplicator_node : public spoiler_node
{
public:
duplicator_node(const state* d_node,
const state* s_node,
bdd l,
bdd a,
int num);
virtual ~duplicator_node();
virtual bool set_win();
virtual std::string to_string(const tgba* a);
virtual bool compare(spoiler_node* n);
bool match(bdd l, bdd a);
bool implies(bdd l, bdd a);
bdd get_label() const;
bdd get_acc() const;
protected:
bdd label_;
bdd acc_;
};
/// Parity game graph which compute the direct simulation relation.
class parity_game_graph_direct : public parity_game_graph
{
public:
parity_game_graph_direct(const tgba* a);
~parity_game_graph_direct();
virtual direct_simulation_relation* get_relation();
protected:
virtual void build_graph();
virtual void lift();
void build_link();
};
///////////////////////////////////////////////////////////////////////
// Delayed simulation.
/// Spoiler node of parity game graph for delayed simulation.
class spoiler_node_delayed : public spoiler_node
{
public:
spoiler_node_delayed(const state* d_node,
const state* s_node,
bdd a,
int num);
~spoiler_node_delayed();
/// Return true if the progress_measure has changed.
bool set_win();
bdd get_acceptance_condition_visited() const;
virtual bool compare(spoiler_node* n);
virtual std::string to_string(const tgba* a);
int get_progress_measure() const;
bool get_lead_2_acc_all();
bool set_lead_2_acc_all(bdd acc = bddfalse);
//
bool seen_;
protected:
/// a Bdd for retain all the acceptance condition
/// that a node has visited.
bdd acceptance_condition_visited_;
int progress_measure_;
bool lead_2_acc_all_;
};
/// Duplicator node of parity game graph for delayed simulation.
class duplicator_node_delayed : public duplicator_node
{
public:
duplicator_node_delayed(const state* d_node,
const state* s_node,
bdd l,
bdd a,
int num);
~duplicator_node_delayed();
/// Return true if the progress_measure has changed.
bool set_win();
virtual std::string to_string(const tgba* a);
bool implies_label(bdd l);
bool implies_acc(bdd a);
int get_progress_measure();
bool get_lead_2_acc_all();
bool set_lead_2_acc_all(bdd acc = bddfalse);
//
bool seen_;
protected:
int progress_measure_;
bool lead_2_acc_all_;
};
/// Parity game graph which computes the delayed simulation relation
/// as explained in
/// \verbatim
/// @InProceedings{etessami.01.alp,
/// author = {Kousha Etessami and Thomas Wilke and Rebecca A. Schuller},
/// title = {Fair Simulation Relations, Parity Games, and State Space
/// Reduction for Buchi Automata},
/// booktitle = {Proceedings of the 28th international colloquium on
/// Automata, Languages and Programming},
/// pages = {694--707},
/// year = {2001},
/// editor = {Fernando Orejas and Paul G. Spirakis and Jan van Leeuwen},
/// volume = {2076},
/// series = {Lecture Notes in Computer Science},
/// address = {Crete, Greece},
/// month = {July},
/// publisher = {Springer-Verlag}
/// }
/// \endverbatim
class parity_game_graph_delayed: public parity_game_graph
{
public:
parity_game_graph_delayed(const tgba* a);
~parity_game_graph_delayed();
virtual delayed_simulation_relation* get_relation();
private:
/// Vector which contain all the sub-set of the set
/// of acceptance condition.
typedef std::vector<bdd> bdd_v;
bdd_v sub_set_acc_cond_;
/// Return the number of acceptance condition.
int nb_set_acc_cond();
///
duplicator_node_delayed* add_duplicator_node_delayed(const spot::state* sn,
const spot::state* dn,
bdd acc,
bdd label,
int nb);
///
spoiler_node_delayed* add_spoiler_node_delayed(const spot::state* sn,
const spot::state* dn,
bdd acc,
int nb);
void build_recurse_successor_spoiler(spoiler_node* sn,
std::ostringstream& os);
void build_recurse_successor_duplicator(duplicator_node* dn,
spoiler_node* sn,
std::ostringstream& os);
/// \brief Compute the couple as for direct simulation,
virtual void build_graph();
/// \brief The Jurdzinski's lifting algorithm.
virtual void lift();
};
#endif // SWIG
#endif
/// @}
}