Add the "don't care" simulation

* src/tgba/bddprint.cc, src/tgba/bddprint.hh: Add bdd_print_isop
that prints the bdd into a Irreductible Sum Of Product.
* src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh: Add a way to
know which states (in the input) is which (in the result).
* src/tgbaalgos/simulation.cc, src/tgbaalgos/simulation.hh: Add
the Don't Care Simulation and the Don't Care Iterated Simulation.
* src/tgbatest/ltl2tgba.cc, src/tgbatest/spotlbtt.test,
src/tgbatest/Makefile.am, src/tgbatest/sim.test: Test them.
* bench/ltl2tgba/algorithms, bench/ltl2tgba/README,
bench/ltl2tgba/algorithms: Add a way to bench the don't care
simulation.
This commit is contained in:
Thomas Badie 2012-09-27 16:45:40 +02:00 committed by Alexandre Duret-Lutz
parent 5796114e37
commit 08c77318ae
12 changed files with 1171 additions and 76 deletions

View file

@ -69,7 +69,6 @@ tripprod_SOURCES = tripprod.cc
# because such failures will be easier to diagnose and fix.
TESTS = \
intvcomp.test \
simdet.test \
eltl2tgba.test \
explicit.test \
explicit2.test \
@ -79,6 +78,8 @@ TESTS = \
nondet.test \
neverclaimread.test \
readsave.test \
simdet.test \
sim.test \
ltl2tgba.test \
ltl2neverclaim.test \
ltl2neverclaim-lbtt.test \

View file

@ -216,6 +216,8 @@ syntax(char* prog)
<< std::endl
<< " -RIS iterate both direct and reverse simulations"
<< std::endl
<< " -RDCS reduce the automaton with direct simulation"
<< std::endl
<< " -Rm attempt to WDBA-minimize the automaton" << std::endl
<< std::endl
<< " -RM attempt to WDBA-minimize the automaton unless the "
@ -314,6 +316,17 @@ syntax(char* prog)
exit(2);
}
static int
to_int(const char* s)
{
char* endptr;
int res = strtol(s, &endptr, 10);
if (*endptr)
return -1;
return res;
}
int
main(int argc, char** argv)
{
@ -374,6 +387,9 @@ main(int argc, char** argv)
bool reduction_dir_sim = false;
bool reduction_rev_sim = false;
bool reduction_iterated_sim = false;
bool reduction_dont_care_sim = false;
int limit_dont_care_sim = 0;
bool reduction_iterated_dont_care_sim = false;
spot::tgba* temp_dir_sim = 0;
bool ta_opt = false;
bool tgta_opt = false;
@ -382,7 +398,8 @@ main(int argc, char** argv)
bool opt_with_artificial_livelock = false;
spot::tgba* temp_rev_sim = 0;
spot::tgba* temp_iterated_sim = 0;
spot::tgba* temp_dont_care_sim = 0;
spot::tgba* temp_dont_care_iterated_sim = 0;
for (;;)
{
@ -721,6 +738,18 @@ main(int argc, char** argv)
{
reduction_iterated_sim = true;
}
else if (!strncmp(argv[formula_index], "-RDCS", 5))
{
reduction_dont_care_sim = true;
if (argv[formula_index][5] == '=')
limit_dont_care_sim = to_int(argv[formula_index] + 6);
}
else if (!strncmp(argv[formula_index], "-RDCIS", 6))
{
reduction_iterated_dont_care_sim = true;
if (argv[formula_index][6] == '=')
limit_dont_care_sim = to_int(argv[formula_index] + 7);
}
else if (!strcmp(argv[formula_index], "-rL"))
{
simpltl = true;
@ -1131,6 +1160,9 @@ main(int argc, char** argv)
// When the minimization succeed, simulation is useless.
reduction_dir_sim = false;
reduction_rev_sim = false;
reduction_iterated_dont_care_sim = false;
reduction_dont_care_sim = false;
reduction_iterated_sim = false;
assume_sba = true;
}
}
@ -1153,6 +1185,17 @@ main(int argc, char** argv)
assume_sba = false;
}
if (reduction_iterated_dont_care_sim)
{
tm.start("don't care iterated simulation");
temp_dont_care_iterated_sim
= spot::dont_care_iterated_simulations(a, limit_dont_care_sim);
a = temp_dont_care_iterated_sim;
tm.stop("don't care iterated simulation");
assume_sba = false;
}
if (reduction_iterated_sim)
{
tm.start("Reduction w/ iterated simulations");
@ -1170,6 +1213,25 @@ main(int argc, char** argv)
tm.stop("SCC-filter post-sim");
}
if (reduction_dont_care_sim)
{
tm.start("don't care simulation");
temp_dont_care_sim
= spot::dont_care_simulation(a, limit_dont_care_sim);
a = temp_dont_care_sim;
tm.stop("don't care simulation");
if (scc_filter)
{
tm.start("SCC-filter on don't care");
a = spot::scc_filter(a, true);
delete temp_dont_care_sim;
temp_dont_care_sim = a;
tm.stop("SCC-filter on don't care");
}
assume_sba = false;
}
unsigned int n_acc = a->number_of_acceptance_conditions();
if (echeck_inst
&& degeneralize_opt == NoDegen
@ -1673,6 +1735,8 @@ main(int argc, char** argv)
delete temp_dir_sim;
delete temp_rev_sim;
delete temp_iterated_sim;
delete temp_dont_care_sim;
delete temp_dont_care_iterated_sim;
}
else
{

62
src/tgbatest/sim.test Executable file
View file

@ -0,0 +1,62 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013 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/>.
. ./defs
set -e
cat >in.tgba <<EOF
acc = "1";
"i", "x", "b",;
"i", "d2", "b",;
"x", "ed", "a", "1";
"ed", "ed", "a & b", "1";
"d2", "d", "a",;
"d", "d", "a", "1";
EOF
run 0 ../ltl2tgba -X -RDCS -b in.tgba > out.tgba
cat >expected.tgba <<EOF
acc = "1";
"1", "2", "b",;
"2", "2", "a", "1";
EOF
diff out.tgba expected.tgba
run 0 ../ltl2tgba -RDCIS -b XXXXGFa > out.tgba
cat >expected.tgba <<EOF
acc = "a";
"1", "1", "a", "a";
"1", "1", "!a",;
EOF
diff out.tgba expected.tgba
run 0 ../ltl2tgba -RDCIS -kt 'Fp U Gq' > out.tgba
cat >expected.tgba <<EOF
sub trans.: 12
transitions: 6
states: 3
nondeterministic states: 1
EOF
diff out.tgba expected.tgba

View file

@ -182,6 +182,23 @@ Algorithm
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), don't care simulation"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -RDCS -r4 -R3f'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), don't care iterated simulation"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -RDCIS -r4 -R3f'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), cosimulated"