Implement Loizou & Thanisch's algorithm for enumerating cycles.
* src/tgbaalgos/cycles.cc, src/tgbaalgos/cycles.hh, src/tgbatest/cycles.test: New files. * src/tgbaalgos/Makefile.am, src/tgbatest/Makefile.am: Add them. * src/tgbatest/ltl2tgba.cc: Add a -KC option for testing.
This commit is contained in:
parent
379e0d5eb4
commit
374a489e3f
6 changed files with 410 additions and 1 deletions
|
|
@ -108,7 +108,8 @@ TESTS = \
|
|||
spotlbtt.test \
|
||||
spotlbtt2.test \
|
||||
complementation.test \
|
||||
randpsl.test
|
||||
randpsl.test \
|
||||
cycles.test
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
|
||||
|
|
|
|||
62
src/tgbatest/cycles.test
Executable file
62
src/tgbatest/cycles.test
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/sh
|
||||
# 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 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.
|
||||
|
||||
# While running some benchmark, Tomáš Babiak found that Spot took too
|
||||
# much time (i.e. >1h) to translate those six formulae. It turns out
|
||||
# that the WDBA minimization was performed after the degeneralization
|
||||
# algorithm, while this is not necessary (WDBA will produce a BA, so
|
||||
# we may as well skip degeneralization). Translating these formulae
|
||||
# in the test-suite ensure that they don't take too much time (the
|
||||
# buildfarm will timeout if it does).
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
# Fig.1 from Johnson's SIAM J. Comput. 1975 paper.
|
||||
|
||||
(
|
||||
echo 'acc = ;'
|
||||
k=3
|
||||
v=`expr $k + 2`
|
||||
w=`expr 2 \* $k + 2`
|
||||
x=`expr 3 \* $k + 3`
|
||||
for i in $(seq 2 `expr $k + 1`); do
|
||||
echo "s1,s$i,,;"
|
||||
echo "s$i,s$v,,;"
|
||||
done
|
||||
for i in $(seq `expr $k + 2` `expr 2 \* $k`); do
|
||||
echo "s$i,s`expr $i + 1`,,;"
|
||||
echo "s$i,s$w,,;"
|
||||
done
|
||||
echo "s`expr 2 \* $k + 1`,s$w,,;"
|
||||
echo "s`expr 2 \* $k + 1`,s1,,;"
|
||||
for i in $(seq `expr 2 \* $k + 3` `expr 3 \* $k + 2`); do
|
||||
echo "s$w,s$i,,;"
|
||||
echo "s$i,s$x,,;"
|
||||
done
|
||||
echo "s`expr 2 \* $k + 3`,s$v,,;"
|
||||
echo "s$x,s$w,,;"
|
||||
) > johnson-fig1.tgba
|
||||
|
||||
|
||||
run 0 ../ltl2tgba -KC -X johnson-fig1.tgba > out
|
||||
test `wc -l < out` -eq 10
|
||||
|
|
@ -64,6 +64,7 @@
|
|||
#include "tgbaalgos/emptiness_stats.hh"
|
||||
#include "tgbaalgos/scc.hh"
|
||||
#include "tgbaalgos/isdet.hh"
|
||||
#include "tgbaalgos/cycles.hh"
|
||||
#include "kripkeparse/public.hh"
|
||||
#include "tgbaalgos/simulation.hh"
|
||||
|
||||
|
|
@ -281,6 +282,7 @@ syntax(char* prog)
|
|||
<< " -K dump the graph of SCCs in dot format" << std::endl
|
||||
<< " -KV verbosely dump the graph of SCCs in dot format"
|
||||
<< std::endl
|
||||
<< " -KC list cycles in automaton" << std::endl
|
||||
<< " -N output the never clain for Spin (implies -DS)"
|
||||
<< std::endl
|
||||
<< " -NN output the never clain for Spin, with commented states"
|
||||
|
|
@ -522,6 +524,10 @@ main(int argc, char** argv)
|
|||
{
|
||||
output = 11;
|
||||
}
|
||||
else if (!strcmp(argv[formula_index], "-KC"))
|
||||
{
|
||||
output = 15;
|
||||
}
|
||||
else if (!strcmp(argv[formula_index], "-l"))
|
||||
{
|
||||
translation = TransLaCIM;
|
||||
|
|
@ -1409,6 +1415,20 @@ main(int argc, char** argv)
|
|||
std::cout << std::endl;
|
||||
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
spot::scc_map m(a);
|
||||
m.build_map();
|
||||
spot::enumerate_cycles c(a, m);
|
||||
unsigned max = m.scc_count();
|
||||
for (unsigned n = 0; n < max; ++n)
|
||||
{
|
||||
std::cout << "Cycles in SCC #" << n << std::endl;
|
||||
c.run(n);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assert(!"unknown output option");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue