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

@ -43,8 +43,6 @@ check_PROGRAMS = \
ltlprod \
mixprod \
powerset \
reductgba \
reduccmp \
taatgba \
tgbaread \
tripprod
@ -65,9 +63,6 @@ ltlprod_SOURCES = ltlprod.cc
mixprod_SOURCES = mixprod.cc
powerset_SOURCES = powerset.cc
randtgba_SOURCES = randtgba.cc
reductgba_SOURCES = reductgba.cc
reduccmp_SOURCES = reductgba.cc
reduccmp_CXXFLAGS = -DREDUCCMP
taatgba_SOURCES = taatgba.cc
tgbaread_SOURCES = tgbaread.cc
tripprod_SOURCES = tripprod.cc
@ -97,8 +92,6 @@ TESTS = \
degendet.test \
degenid.test \
kv.test \
reduccmp.test \
reductgba.test \
scc.test \
sccsimpl.test \
obligation.test \

View file

@ -1,8 +1,9 @@
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005, 2006, 2007 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis
// Coopératifs (SRC), Université Pierre et Marie Curie.
// Paris 6 (LIP6), département Systèmes Répartis
// Coopératifs (SRC), Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -49,7 +50,6 @@
#include "tgbaalgos/dupexp.hh"
#include "tgbaalgos/minimize.hh"
#include "tgbaalgos/neverclaim.hh"
#include "tgbaalgos/reductgba_sim.hh"
#include "tgbaalgos/replayrun.hh"
#include "tgbaalgos/rundotdec.hh"
#include "tgbaalgos/sccfilter.hh"
@ -196,22 +196,11 @@ syntax(char* prog)
<< "Automaton simplifications (after translation):"
<< std::endl
<< " -R1q merge states using direct simulation "
<< "(use -L for more reduction)"
<< std::endl
<< " -R1t remove transitions using direct simulation "
<< "(use -L for more reduction)"
<< std::endl
<< " -R2q merge states using delayed simulation" << std::endl
<< " -R2t remove transitions using delayed simulation"
<< std::endl
<< " -R3 use SCC to reduce the automata" << std::endl
<< " -R3f clean more acceptance conditions than -R3" << std::endl
<< " "
<< "(prefer -R3 over -R3f if you degeneralize with -D, -DS, or -N)"
<< std::endl
<< " -Rd display the simulation relation" << std::endl
<< " -RD display the parity game (dot format)" << std::endl
<< " -Rm attempt to minimize the automata" << std::endl
<< std::endl
@ -314,13 +303,11 @@ main(int argc, char** argv)
bool accepting_run_replay = false;
bool from_file = false;
bool read_neverclaim = false;
int reduc_aut = spot::Reduce_None;
int redopt = spot::ltl::Reduce_None;
bool scc_filter = false;
bool scc_filter_all = false;
bool symbolic_scc_pruning = false;
bool display_reduce_form = false;
bool display_rel_sim = false;
bool display_parity_game = false;
bool post_branching = false;
bool fair_loop_approx = false;
bool graph_run_opt = false;
@ -621,33 +608,22 @@ main(int argc, char** argv)
{
output = 3;
}
else if (!strcmp(argv[formula_index], "-R1q"))
else if (!strcmp(argv[formula_index], "-R1q")
|| !strcmp(argv[formula_index], "-R1t")
|| !strcmp(argv[formula_index], "-R2q")
|| !strcmp(argv[formula_index], "-R2t"))
{
reduc_aut |= spot::Reduce_quotient_Dir_Sim;
}
else if (!strcmp(argv[formula_index], "-RSD"))
{
reduction_dir_sim = true;
}
else if (!strcmp(argv[formula_index], "-R1t"))
{
reduc_aut |= spot::Reduce_transition_Dir_Sim;
}
else if (!strcmp(argv[formula_index], "-R2q"))
{
reduc_aut |= spot::Reduce_quotient_Del_Sim;
}
else if (!strcmp(argv[formula_index], "-R2t"))
{
reduc_aut |= spot::Reduce_transition_Del_Sim;
// For backward compatibility, make all these options
// equal to -RSD.
reduction_dir_sim = true;
}
else if (!strcmp(argv[formula_index], "-R3"))
{
reduc_aut |= spot::Reduce_Scc;
scc_filter = true;
}
else if (!strcmp(argv[formula_index], "-R3f"))
{
reduc_aut |= spot::Reduce_Scc;
scc_filter = true;
scc_filter_all = true;
}
else if (!strcmp(argv[formula_index], "-R3b"))
@ -658,18 +634,14 @@ main(int argc, char** argv)
{
display_reduce_form = true;
}
else if (!strcmp(argv[formula_index], "-Rd"))
{
display_rel_sim = true;
}
else if (!strcmp(argv[formula_index], "-RD"))
{
display_parity_game = true;
}
else if (!strcmp(argv[formula_index], "-Rm"))
{
opt_minimize = true;
}
else if (!strcmp(argv[formula_index], "-RSD"))
{
reduction_dir_sim = true;
}
else if (!strcmp(argv[formula_index], "-M"))
{
opt_monitor = true;
@ -898,12 +870,12 @@ main(int argc, char** argv)
to_free = a;
}
if (opt_monitor && ((reduc_aut & spot::Reduce_Scc) == 0))
if (opt_monitor && !scc_filter)
{
if (dynamic_cast<const spot::tgba_bdd_concrete*>(a))
symbolic_scc_pruning = true;
else
reduc_aut |= spot::Reduce_Scc;
scc_filter = true;
}
if (symbolic_scc_pruning)
@ -932,7 +904,7 @@ main(int argc, char** argv)
// Remove dead SCCs and useless acceptance conditions before
// degeneralization.
const spot::tgba* aut_scc = 0;
if (reduc_aut & spot::Reduce_Scc)
if (scc_filter)
{
tm.start("reducing A_f w/ SCC");
a = aut_scc = spot::scc_filter(a, scc_filter_all);
@ -1019,67 +991,6 @@ main(int argc, char** argv)
// pointless.
}
spot::tgba_reduc* aut_red = 0;
if (reduc_aut != spot::Reduce_None)
{
if (reduc_aut & ~spot::Reduce_Scc)
{
tm.start("reducing A_f w/ sim.");
a = aut_red = new spot::tgba_reduc(a);
if (reduc_aut & (spot::Reduce_quotient_Dir_Sim |
spot::Reduce_transition_Dir_Sim |
spot::Reduce_quotient_Del_Sim |
spot::Reduce_transition_Del_Sim))
{
spot::direct_simulation_relation* rel_dir = 0;
spot::delayed_simulation_relation* rel_del = 0;
if (reduc_aut & (spot::Reduce_quotient_Dir_Sim |
spot::Reduce_transition_Dir_Sim))
{
rel_dir =
spot::get_direct_relation_simulation
(a, std::cout, display_parity_game);
assert(rel_dir);
}
if (reduc_aut & (spot::Reduce_quotient_Del_Sim |
spot::Reduce_transition_Del_Sim))
{
rel_del =
spot::get_delayed_relation_simulation
(a, std::cout, display_parity_game);
assert(rel_del);
}
if (display_rel_sim)
{
if (rel_dir)
aut_red->display_rel_sim(rel_dir, std::cout);
if (rel_del)
aut_red->display_rel_sim(rel_del, std::cout);
}
if (reduc_aut & spot::Reduce_quotient_Dir_Sim)
aut_red->quotient_state(rel_dir);
if (reduc_aut & spot::Reduce_transition_Dir_Sim)
aut_red->delete_transitions(rel_dir);
if (reduc_aut & spot::Reduce_quotient_Del_Sim)
aut_red->quotient_state(rel_del);
if (reduc_aut & spot::Reduce_transition_Del_Sim)
aut_red->delete_transitions(rel_del);
if (rel_dir)
spot::free_relation_simulation(rel_dir);
if (rel_del)
spot::free_relation_simulation(rel_del);
}
tm.stop("reducing A_f w/ sim.");
}
}
const spot::tgba_explicit_string* expl = 0;
switch (dupexp)
{
@ -1394,7 +1305,6 @@ main(int argc, char** argv)
delete product_to_free;
delete system;
delete expl;
delete aut_red;
delete minimized;
delete degeneralized;
delete aut_scc;

View file

@ -1,59 +0,0 @@
#!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# 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 2 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 Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./defs
set -e
# FIXME
exit 0
cat >input <<EOF
acc = c;
s1, "s2", "a", c;
"s2", "s3", "a",;
"3", s2, "a",;
EOF
run 0 ../reduccmp 0 input
run 0 ../reduccmp 0 input > stdout
cat >expected <<EOF
digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="s1, SCC -1"]
}
EOF
rm input stdout expected
# Sort out some possible inversions in the output.
# (The order is not guaranteed by SPOT.)
sed 's/!b & a/a \& !b/g' stdout > tmp_ && mv tmp_ stdout
diff stdout expected
# FIXME
exit 0

View file

@ -1,180 +0,0 @@
// Copyright (C) 2008, 2009, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// 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 2 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 Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <cstdlib>
#include "tgbaalgos/ltl2tgba_fm.hh"
#include "tgbaalgos/reductgba_sim.hh"
#include "tgba/tgbareduc.hh"
#include "ltlvisit/reduce.hh"
#include "ltlast/allnodes.hh"
#include "ltlparse/public.hh"
#include "tgbaalgos/ltl2tgba_lacim.hh"
#include "tgbaalgos/ltl2tgba_fm.hh"
#include "tgba/bddprint.hh"
#include "tgbaalgos/dotty.hh"
#include "tgbaalgos/lbtt.hh"
#include "tgba/tgbatba.hh"
#include "tgbaalgos/magic.hh"
#include "tgbaalgos/gtec/gtec.hh"
#include "tgbaalgos/gtec/ce.hh"
#include "tgbaparse/public.hh"
#include "tgbaalgos/dupexp.hh"
#include "tgbaalgos/neverclaim.hh"
#include "tgbaalgos/sccfilter.hh"
#include "misc/escape.hh"
void
syntax(char* prog)
{
#ifdef REDUCCMP
std::cerr << prog << " option file" << std::endl;
#else
std::cerr << prog << " option formula" << std::endl;
#endif
exit(2);
}
int
main(int argc, char** argv)
{
if (argc < 3)
syntax(argv[0]);
int o = spot::ltl::Reduce_None;
switch (atoi(argv[1]))
{
case 0:
o = spot::Reduce_Scc;
break;
case 1:
o = spot::Reduce_quotient_Dir_Sim;
break;
case 2:
o = spot::Reduce_transition_Dir_Sim;
break;
case 3:
o = spot::Reduce_quotient_Del_Sim;
break;
case 4:
o = spot::Reduce_transition_Del_Sim;
break;
case 5:
o = spot::Reduce_quotient_Dir_Sim |
spot::Reduce_transition_Dir_Sim |
spot::Reduce_Scc;
break;
case 6:
o = spot::Reduce_quotient_Del_Sim |
spot::Reduce_transition_Del_Sim |
spot::Reduce_Scc;
break;
case 7:
// No Reduction
break;
default:
return 2;
}
int exit_code = 0;
spot::direct_simulation_relation* rel_dir = 0;
spot::delayed_simulation_relation* rel_del = 0;
spot::tgba* automata = 0;
spot::tgba_reduc* automatareduc = 0;
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::bdd_dict* dict = new spot::bdd_dict();
#ifdef REDUCCMP
spot::tgba_parse_error_list pel;
automata = spot::tgba_parse(argv[2], pel, dict, env, env, false);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel))
return 2;
#else
spot::ltl::parse_error_list p1;
spot::ltl::formula* f = spot::ltl::parse(argv[2], p1, env);
if (spot::ltl::format_parse_errors(std::cerr, argv[2], p1))
return 2;
automata = spot::ltl_to_tgba_fm(f, dict,
false, true,
false, true);
#endif
spot::dotty_reachable(std::cout, automata);
automatareduc = new spot::tgba_reduc(automata);
if (o & spot::Reduce_quotient_Dir_Sim)
{
rel_dir = spot::get_direct_relation_simulation(automatareduc, std::cout);
automatareduc->quotient_state(rel_dir);
}
else if (o & spot::Reduce_quotient_Del_Sim)
{
std::cout << "get delayed" << std::endl;
rel_del = spot::get_delayed_relation_simulation(automatareduc, std::cout);
std::cout << "quotient state" << std::endl;
automatareduc->quotient_state(rel_del);
std::cout << "end" << std::endl;
}
if (rel_dir != 0)
{
automatareduc->display_rel_sim(rel_dir, std::cout);
spot::free_relation_simulation(rel_dir);
}
if (rel_del != 0)
{
automatareduc->display_rel_sim(rel_del, std::cout);
spot::free_relation_simulation(rel_del);
}
spot::tgba* res = automatareduc;
if (o & spot::Reduce_Scc)
{
res = spot::scc_filter(automatareduc);
delete automatareduc;
}
spot::dotty_reachable(std::cout, res);
delete res;
delete automata;
#ifndef REDUCCMP
if (f != 0)
f->destroy();
#endif
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
if (dict != 0)
delete dict;
return exit_code;
}

View file

@ -1,92 +0,0 @@
#!/bin/sh
# Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# 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 2 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 Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./defs
set -e
check()
{
#run 0 ../reductgba "$1" "$2"
../reductgba "$1" "$2"
}
# We don't check the output, but just running these might be enough to
# trigger assertions.
check 0 a
check 0 'a U b'
check 0 'a U Fb'
check 0 'X a'
check 0 'a & b & c'
check 0 'a | b | (c U (d & (g U (h ^ i))))'
check 0 'Xa & (b U !a) & (b U !a)'
check 0 'Fa & Xb & GFc & Gd'
check 0 'Fa & Xa & GFc & Gc'
check 0 'Fc & X(a | Xb) & GF(a | Xb) & Gc'
check 0 'a R (b R c)'
check 0 '(a U b) U (c U d)'
check 0 '((Xp2)U(X(1)))&(p1 R(p2 R p0))'
check 0 '((p3 | Xp3 | Xp2) & (X!p3 | (!p3 & X!p2))) R F(0)'
check 1 a
check 1 'a U b'
check 1 'X a'
check 1 'a & b & c'
check 1 'a | b | (c U (d & (g U (h ^ i))))'
check 1 'Xa & (b U !a) & (b U !a)'
check 1 'Fa & Xb & GFc & Gd'
check 1 'Fa & Xa & GFc & Gc'
check 1 'Fc & X(a | Xb) & GF(a | Xb) & Gc'
check 1 'a R (b R c)'
check 1 '(a U b) U (c U d)'
check 1 '((Xp2)U(X(1)))&(p1 R(p2 R p0))'
check 2 a
check 2 'a U b'
check 2 'X a'
check 2 'a & b & c'
check 2 'a | b | (c U (d & (g U (h ^ i))))'
check 2 'Xa & (b U !a) & (b U !a)'
check 2 'Fa & Xb & GFc & Gd'
check 2 'Fa & Xa & GFc & Gc'
check 2 'Fc & X(a | Xb) & GF(a | Xb) & Gc'
check 2 'a R (b R c)'
check 2 '(a U b) U (c U d)'
check 2 '((Xp2)U(X(1)))&(p1 R(p2 R p0))'
check 3 a
check 3 'a U b'
check 3 'a U Fb'
check 3 'X a'
check 3 'a & b & c'
check 3 'a | b | (c U (d & (g U (h ^ i))))'
check 3 'Xa & (b U !a) & (b U !a)'
check 3 'Fa & Xb & GFc & Gd'
check 3 'Fa & Xa & GFc & Gc'
check 3 'Fc & X(a | Xb) & GF(a | Xb) & Gc'
check 3 'a R (b R c)'
check 3 '(a U b) U (c U d)'
check 3 '((Xp2)U(X(1)))&(p1 R(p2 R p0))'

View file

@ -1,9 +1,10 @@
#!/bin/sh
# Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Laboratoire
# d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
# Coopératifs (SRC), Université Pierre et Marie Curie.
# d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
# Coopératifs (SRC), Université Pierre et Marie Curie.
#
# This file is part of Spot, a model checking library.
#
@ -150,22 +151,6 @@ Algorithm
Enabled = no
}
Algorithm
{
Name = "Spot (Couvreur -- FM), post reduction with direct simulation"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -R1q -R1t -R3 -r4 -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), post reduction with delayed simulation"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -R2q -R2t -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), post reduction with scc"
@ -174,14 +159,6 @@ Algorithm
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), pre + post reduction"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r4 -R1q -R1t -R3 -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), +pre +WDBA"
@ -198,14 +175,6 @@ Algorithm
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), pre + allpost reduction"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r4 -R1q -R1t -R2q -R2t -R3 -F -f -t'"
Enabled = no
}
Algorithm
{
Name = "Spot (Couvreur -- FM), without symb_merge"