introduce partitioned_relabel_here

Function taking an automaton and trying to relabel
it by partitioning the old conditions and encode the
different subsets of the partition with new variables

* spot/priv/Makefile.am: Add
* spot/priv/partitioned_relabel.hh
, spot/priv/partitioned_relabel.cc: try_partition_me,
computes the partition of a given vector of bdds
* spot/twaalgos/relabel.hh
, spot/twaalgos/relabel.cc: Here. Adapt also relabel()
to cope with the different type of relabeling_maps
* tests/python/_partitioned_relabel.ipynb
, tests/python/except.py: Test and Usage
* tests/Makefile.am: Add test
This commit is contained in:
Philipp Schlehuber-Caissier 2022-11-29 14:01:45 +01:00
parent b02d8328ee
commit fb63dfc309
8 changed files with 1920 additions and 44 deletions

View file

@ -21,6 +21,10 @@
#include <spot/tl/relabel.hh>
#include <spot/twa/twagraph.hh>
#include <spot/misc/bddlt.hh>
#include <optional>
#include <functional>
namespace spot
{
@ -33,4 +37,33 @@ namespace spot
/// or relabel_bse().
SPOT_API void
relabel_here(twa_graph_ptr& aut, relabeling_map* relmap);
/// \brief Replace conditions in \a aut with non-overlapping conditions
/// over fresh variables.
///
/// Partitions the conditions in the automaton, then (binary) encodes
/// them using fresh propositions.
/// This can lead to an exponential explosion in the number of
/// conditions. The operations is aborted if either
/// the number of new letters (subsets of the partition) exceeds
/// \a max_letter OR \a max_letter_mult times the number of conditions
/// in the original automaton.
/// The argument \a concerned_ap can be used to filter out transitions.
/// If given, only the transitions whose support intersects the
/// concerned_ap (or whose condition is T) are taken into account.
/// The fresh aps will be enumerated and prefixed by \a var_prefix.
/// These variables need to be fresh, i.e. may not exist yet (not checked)
///
/// \note If concerned_ap is given, then there may not be an edge
/// whose condition uses ap inside AND outside of concerned_ap.
/// Mostly used in a game setting to distinguish between
/// env and player transitions.
SPOT_API relabeling_map
partitioned_relabel_here(twa_graph_ptr& aut, bool split = false,
unsigned max_letter = -1u,
unsigned max_letter_mult = -1u,
const bdd& concerned_ap = bddtrue,
std::string var_prefix = "__nv");
}