Making solved game to mealy more flexible

* spot/twaalgos/synthesis.cc,
spot/twaalgos/synthesis.hh: Solved game to mealy
now also supports the other mealy formats
* tests/python/_synthesis.ipynb: Test
* tests/Makefile.am: Test
This commit is contained in:
Philipp Schlehuber 2021-11-22 16:23:03 +01:00 committed by philipp
parent 488efee7b3
commit 5b6e2a210a
4 changed files with 469 additions and 5 deletions

View file

@ -1006,8 +1006,10 @@ namespace spot
}
twa_graph_ptr
solved_game_to_separated_mealy(twa_graph_ptr arena, synthesis_info& gi)
solved_game_to_mealy(twa_graph_ptr arena, synthesis_info& gi)
{
// This currently always produces either separated or split mealy machines
// if this changes, change also the other functions accordingly
assert(arena->get_named_prop<region_t>("state-player")
&& "Need prop \"state-player\"");
if (!arena)
@ -1032,9 +1034,6 @@ namespace spot
else if (gi.minimize_lvl >= 3)
m = minimize_mealy(m, gi.minimize_lvl - 4);
if (!do_unsplit)
m = unsplit_mealy(m);
if (gi.bv)
{
gi.bv->strat2aut_time += sw.stop();
@ -1042,6 +1041,24 @@ namespace spot
gi.bv->nb_strat_edges += m->num_edges();
}
assert(is_mealy(m));
return m;
}
twa_graph_ptr
solved_game_to_mealy(twa_graph_ptr arena)
{
synthesis_info dummy;
return solved_game_to_mealy(arena, dummy);
}
twa_graph_ptr
solved_game_to_separated_mealy(twa_graph_ptr arena, synthesis_info& gi)
{
auto m = solved_game_to_mealy(arena, gi);
if (m->get_named_prop<region_t>("state-player"))
m = unsplit_mealy(m);
assert(is_separated_mealy(m));
return m;
}
@ -1053,6 +1070,27 @@ namespace spot
return solved_game_to_separated_mealy(arena, dummy);
}
twa_graph_ptr
solved_game_to_split_mealy(twa_graph_ptr arena, synthesis_info& gi)
{
auto m = solved_game_to_mealy(arena, gi);
if (!m->get_named_prop<region_t>("state-player"))
{
assert(is_separated_mealy(m));
split_separated_mealy_here(m);
}
assert(is_split_mealy(m));
return m;
}
twa_graph_ptr
solved_game_to_split_mealy(twa_graph_ptr arena)
{
synthesis_info dummy;
return solved_game_to_split_mealy(arena, dummy);
}
}
namespace spot

View file

@ -158,15 +158,25 @@ namespace spot
/// @}
/// \ingroup synthesis
/// \brief creates a separated mealy machine from a solved game
/// \brief creates a mealy machine from a solved game \a arena
/// taking into account the options given in \a gi.
/// This concerns in particular whether or not the machine is to be reduced
/// and how.
/// solved_game_to_mealy can return any type of mealy machine. In fact it
/// will return the type that necessitates no additional operations
/// @{
SPOT_API twa_graph_ptr
solved_game_to_mealy(twa_graph_ptr arena, synthesis_info& gi);
SPOT_API twa_graph_ptr
solved_game_to_mealy(twa_graph_ptr arena);
SPOT_API twa_graph_ptr
solved_game_to_separated_mealy(twa_graph_ptr arena, synthesis_info& gi);
SPOT_API twa_graph_ptr
solved_game_to_separated_mealy(twa_graph_ptr arena);
SPOT_API twa_graph_ptr
solved_game_to_split_mealy(twa_graph_ptr arena, synthesis_info& gi);
SPOT_API twa_graph_ptr
solved_game_to_split_mealy(twa_graph_ptr arena);
/// @}
/// \ingroup synthesis