ltsmin: move modelchek in mc directory

* spot/ltsmin/ltsmin.cc, spot/ltsmin/ltsmin.hh,
spot/mc/Makefile.am, tests/ltsmin/modelcheck.cc,
spot/mc/mc.hh: here.
This commit is contained in:
Etienne Renault 2017-09-29 15:18:50 +02:00
parent 1d4cb26235
commit f486dab241
5 changed files with 82 additions and 51 deletions

View file

@ -41,7 +41,6 @@
#include <spot/twaalgos/reachiter.hh>
#include <string.h>
#include <spot/mc/utils.hh>
#include <spot/mc/ec.hh>
using namespace std::string_literals;
@ -1122,45 +1121,6 @@ namespace spot
{
}
std::tuple<bool, std::string, std::vector<istats>>
ltsmin_model::modelcheck(ltsmin_kripkecube_ptr sys,
spot::twacube_ptr twa, bool compute_ctrx)
{
// Must ensure that the two automata are working on the same
// set of atomic propositions.
assert(sys->get_ap().size() == twa->get_ap().size());
for (unsigned int i = 0; i < sys->get_ap().size(); ++i)
assert(sys->get_ap()[i].compare(twa->get_ap()[i]) == 0);
bool stop = false;
std::vector<ec_renault13lpar<cspins_state, cspins_iterator,
cspins_state_hash, cspins_state_equal>> ecs;
for (unsigned i = 0; i < sys->get_threads(); ++i)
ecs.push_back({*sys, twa, i, stop});
std::vector<std::thread> threads;
for (unsigned i = 0; i < sys->get_threads(); ++i)
threads.push_back
(std::thread(&ec_renault13lpar<cspins_state, cspins_iterator,
cspins_state_hash, cspins_state_equal>::run, &ecs[i]));
for (unsigned i = 0; i < sys->get_threads(); ++i)
threads[i].join();
bool has_ctrx = false;
std::string trace = "";
std::vector<istats> stats;
for (unsigned i = 0; i < sys->get_threads(); ++i)
{
has_ctrx |= ecs[i].counterexample_found();
if (compute_ctrx && ecs[i].counterexample_found()
&& trace.compare("") == 0)
trace = ecs[i].trace(); // Pick randomly one !
stats.push_back(ecs[i].stats());
}
return std::make_tuple(has_ctrx, trace, stats);
}
int ltsmin_model::state_size() const
{
return iface->get_state_size();

View file

@ -25,7 +25,6 @@
#include <spot/twacube/twacube.hh>
#include <spot/tl/apcollect.hh>
#include <tuple>
#include <spot/mc/intersect.hh>
namespace spot
{
@ -82,14 +81,6 @@ namespace spot
int compress = 0,
unsigned int nb_threads = 1) const;
/// \brief Check for the emptiness between a system and a twa.
/// Return a pair containing a boolean indicating wether a counterexample
/// has been found and a string representing the counterexample if the
/// computation have been required
static std::tuple<bool, std::string, std::vector<istats>>
modelcheck(ltsmin_kripkecube_ptr sys,
spot::twacube_ptr twa, bool compute_ctrx = false);
/// Number of variables in a state
int state_size() const;
/// Name of each variable