spot: Add 'langmap' option with dichotomy (it helps to choose min val)

* python/spot/__init__.py: Handle 'dicho' option in 'sat_minimize'.
* spot/priv/satcommon.cc: Implement get_number_of_distinct_vals.
* spot/priv/satcommon.hh: Declare get_number_of_distinct_vals.
* spot/twaalgos/dtbasat.cc: Use get_number_of_distinct_vals.
* spot/twaalgos/dtbasat.hh: Change dichotomy function's prototype.
* spot/twaalgos/dtwasat.cc: Use get_number_of_distinct_vals.
* spot/twaalgos/dtwasat.hh: Change dichotomy function's prototype.
Handle options.
* spot/twaalgos/postproc.cc: Handle options.
* spot/twaalgos/postproc.hh: Add dicho_langmap_ var for options.
* tests/core/satmin2.test: Add tests for dichotomy.
* tests/core/satmin.test: Add tests for dichotomy.
* tests/python/satmin.py: Replace 'dichotomy' with 'dicho' option.
This commit is contained in:
Alexandre GBAGUIDI AISSE 2016-12-14 10:57:56 +01:00
parent 7046a49622
commit 67e3a4f28e
12 changed files with 229 additions and 31 deletions

View file

@ -19,6 +19,7 @@
#include <fstream>
#include <set>
#include <assert.h>
#include <spot/misc/escape.hh>
#include <spot/priv/satcommon.hh>
@ -185,4 +186,13 @@ namespace spot
out << "\"\n";
}
}
int
get_number_of_distinct_vals(std::vector<unsigned> v)
{
std::set<unsigned> distinct;
for (auto it = v.begin(); it != v.end(); ++it)
distinct.insert(*it);
return distinct.size();
}
}

View file

@ -21,6 +21,7 @@
#include <tuple>
#include <sstream>
#include <vector>
#include <spot/misc/bddlt.hh>
#include <spot/misc/satsolver.hh>
#include <spot/misc/timer.hh>
@ -235,4 +236,8 @@ public:
void
print_log(timer_map& t, int target_state_number, twa_graph_ptr& res,
satsolver& solver);
/// \brief Returns the number of distinct values containted in a vector.
int
get_number_of_distinct_vals(std::vector<unsigned> v);
}