stutter check: cleanup and add test cases

* src/ltltest/ltlfilt.test: Add more tests.
* src/ltltest/stutter.test: New test.
* src/ltltest/Makefile.am: Adjust.
* src/bin/ltlfilt.cc: Catch std::runtime_error.
* src/tgba/tgbasl.hh (make_tgbasl): New function.
* src/tgba/tgbagraph.hh (make_tgba_graph): Add another overload.
* src/tgbaalgos/stutter_invariance.cc,
src/tgbaalgos/stutter_invariance.hh: Take the algorithm version as an
optional integer, and call getenv() only once.
* bench/stutter/stutter_invariance_randomgraph.cc,
bench/stutter/stutter_invariance_formulas.cc: Simplify using the
above functions.
This commit is contained in:
Alexandre Duret-Lutz 2014-11-12 18:29:54 +01:00
parent fcf6e25132
commit f412fee6f3
10 changed files with 188 additions and 115 deletions

View file

@ -29,7 +29,6 @@
#include "ltlvisit/length.hh"
#include "misc/timer.hh"
#include <argp.h>
#include "error.h"
const char argp_program_doc[] ="";
@ -75,21 +74,17 @@ namespace
bdd apdict = spot::ltl::atomic_prop_collect_as_bdd(f, a);
bool res;
bool prev = true;
for (char algo = '1'; algo <= '8'; ++algo)
for (int algo = 1; algo <= 8; ++algo)
{
// set SPOT_STUTTER_CHECK environment variable
char algostr[2] = { 0 };
algostr[0] = algo;
setenv("SPOT_STUTTER_CHECK", algostr, true);
auto dup_a = spot::make_tgba_digraph(a);
auto dup_na = spot::make_tgba_digraph(na);
spot::stopwatch sw;
auto dup_a = std::make_shared<spot::tgba_digraph>(a);
auto dup_na = std::make_shared<spot::tgba_digraph>(na);
sw.start();
res = spot::is_stutter_invariant(std::move(dup_a),
std::move(dup_na), apdict);
const double time = sw.stop();
std::move(dup_na),
apdict, algo);
auto time = sw.stop();
std::cout << formula << ", " << algo << ", " << ap->size() << ", "
<< num_states << ", " << res << ", " << time * 1000000 << std::endl;
@ -100,7 +95,7 @@ namespace
}
f->destroy();
nf->destroy();
delete(ap);
delete ap;
return 0;
}
};

View file

@ -73,11 +73,11 @@ main()
vec.push_back(aut_pair_t(a, na));
}
char algostr[2] = { 0, 0 };
for (char algo = '1'; algo <= '8'; ++algo)
{
// Set SPOT_STUTTER_CHECK environment variable.
char algostr[2] = { 0 };
algostr[0] = algo;
// Select the algorithm for checking stutter-invariance
algostr[0] = algo;
setenv("SPOT_STUTTER_CHECK", algostr, true);
// Copy vec, because is_stutter_invariant modifies the
@ -86,18 +86,16 @@ main()
spot::stopwatch sw;
sw.start();
bool res;
for (auto& a: vec)
for (auto& a: dup)
res = spot::is_stutter_invariant(std::move(a.first),
std::move(a.second),
apdict);
const double time = sw.stop();
vec = dup;
auto time = sw.stop();
std::cout << algo << ", " << props_n << ", " << states_n
<< ", " << res << ", " << time << std::endl;
}
spot::ltl::destroy_atomic_prop_set(*ap);
delete(ap);
delete ap;
}
}