Introduce simplify_mealy

Convenience function dispatching to
minimize_mealy and reduce_mealy.
Change tests accordingly

* spot/twaalgos/mealy_machine.cc,
  spot/twaalgos/mealy_machine.hh: Here
* bin/ltlsynt.cc: Use simplify
* spot/twaalgos/synthesis.cc,
  spot/twaalgos/synthesis.hh: Remove
 minimization, Update options
* tests/core/ltlsynt.test,
  tests/python/synthesis.ipynb,
  tests/python/_synthesis.ipynb: Adapt
This commit is contained in:
Philipp Schlehuber-Caissier 2022-03-18 15:27:46 +01:00
parent 86de4d4052
commit 97fc3f6c0b
8 changed files with 901 additions and 327 deletions

View file

@ -408,14 +408,13 @@ namespace
spot::mealy_like ml;
ml.success =
spot::mealy_like::realizability_code::REALIZABLE_REGULAR;
if (opt_print_aiger)
// we do not care about the type,
// machine to aiger can handle it
// By default this produces a split machine
ml.mealy_like =
spot::solved_game_to_mealy(arena, *gi);
else
ml.mealy_like =
spot::solved_game_to_separated_mealy(arena, *gi);
// Keep the machine split for aiger
// else -> separated
spot::simplify_mealy_here(ml.mealy_like, *gi,
opt_print_aiger);
ml.glob_cond = bddfalse;
mealy_machines.push_back(ml);
}
@ -429,51 +428,10 @@ namespace
assert(m_like.mealy_like && "Expected success but found no mealy!");
if (!opt_real)
{
spot::stopwatch sw_direct;
sw_direct.start();
if ((0 < gi->minimize_lvl) && (gi->minimize_lvl < 3))
// Uses reduction or not,
// both work with mealy machines (non-separated)
reduce_mealy_here(m_like.mealy_like, gi->minimize_lvl == 2);
auto delta = sw_direct.stop();
sw_direct.start();
// todo better algo here?
m_like.mealy_like =
split_2step(m_like.mealy_like,
spot::get_synthesis_outputs(m_like.mealy_like),
false);
if (gi->bv)
gi->bv->split_time += sw_direct.stop();
sw_direct.start();
if (gi->minimize_lvl >= 3)
{
sw_direct.start();
// actual minimization, works on split mealy
m_like.mealy_like = minimize_mealy(m_like.mealy_like,
gi->minimize_lvl - 4);
delta = sw_direct.stop();
}
// If our goal is to have an aiger,
// we can use split or separated machines
if (!opt_print_aiger)
// Unsplit to have separated mealy
m_like.mealy_like = unsplit_mealy(m_like.mealy_like);
if (gi->bv)
gi->bv->strat2aut_time += delta;
if (gi->verbose_stream)
*gi->verbose_stream << "final strategy has "
<< m_like.mealy_like->num_states()
<< " states and "
<< m_like.mealy_like->num_edges()
<< " edges\n"
<< "minimization took " << delta
<< " seconds\n";
// Keep the machine split for aiger
// else -> separated
spot::simplify_mealy_here(m_like.mealy_like, *gi,
opt_print_aiger);
}
SPOT_FALLTHROUGH;
}

View file

@ -135,11 +135,12 @@ namespace spot
if (!is_mealy(m))
return false;
if (m->get_named_prop<region_t>("state-player") == nullptr)
if (!m->get_named_prop<region_t>("state-player"))
{
trace << "is_split_mealy(): Split mealy machine must define the named "
"property \"state-player\"!\n";
}
auto sp = get_state_players(m);
if (sp.size() != m->num_states())
@ -1027,6 +1028,28 @@ namespace
std::pair<const_twa_graph_ptr, unsigned>
reorganize_mm(const_twa_graph_ptr mm, const std::vector<bool>& sp)
{
// Check if the twa_graph already has the correct form
{
auto sp = get_state_players(mm);
// All player states mus be at the end
bool is_ok = true;
bool seen_player = false;
for (const auto& p : sp)
{
if (seen_player & !p)
{
is_ok = false;
break;
}
seen_player |= p;
}
if (is_ok)
return {mm,
mm->num_states()
- std::accumulate(sp.begin(), sp.end(), 0)};
}
// We actually need to generate a new graph with the correct
// form
// Purge unreachable and reorganize the graph
std::vector<unsigned> renamed(mm->num_states(), -1u);
const unsigned n_old = mm->num_states();
@ -3607,7 +3630,7 @@ namespace spot
twa_graph_ptr minimize_mealy(const const_twa_graph_ptr& mm,
int premin)
{
assert(is_split_mealy(mm));
assert(is_mealy(mm));
stopwatch sw;
sw.start();
@ -3615,38 +3638,33 @@ namespace spot
if ((premin < -1) || (premin > 1))
throw std::runtime_error("premin has to be -1, 0 or 1");
auto orig_spref = get_state_players(mm);
// Check if finite traces exist
// If so, deactivate fast minimization
// todo : this is overly conservative
// If unreachable states have no outgoing edges we do not care
// but testing this as well starts to be expensive...
if (premin != -1
&& [&]()
{
for (unsigned s = 0; s < mm->num_states(); ++s)
{
auto eit = mm->out(s);
if (eit.begin() == eit.end())
return true;
}
return false;
}())
premin = -1;
auto do_premin = [&]()->const_twa_graph_ptr
{
if (premin == -1)
{
if (!mm->get_named_prop<region_t>("state-player"))
return split_2step(mm, false);
else
return mm;
}
else
{
bool is_split = mm->get_named_prop<region_t>("state-player");
// We have a split machine -> unsplit then resplit,
// as reduce mealy works on separated
auto mms = unsplit_mealy(mm);
reduce_mealy_here(mms, premin == 1);
split_separated_mealy_here(mms);
return mms;
twa_graph_ptr mms;
if (is_split)
{
auto mmi = unsplit_2step(mm);
reduce_mealy_here(mmi, premin == 1);
split_separated_mealy_here(mmi);
return mmi;
}
else
{
auto mms = reduce_mealy(mm, premin == 1);
return split_2step(mms, false);
}
}
};
@ -3689,7 +3707,11 @@ namespace spot
auto early_exit = [&]()
{
// Always keep machines split
if (mm->get_named_prop<region_t>("state-player"))
assert(is_split_mealy_specialization(mm, mmw));
else
assert(is_split_mealy_specialization(split_2step(mm, false),
mmw));
return std::const_pointer_cast<twa_graph>(mmw);
};
@ -3897,4 +3919,91 @@ namespace spot
return p;
}
void
simplify_mealy_here(twa_graph_ptr& m, int minimize_lvl,
bool split_out)
{
auto si = synthesis_info();
si.minimize_lvl = minimize_lvl;
return simplify_mealy_here(m, si, split_out);
}
void
simplify_mealy_here(twa_graph_ptr& m, synthesis_info& si,
bool split_out)
{
const auto minimize_lvl = si.minimize_lvl;
assert(is_mealy(m)
&& "simplify_mealy_here(): m is not a mealy machine!");
if (minimize_lvl < 0 || 5 < minimize_lvl)
throw std::runtime_error("simplify_mealy_here(): minimize_lvl "
"must be between 0 and 5.");
stopwatch sw;
if (si.bv)
sw.start();
bool is_separated = false;
if (0 < minimize_lvl && minimize_lvl < 3)
{
// unsplit if necessary
if (m->get_named_prop<region_t>("state-player"))
{
m = unsplit_mealy(m);
is_separated = true;
}
reduce_mealy_here(m, minimize_lvl == 2);
}
else if (3 <= minimize_lvl)
m = minimize_mealy(m, minimize_lvl - 4);
// Convert to demanded output format
bool is_split = m->get_named_prop<region_t>("state-player");
if (minimize_lvl == 0)
{
if (is_split && !split_out)
m = unsplit_mealy(m);
else if (!is_split && split_out)
m = split_2step(m, false);
}
else if (0 < minimize_lvl && minimize_lvl < 3 && split_out)
{
if (is_separated)
split_separated_mealy_here(m);
else
m = split_2step(m, false);
}
else if (3 <= minimize_lvl && !split_out)
m = unsplit_mealy(m);
if (si.bv)
{
if (si.verbose_stream)
*si.verbose_stream << "simplification took " << sw.stop()
<< " seconds\n";
si.bv->simplify_strat_time += sw.stop();
auto n_s_env = 0u;
auto n_e_env = 0u;
if (auto sp = m->get_named_prop<region_t>("state-player"))
{
n_s_env = sp->size() - std::accumulate(sp->begin(),
sp->end(),
0u);
std::for_each(m->edges().begin(), m->edges().end(),
[&n_e_env, &sp](const auto& e)
{
n_e_env += (*sp)[e.src];
});
}
else
{
n_s_env = m->num_states();
n_e_env = m->num_edges();
}
si.bv->nb_simpl_strat_states += n_s_env;
si.bv->nb_simpl_strat_edges += n_e_env;
}
}
}

View file

@ -23,6 +23,9 @@
namespace spot
{
// Forward decl
struct synthesis_info;
/// todo
/// Comment je faire au mieux pour expliquer mealy dans les doc
@ -104,7 +107,7 @@ namespace spot
bool output_assignment = false);
/// @}
/// \brief Minimizes a split (in)completely specified mealy machine
/// \brief Minimizes an (in)completely specified mealy machine
/// The approach is described in \todo TACAS
/// \param premin Use reduce_mealy before applying the
/// main algorithm if demanded AND
@ -138,4 +141,22 @@ namespace spot
SPOT_API twa_graph_ptr
mealy_product(const const_twa_graph_ptr& left,
const const_twa_graph_ptr& right);
/// \brief Convenience function to call minimize_mealy or reduce_mealy.
/// Uses the same convention as ltlsynt for \a minimize_lvl:
/// 0: no reduction
/// 1: bisimulation based reduction
/// 2: bisimulation with output assignment
/// 3: SAT minimization
/// 4: 1 then 3
/// 5: 2 then 3
/// Minimizes the given machine \a m inplace, the parameter
/// \a split_out defines whether it is split or not
SPOT_API void
simplify_mealy_here(twa_graph_ptr& m, int minimize_lvl,
bool split_out);
SPOT_API void
simplify_mealy_here(twa_graph_ptr& m, synthesis_info& si,
bool split_out);
}

View file

@ -1051,22 +1051,25 @@ namespace spot
if (!get_state_winner(arena, arena->get_init_state_number()))
return nullptr;
// If we use minimizations 0,1 or 2 -> unsplit
const bool do_unsplit = gi.minimize_lvl < 3;
auto m = apply_strategy(arena, do_unsplit, false);
auto m = apply_strategy(arena, false, false);
m->prop_universal(true);
if ((0 < gi.minimize_lvl) && (gi.minimize_lvl < 3))
reduce_mealy_here(m, gi.minimize_lvl == 2);
else if (gi.minimize_lvl >= 3)
m = minimize_mealy(m, gi.minimize_lvl - 4);
if (gi.bv)
{
auto sp = get_state_players(m);
auto n_s_env = sp.size() - std::accumulate(sp.begin(),
sp.end(),
0u);
auto n_e_env = 0u;
std::for_each(m->edges().begin(), m->edges().end(),
[&n_e_env, &sp](const auto& e)
{
n_e_env += sp[e.src];
});
gi.bv->strat2aut_time += sw.stop();
gi.bv->nb_strat_states += m->num_states();
gi.bv->nb_strat_edges += m->num_edges();
gi.bv->nb_strat_states += n_s_env;
gi.bv->nb_strat_edges += n_e_env;
}
assert(is_mealy(m));
@ -1200,7 +1203,8 @@ namespace spot
{
*vs << "direct strategy was found.\n"
<< "direct strat has " << strat->num_states()
<< " states and " << strat->num_sets() << " colors\n";
<< " states, " << strat->num_edges()
<< " edges and " << strat->num_sets() << " colors\n";
}
return mealy_like{
mealy_like::realizability_code::REALIZABLE_REGULAR,

View file

@ -96,11 +96,14 @@ namespace spot
double paritize_time = 0.0;
double solve_time = 0.0;
double strat2aut_time = 0.0;
double simplify_strat_time = 0.0;
double aig_time = 0.0;
unsigned nb_states_arena = 0;
unsigned nb_states_arena_env = 0;
unsigned nb_strat_states = 0;
unsigned nb_strat_edges = 0;
unsigned nb_simpl_strat_states = 0;
unsigned nb_simpl_strat_edges = 0;
unsigned nb_latches = 0;
unsigned nb_gates = 0;
bool realizable = false;

View file

@ -195,7 +195,7 @@ cat >exp <<EOF
trying to create strategy directly for GFa <-> GFb
tanslating formula done in X seconds
direct strategy was found.
direct strat has 1 states and 0 colors
direct strat has 1 states, 2 edges and 0 colors
EOF
ltlsynt --ins='a' --outs='b' -f 'GFa <-> GFb' --verbose --realizability 2> out
sed 's/ [0-9.e-]* seconds/ X seconds/g' out > outx
@ -205,9 +205,8 @@ cat >exp <<EOF
trying to create strategy directly for GFa <-> GFb
tanslating formula done in X seconds
direct strategy was found.
direct strat has 1 states and 0 colors
final strategy has 1 states and 2 edges
minimization took X seconds
direct strat has 1 states, 2 edges and 0 colors
simplification took X seconds
EOF
ltlsynt --ins=a --outs=b -f 'GFa <-> GFb' --verbose --algo=ps 2> out
sed 's/ [0-9.e-]* seconds/ X seconds/g' out > outx
@ -217,7 +216,7 @@ cat >exp <<EOF
trying to create strategy directly for (Fa & Fb & Fc & Fd) <-> GFe
tanslating formula done in X seconds
direct strategy was found.
direct strat has 16 states and 0 colors
direct strat has 16 states, 81 edges and 0 colors
EOF
ltlsynt --ins='a,b,c,d' --outs='e' -f '(Fa & Fb & Fc & Fd) <-> GFe' \
--verbose --realizability --algo=lar 2> out
@ -561,9 +560,8 @@ cat >exp <<EOF
trying to create strategy directly for GFa <-> GFb
tanslating formula done in X seconds
direct strategy was found.
direct strat has 1 states and 0 colors
final strategy has 1 states and 2 edges
minimization took X seconds
direct strat has 1 states, 2 edges and 0 colors
simplification took X seconds
trying to create strategy directly for Gc
direct strategy might exist but was not found.
translating formula done in X seconds
@ -574,6 +572,7 @@ split inputs and outputs done in X seconds
automaton has 2 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
EOF
ltlsynt -f '(GFa <-> GFb) && (Gc)' --outs=b,c --verbose 2> out
sed 's/ [0-9.e-]* seconds/ X seconds/g' out > outx
@ -588,9 +587,8 @@ cat >exp <<EOF
trying to create strategy directly for $f
tanslating formula done in X seconds
direct strategy was found.
direct strat has 1 states and 0 colors
final strategy has 1 states and 2 edges
minimization took X seconds
direct strat has 1 states, 2 edges and 0 colors
simplification took X seconds
EOF
ltlsynt -f "$f" --outs=b,c --verbose --decompose=0 --verify 2> out
sed 's/ [0-9.e-]* seconds/ X seconds/g' out > outx
@ -615,9 +613,8 @@ cat >exp <<EOF
trying to create strategy directly for (GFb <-> GFa) & G((a & c) | (!a & !c))
tanslating formula done in X seconds
direct strategy was found.
direct strat has 1 states and 0 colors
final strategy has 1 states and 2 edges
minimization took X seconds
direct strat has 1 states, 2 edges and 0 colors
simplification took X seconds
EOF
ltlsynt -f '(GFb <-> GFa) && (G((a&c)|(!a&!c)))' --outs=b,c --verbose\
--verify --decompose=0 2> out
@ -630,9 +627,8 @@ cat >exp <<EOF
trying to create strategy directly for Fa <-> FGb
tanslating formula done in X seconds
direct strategy was found.
direct strat has 2 states and 0 colors
final strategy has 2 states and 3 edges
minimization took X seconds
direct strat has 2 states, 3 edges and 0 colors
simplification took X seconds
EOF
ltlsynt -f "Fa <-> FGb" --outs=b,c --verbose --decompose=0 --verify 2> out
sed 's/ [0-9.e-]* seconds/ X seconds/g' out > outx
@ -651,6 +647,7 @@ split inputs and outputs done in X seconds
automaton has 9 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
AIG circuit was created in X seconds and has 0 latches and 0 gates
EOF
ltlsynt -f "Ga <-> Gb" --outs=b --verbose --decompose=0 --verify --aiger 2> out
@ -668,6 +665,7 @@ split inputs and outputs done in X seconds
automaton has 4 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
trying to create strategy directly for (a | x) -> x
direct strategy might exist but was not found.
translating formula done in X seconds
@ -678,6 +676,7 @@ split inputs and outputs done in X seconds
automaton has 4 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
AIG circuit was created in X seconds and has 0 latches and 0 gates
EOF
ltlsynt -f '((a|x) & (b | y) & b) => (x & y)' --outs="x,y" --aiger=ite\
@ -697,6 +696,7 @@ split inputs and outputs done in X seconds
automaton has 2 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
trying to create strategy directly for Gy
direct strategy might exist but was not found.
translating formula done in X seconds
@ -707,6 +707,7 @@ split inputs and outputs done in X seconds
automaton has 2 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
AIG circuit was created in X seconds and has 0 latches and 0 gates
EOF
ltlsynt -f 'G!(!x | !y)' --outs="x, y" --aiger=ite --verify --verbose 2> out
@ -760,6 +761,7 @@ split inputs and outputs done in X seconds
automaton has 5 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
AIG circuit was created in X seconds and has 0 latches and 0 gates
EOF
ltlsynt -f '(a & b) U (b & c)' --outs=b,c --decompose=yes --aiger --verbose\
@ -780,6 +782,7 @@ split inputs and outputs done in X seconds
automaton has 4 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
trying to create strategy directly for a -> c
direct strategy might exist but was not found.
translating formula done in X seconds
@ -790,6 +793,7 @@ split inputs and outputs done in X seconds
automaton has 4 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
trying to create strategy directly for a -> d
direct strategy might exist but was not found.
translating formula done in X seconds
@ -800,6 +804,7 @@ split inputs and outputs done in X seconds
automaton has 4 states
solving game with acceptance: Streett 1
game solved in X seconds
simplification took X seconds
AIG circuit was created in X seconds and has 0 latches and 0 gates
EOF
ltlsynt -f 'a => (b & c & d)' --outs=b,c,d, --decompose=yes\

View file

@ -3,6 +3,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "c54c43ba",
"metadata": {},
"outputs": [],
"source": [
@ -12,6 +13,7 @@
},
{
"cell_type": "markdown",
"id": "0576f64a",
"metadata": {},
"source": [
"Additional testing for synthesis"
@ -19,6 +21,7 @@
},
{
"cell_type": "markdown",
"id": "e25b7989",
"metadata": {},
"source": [
"Testing the different methods to solve"
@ -27,6 +30,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "007107a6",
"metadata": {},
"outputs": [
{
@ -50,6 +54,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "a7859f19",
"metadata": {},
"outputs": [
{
@ -57,43 +62,72 @@
"output_type": "stream",
"text": [
"HOA: v1\n",
"States: 7\n",
"States: 21\n",
"Start: 0\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[!0&!1] 1\n",
"[!0&1] 2\n",
"[0&!1] 3\n",
"[0&1] 4\n",
"[!0&!1] 2\n",
"[!0&1] 4\n",
"[0&!1] 6\n",
"[0&1] 8\n",
"State: 1\n",
"[0&1&!2] 4\n",
"[0&!1&!2] 3\n",
"[!0&1&!2] 2\n",
"[!0&!1&!2] 1\n",
"[0&1] 13\n",
"[0&!1] 18\n",
"[!0&1] 19\n",
"[!0&!1] 20\n",
"State: 2\n",
"[0&!2] 4\n",
"[!0&!2] 2\n",
"[t] 1\n",
"State: 3\n",
"[!0&1&2] 5\n",
"[0&1&2] 4\n",
"[!0&!1&2] 6\n",
"[0&!1&2] 3\n",
"[0] 13\n",
"[!0] 19\n",
"State: 4\n",
"[!0&2] 5\n",
"[0&2] 4\n",
"[t] 3\n",
"State: 5\n",
"[!0&!2] 5\n",
"[0&!2] 4\n",
"[!0&1] 10\n",
"[0&1] 11\n",
"[!0&!1] 15\n",
"[0&!1] 16\n",
"State: 6\n",
"[!0&1&!2] 5\n",
"[0&1&!2] 4\n",
"[!0&!1&!2] 6\n",
"[0&!1&!2] 3\n",
"[t] 5\n",
"State: 7\n",
"[!0] 10\n",
"[0] 11\n",
"State: 8\n",
"[t] 7\n",
"State: 9\n",
"[!0] 12\n",
"[0] 13\n",
"State: 10\n",
"[2] 9\n",
"State: 11\n",
"[2] 7\n",
"State: 12\n",
"[!2] 9\n",
"State: 13\n",
"[!2] 7\n",
"State: 14\n",
"[!0&1] 12\n",
"[0&1] 13\n",
"[!0&!1] 17\n",
"[0&!1] 18\n",
"State: 15\n",
"[2] 14\n",
"State: 16\n",
"[2] 5\n",
"State: 17\n",
"[!2] 14\n",
"State: 18\n",
"[!2] 5\n",
"State: 19\n",
"[!2] 3\n",
"State: 20\n",
"[!2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 7\n",
@ -141,163 +175,137 @@
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
"spot-state-player: 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[!0&!1] 7\n",
"[!0&1] 8\n",
"[0&!1] 9\n",
"[0&1] 10\n",
"[!0&!1] 2\n",
"[!0&1] 4\n",
"[0&!1] 6\n",
"[0&1] 8\n",
"State: 1\n",
"[0&1] 11\n",
"[0&!1] 12\n",
"[!0&1] 13\n",
"[!0&!1] 14\n",
"[0&1] 13\n",
"[0&!1] 18\n",
"[!0&1] 19\n",
"[!0&!1] 20\n",
"State: 2\n",
"[0] 11\n",
"[!0] 13\n",
"[t] 1\n",
"State: 3\n",
"[!0&1] 15\n",
"[0&1] 16\n",
"[0] 13\n",
"[!0] 19\n",
"State: 4\n",
"[t] 3\n",
"State: 5\n",
"[!0&1] 10\n",
"[0&1] 11\n",
"[!0&!1] 15\n",
"[0&!1] 16\n",
"State: 6\n",
"[t] 5\n",
"State: 7\n",
"[!0] 10\n",
"[0] 11\n",
"State: 8\n",
"[t] 7\n",
"State: 9\n",
"[!0] 12\n",
"[0] 13\n",
"State: 10\n",
"[2] 9\n",
"State: 11\n",
"[2] 7\n",
"State: 12\n",
"[!2] 9\n",
"State: 13\n",
"[!2] 7\n",
"State: 14\n",
"[!0&1] 12\n",
"[0&1] 13\n",
"[!0&!1] 17\n",
"[0&!1] 18\n",
"State: 4\n",
"[!0] 15\n",
"[0] 16\n",
"State: 5\n",
"[!0] 19\n",
"[0] 11\n",
"State: 6\n",
"[!0&1] 19\n",
"[0&1] 11\n",
"[!0&!1] 20\n",
"[0&!1] 12\n",
"State: 7\n",
"[t] 1\n",
"State: 8\n",
"[t] 2\n",
"State: 9\n",
"[t] 3\n",
"State: 10\n",
"[t] 4\n",
"State: 11\n",
"[!2] 4\n",
"State: 12\n",
"[!2] 3\n",
"State: 13\n",
"[!2] 2\n",
"State: 14\n",
"[!2] 1\n",
"State: 15\n",
"[2] 5\n",
"[2] 14\n",
"State: 16\n",
"[2] 4\n",
"[2] 5\n",
"State: 17\n",
"[2] 6\n",
"[!2] 14\n",
"State: 18\n",
"[2] 3\n",
"State: 19\n",
"[!2] 5\n",
"State: 19\n",
"[!2] 3\n",
"State: 20\n",
"[!2] 6\n",
"[!2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 2\n",
"Start: 1\n",
"States: 21\n",
"Start: 0\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[0&1&!2] 1\n",
"[0&!1&!2] 1\n",
"[!0&1&!2] 0\n",
"[!0&!1&!2] 0\n",
"State: 1\n",
"[!0&1&2] 0\n",
"[0&1&2] 1\n",
"[!0&!1&2] 0\n",
"[0&!1&2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 2\n",
"Start: 1\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[0&1&!2] 1\n",
"[0&!1&!2] 1\n",
"[!0&1&!2] 0\n",
"[!0&!1&!2] 0\n",
"State: 1\n",
"[!0&1&2] 0\n",
"[0&1&2] 1\n",
"[!0&!1&2] 0\n",
"[0&!1&2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 6\n",
"Start: 1\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[0&1] 2\n",
"[0&!1] 2\n",
"[!0&1] 3\n",
"[!0&!1] 3\n",
"State: 1\n",
"[!0&!1] 2\n",
"[!0&1] 4\n",
"[0&1] 5\n",
"[!0&!1] 4\n",
"[0&!1] 5\n",
"State: 2\n",
"[!2] 1\n",
"State: 3\n",
"[!2] 0\n",
"State: 4\n",
"[2] 0\n",
"State: 5\n",
"[2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 6\n",
"Start: 1\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[0] 2\n",
"[!0] 3\n",
"[0&!1] 6\n",
"[0&1] 8\n",
"State: 1\n",
"[0] 4\n",
"[!0] 5\n",
"[0&1] 13\n",
"[0&!1] 18\n",
"[!0&1] 19\n",
"[!0&!1] 20\n",
"State: 2\n",
"[!2] 1\n",
"[t] 1\n",
"State: 3\n",
"[!2] 0\n",
"[0] 13\n",
"[!0] 19\n",
"State: 4\n",
"[2] 1\n",
"[t] 3\n",
"State: 5\n",
"[2] 0\n",
"[!0&1] 10\n",
"[0&1] 11\n",
"[!0&!1] 15\n",
"[0&!1] 16\n",
"State: 6\n",
"[t] 5\n",
"State: 7\n",
"[!0] 10\n",
"[0] 11\n",
"State: 8\n",
"[t] 7\n",
"State: 9\n",
"[!0] 12\n",
"[0] 13\n",
"State: 10\n",
"[2] 9\n",
"State: 11\n",
"[2] 7\n",
"State: 12\n",
"[!2] 9\n",
"State: 13\n",
"[!2] 7\n",
"State: 14\n",
"[!0&1] 12\n",
"[0&1] 13\n",
"[!0&!1] 17\n",
"[0&!1] 18\n",
"State: 15\n",
"[2] 14\n",
"State: 16\n",
"[2] 5\n",
"State: 17\n",
"[!2] 14\n",
"State: 18\n",
"[!2] 5\n",
"State: 19\n",
"[!2] 3\n",
"State: 20\n",
"[!2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 2\n",
"States: 7\n",
"Start: 0\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
@ -306,36 +314,277 @@
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[0&2] 0\n",
"[!0&2] 1\n",
"[!0&!1] 1\n",
"[!0&1] 2\n",
"[0&!1] 3\n",
"[0&1] 4\n",
"State: 1\n",
"[0&!2] 0\n",
"[!0&!2] 1\n",
"[0&1&!2] 4\n",
"[0&!1&!2] 3\n",
"[!0&1&!2] 2\n",
"[!0&!1&!2] 1\n",
"State: 2\n",
"[0&!2] 4\n",
"[!0&!2] 2\n",
"State: 3\n",
"[!0&1&2] 5\n",
"[0&1&2] 4\n",
"[!0&!1&2] 6\n",
"[0&!1&2] 3\n",
"State: 4\n",
"[!0&2] 5\n",
"[0&2] 4\n",
"State: 5\n",
"[!0&!2] 5\n",
"[0&!2] 4\n",
"State: 6\n",
"[!0&1&!2] 5\n",
"[0&1&!2] 4\n",
"[!0&!1&!2] 6\n",
"[0&!1&!2] 3\n",
"--END--\n",
"HOA: v1\n",
"States: 6\n",
"Start: 1\n",
"States: 21\n",
"Start: 0\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 1 1 1 1\n",
"spot-state-player: 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[0] 2\n",
"[!0] 3\n",
"[!0&!1] 2\n",
"[!0&1] 4\n",
"[0&!1] 6\n",
"[0&1] 8\n",
"State: 1\n",
"[0] 4\n",
"[!0] 5\n",
"[0&1] 13\n",
"[0&!1] 18\n",
"[!0&1] 19\n",
"[!0&!1] 20\n",
"State: 2\n",
"[!2] 1\n",
"[t] 1\n",
"State: 3\n",
"[!2] 0\n",
"[0] 13\n",
"[!0] 19\n",
"State: 4\n",
"[2] 1\n",
"[t] 3\n",
"State: 5\n",
"[2] 0\n",
"[!0&1] 10\n",
"[0&1] 11\n",
"[!0&!1] 15\n",
"[0&!1] 16\n",
"State: 6\n",
"[t] 5\n",
"State: 7\n",
"[!0] 10\n",
"[0] 11\n",
"State: 8\n",
"[t] 7\n",
"State: 9\n",
"[!0] 12\n",
"[0] 13\n",
"State: 10\n",
"[2] 9\n",
"State: 11\n",
"[2] 7\n",
"State: 12\n",
"[!2] 9\n",
"State: 13\n",
"[!2] 7\n",
"State: 14\n",
"[!0&1] 12\n",
"[0&1] 13\n",
"[!0&!1] 17\n",
"[0&!1] 18\n",
"State: 15\n",
"[2] 14\n",
"State: 16\n",
"[2] 5\n",
"State: 17\n",
"[!2] 14\n",
"State: 18\n",
"[!2] 5\n",
"State: 19\n",
"[!2] 3\n",
"State: 20\n",
"[!2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 21\n",
"Start: 0\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[!0&!1] 2\n",
"[!0&1] 4\n",
"[0&!1] 6\n",
"[0&1] 8\n",
"State: 1\n",
"[0&1] 13\n",
"[0&!1] 18\n",
"[!0&1] 19\n",
"[!0&!1] 20\n",
"State: 2\n",
"[t] 1\n",
"State: 3\n",
"[0] 13\n",
"[!0] 19\n",
"State: 4\n",
"[t] 3\n",
"State: 5\n",
"[!0&1] 10\n",
"[0&1] 11\n",
"[!0&!1] 15\n",
"[0&!1] 16\n",
"State: 6\n",
"[t] 5\n",
"State: 7\n",
"[!0] 10\n",
"[0] 11\n",
"State: 8\n",
"[t] 7\n",
"State: 9\n",
"[!0] 12\n",
"[0] 13\n",
"State: 10\n",
"[2] 9\n",
"State: 11\n",
"[2] 7\n",
"State: 12\n",
"[!2] 9\n",
"State: 13\n",
"[!2] 7\n",
"State: 14\n",
"[!0&1] 12\n",
"[0&1] 13\n",
"[!0&!1] 17\n",
"[0&!1] 18\n",
"State: 15\n",
"[2] 14\n",
"State: 16\n",
"[2] 5\n",
"State: 17\n",
"[!2] 14\n",
"State: 18\n",
"[!2] 5\n",
"State: 19\n",
"[!2] 3\n",
"State: 20\n",
"[!2] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 7\n",
"Start: 0\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[!0&!1] 1\n",
"[!0&1] 2\n",
"[0&!1] 3\n",
"[0&1] 4\n",
"State: 1\n",
"[0&1&!2] 4\n",
"[0&!1&!2] 3\n",
"[!0&1&!2] 2\n",
"[!0&!1&!2] 1\n",
"State: 2\n",
"[0&!2] 4\n",
"[!0&!2] 2\n",
"State: 3\n",
"[!0&1&2] 5\n",
"[0&1&2] 4\n",
"[!0&!1&2] 6\n",
"[0&!1&2] 3\n",
"State: 4\n",
"[!0&2] 5\n",
"[0&2] 4\n",
"State: 5\n",
"[!0&!2] 5\n",
"[0&!2] 4\n",
"State: 6\n",
"[!0&1&!2] 5\n",
"[0&1&!2] 4\n",
"[!0&!1&!2] 6\n",
"[0&!1&!2] 3\n",
"--END--\n",
"HOA: v1\n",
"States: 21\n",
"Start: 0\n",
"AP: 3 \"i1\" \"i0\" \"o0\"\n",
"acc-name: all\n",
"Acceptance: 0 t\n",
"properties: trans-labels explicit-labels state-acc deterministic\n",
"spot-state-player: 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1\n",
"controllable-AP: 2\n",
"--BODY--\n",
"State: 0\n",
"[!0&!1] 2\n",
"[!0&1] 4\n",
"[0&!1] 6\n",
"[0&1] 8\n",
"State: 1\n",
"[0&1] 13\n",
"[0&!1] 18\n",
"[!0&1] 19\n",
"[!0&!1] 20\n",
"State: 2\n",
"[t] 1\n",
"State: 3\n",
"[0] 13\n",
"[!0] 19\n",
"State: 4\n",
"[t] 3\n",
"State: 5\n",
"[!0&1] 10\n",
"[0&1] 11\n",
"[!0&!1] 15\n",
"[0&!1] 16\n",
"State: 6\n",
"[t] 5\n",
"State: 7\n",
"[!0] 10\n",
"[0] 11\n",
"State: 8\n",
"[t] 7\n",
"State: 9\n",
"[!0] 12\n",
"[0] 13\n",
"State: 10\n",
"[2] 9\n",
"State: 11\n",
"[2] 7\n",
"State: 12\n",
"[!2] 9\n",
"State: 13\n",
"[!2] 7\n",
"State: 14\n",
"[!0&1] 12\n",
"[0&1] 13\n",
"[!0&!1] 17\n",
"[0&!1] 18\n",
"State: 15\n",
"[2] 14\n",
"State: 16\n",
"[2] 5\n",
"State: 17\n",
"[!2] 14\n",
"State: 18\n",
"[!2] 5\n",
"State: 19\n",
"[!2] 3\n",
"State: 20\n",
"[!2] 1\n",
"--END--\n"
]
}
@ -345,7 +594,7 @@
"mm0 = spot.solved_game_to_mealy(game, si)\n",
"msep0 = spot.solved_game_to_separated_mealy(game, si)\n",
"msplit0 = spot.solved_game_to_split_mealy(game, si)\n",
"assert(spot.is_separated_mealy(mm0)) #Not imposed by the functions pre or post, but results of current impl, change if necessary\n",
"assert(spot.is_mealy(mm0))\n",
"assert(spot.is_separated_mealy(msep0))\n",
"assert(spot.is_split_mealy(msplit0))\n",
"print(mm0.to_str(\"hoa\"))\n",
@ -355,7 +604,7 @@
"mm2 = spot.solved_game_to_mealy(game, si)\n",
"msep2 = spot.solved_game_to_separated_mealy(game, si)\n",
"msplit2 = spot.solved_game_to_split_mealy(game, si)\n",
"assert(spot.is_separated_mealy(mm2)) #Not imposed by the functions pre or post, but results of current impl, change if necessary\n",
"assert(spot.is_mealy(mm2))\n",
"assert(spot.is_separated_mealy(msep2))\n",
"assert(spot.is_split_mealy(msplit2))\n",
"print(mm2.to_str(\"hoa\"))\n",
@ -365,7 +614,7 @@
"mm3 = spot.solved_game_to_mealy(game, si)\n",
"msep3 = spot.solved_game_to_separated_mealy(game, si)\n",
"msplit3 = spot.solved_game_to_split_mealy(game, si)\n",
"assert(spot.is_split_mealy(mm3)) #Not imposed by the functions pre or post, but results of current impl, change if necessary\n",
"assert(spot.is_mealy(mm3))\n",
"assert(spot.is_separated_mealy(msep3))\n",
"assert(spot.is_split_mealy(msplit3))\n",
"print(mm3.to_str(\"hoa\"))\n",
@ -376,31 +625,48 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "fb57ac53",
"metadata": {},
"outputs": [],
"source": [
"mus0 = spot.unsplit_mealy(msplit0)\n",
"mus2 = spot.unsplit_mealy(msplit2)\n",
"mus3 = spot.unsplit_mealy(msplit3)\n",
"mmus3 = spot.unsplit_mealy(mm3)"
"mus3 = spot.unsplit_mealy(msplit3)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "40fc65b5",
"metadata": {},
"outputs": [],
"source": [
"assert(mm0.equivalent_to(msep0))\n",
"assert(mm0.equivalent_to(mus0))\n",
"assert(mm2.equivalent_to(msep2))\n",
"assert(mm2.equivalent_to(mus2))\n",
"assert(mmus3.equivalent_to(msep3))\n",
"assert(mmus3.equivalent_to(mus3))"
"assert(mus0.equivalent_to(msep0))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "f6d8b29c",
"metadata": {},
"outputs": [],
"source": [
"assert(mus2.equivalent_to(msep2))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "db8d47f2",
"metadata": {},
"outputs": [],
"source": [
"assert(mus3.equivalent_to(msep3))"
]
},
{
"cell_type": "markdown",
"id": "c19beeb0",
"metadata": {},
"source": [
"Testing related to #495"
@ -408,7 +674,8 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "3736cd1b",
"metadata": {},
"outputs": [
{
@ -470,10 +737,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fee3716f7b0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7458055570> >"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@ -486,7 +753,8 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "da6a7802",
"metadata": {},
"outputs": [
{
@ -552,10 +820,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fee3716f7b0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7458055570> >"
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@ -567,7 +835,8 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "987219a4",
"metadata": {},
"outputs": [
{
@ -675,10 +944,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fee3716f630> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f74580553c0> >"
]
},
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@ -691,7 +960,8 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "958d81f2",
"metadata": {},
"outputs": [
{
@ -772,10 +1042,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fee36703f60> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f743a5ca6c0> >"
]
},
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@ -798,7 +1068,8 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"id": "078bb43e",
"metadata": {},
"outputs": [
{
@ -939,10 +1210,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fee3716f930> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7458059f90> >"
]
},
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@ -955,7 +1226,8 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"id": "05b4a138",
"metadata": {},
"outputs": [
{
@ -1147,10 +1419,10 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fee3716fa20> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7458055870> >"
]
},
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@ -1164,7 +1436,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},

View file

@ -9,7 +9,8 @@
"source": [
"import spot\n",
"spot.setup()\n",
"from spot.jupyter import display_inline"
"from spot.jupyter import display_inline\n",
"import time"
]
},
{
@ -696,7 +697,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f05083f22a0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c2640c0> >"
]
},
"metadata": {},
@ -1668,7 +1669,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c264e40> >"
]
},
"metadata": {},
@ -1855,7 +1856,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c264d50> >"
]
},
"metadata": {},
@ -1992,7 +1993,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c2643c0> >"
]
},
"metadata": {},
@ -2085,7 +2086,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c264a20> >"
]
},
"metadata": {},
@ -2178,7 +2179,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c264ea0> >"
]
},
"metadata": {},
@ -2315,7 +2316,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c2646f0> >"
]
},
"metadata": {},
@ -2342,8 +2343,9 @@
"for i in range(6):\n",
" print(\"simplification lvl \", descr[i])\n",
" si.minimize_lvl = i\n",
" mealy = spot.solved_game_to_separated_mealy(game, si)\n",
" display(mealy.show())"
" mealy = spot.solved_game_to_mealy(game, si)\n",
" spot.simplify_mealy_here(mealy, si.minimize_lvl, False)\n",
" display(mealy)"
]
},
{
@ -2714,7 +2716,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f05083a6900> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f7a0c2640f0> >"
]
},
"metadata": {},
@ -3027,7 +3029,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f05082c7a20> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c009f00> >"
]
},
"metadata": {},
@ -3042,6 +3044,203 @@
"<!-- Generated by graphviz version 2.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"380pt\" height=\"151pt\"\n",
" viewBox=\"0.00 0.00 380.00 151.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 147)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-147 376,-147 376,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"183\" y=\"-127.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
"<text text-anchor=\"start\" x=\"175\" y=\"-112.8\" font-family=\"Lato\" font-size=\"14.00\">[all]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-60\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-56.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-60C2.79,-60 17.15,-60 30.63,-60\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-60 30.94,-63.15 34.44,-60 30.94,-60 30.94,-60 30.94,-60 34.44,-60 30.94,-56.85 37.94,-60 37.94,-60\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>2</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"153,-105 126,-87 153,-69 180,-87 153,-105\"/>\n",
"<text text-anchor=\"middle\" x=\"153\" y=\"-83.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;2 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M73.55,-64.7C88.25,-68.88 109.95,-75.05 126.8,-79.84\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"133.7,-81.8 126.1,-82.91 130.33,-80.84 126.96,-79.88 126.96,-79.88 126.96,-79.88 130.33,-80.84 127.82,-76.85 133.7,-81.8 133.7,-81.8\"/>\n",
"<text text-anchor=\"start\" x=\"94\" y=\"-77.8\" font-family=\"Lato\" font-size=\"14.00\">i0</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>4</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"153,-51 126,-33 153,-15 180,-33 153,-51\"/>\n",
"<text text-anchor=\"middle\" x=\"153\" y=\"-29.3\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;4 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M73.55,-55.3C88.25,-51.12 109.95,-44.95 126.8,-40.16\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"133.7,-38.2 127.82,-43.15 130.33,-39.16 126.96,-40.12 126.96,-40.12 126.96,-40.12 130.33,-39.16 126.1,-37.09 133.7,-38.2 133.7,-38.2\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-52.8\" font-family=\"Lato\" font-size=\"14.00\">!i0</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"255\" cy=\"-87\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"255\" y=\"-83.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;1 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>2&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M180.01,-87C195.43,-87 214.83,-87 229.9,-87\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"236.92,-87 229.92,-90.15 233.42,-87 229.92,-87 229.92,-87 229.92,-87 233.42,-87 229.91,-83.85 236.92,-87 236.92,-87\"/>\n",
"<text text-anchor=\"start\" x=\"200\" y=\"-90.8\" font-family=\"Lato\" font-size=\"14.00\">o0</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node7\" class=\"node\">\n",
"<title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"255\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"255\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;3 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>4&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M175.7,-29.75C191.64,-27.35 213.3,-24.1 229.8,-21.63\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"236.98,-20.55 230.52,-24.71 233.52,-21.07 230.06,-21.59 230.06,-21.59 230.06,-21.59 233.52,-21.07 229.59,-18.48 236.98,-20.55 236.98,-20.55\"/>\n",
"<text text-anchor=\"start\" x=\"198\" y=\"-29.8\" font-family=\"Lato\" font-size=\"14.00\">!o0</text>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>5</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"345,-105 318,-87 345,-69 372,-87 345,-105\"/>\n",
"<text text-anchor=\"middle\" x=\"345\" y=\"-83.3\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;5 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M273.39,-87C284.02,-87 297.98,-87 310.68,-87\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"317.97,-87 310.97,-90.15 314.47,-87 310.97,-87 310.97,-87 310.97,-87 314.47,-87 310.97,-83.85 317.97,-87 317.97,-87\"/>\n",
"<text text-anchor=\"middle\" x=\"295.5\" y=\"-90.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;1 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>5&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M331.15,-77.81C320.54,-71.35 305.02,-64.44 291,-68 286.14,-69.23 281.22,-71.3 276.67,-73.62\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"270.31,-77.13 274.91,-70.99 273.37,-75.44 276.44,-73.74 276.44,-73.74 276.44,-73.74 273.37,-75.44 277.96,-76.5 270.31,-77.13 270.31,-77.13\"/>\n",
"<text text-anchor=\"middle\" x=\"295.5\" y=\"-71.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>3&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M238.68,-9.71C227.37,-4.67 211.63,0.09 198,-4 188.42,-6.87 178.99,-12.59 171.34,-18.19\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"165.36,-22.8 168.98,-16.03 168.13,-20.66 170.9,-18.52 170.9,-18.52 170.9,-18.52 168.13,-20.66 172.82,-21.02 165.36,-22.8 165.36,-22.8\"/>\n",
"<text text-anchor=\"middle\" x=\"208.5\" y=\"-7.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c009180> >"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div style='vertical-align:text-top;display:inline-block;'><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"282pt\" height=\"149pt\"\n",
" viewBox=\"0.00 0.00 282.00 148.80\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 144.8)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-144.8 278,-144.8 278,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"134\" y=\"-125.6\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
"<text text-anchor=\"start\" x=\"126\" y=\"-110.6\" font-family=\"Lato\" font-size=\"14.00\">[all]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-57.8\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-54.1\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-57.8C2.79,-57.8 17.15,-57.8 30.63,-57.8\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-57.8 30.94,-60.95 34.44,-57.8 30.94,-57.8 30.94,-57.8 30.94,-57.8 34.44,-57.8 30.94,-54.65 37.94,-57.8 37.94,-57.8\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>2</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"154,-102.8 127,-84.8 154,-66.8 181,-84.8 154,-102.8\"/>\n",
"<text text-anchor=\"middle\" x=\"154\" y=\"-81.1\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;2 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M72.35,-65.83C78.35,-68.69 85.37,-71.72 92,-73.8 102.08,-76.96 113.4,-79.31 123.53,-81.02\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"130.65,-82.14 123.25,-84.16 127.2,-81.59 123.74,-81.05 123.74,-81.05 123.74,-81.05 127.2,-81.59 124.23,-77.94 130.65,-82.14 130.65,-82.14\"/>\n",
"<text text-anchor=\"start\" x=\"94.5\" y=\"-81.6\" font-family=\"Lato\" font-size=\"14.00\">i0</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>3</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"154,-37.8 127,-19.8 154,-1.8 181,-19.8 154,-37.8\"/>\n",
"<text text-anchor=\"middle\" x=\"154\" y=\"-16.1\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;3 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M70.17,-46.43C76.42,-41.57 84.21,-36.23 92,-32.8 101.9,-28.44 113.37,-25.5 123.67,-23.54\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"130.58,-22.33 124.23,-26.64 127.13,-22.93 123.69,-23.54 123.69,-23.54 123.69,-23.54 127.13,-22.93 123.15,-20.43 130.58,-22.33 130.58,-22.33\"/>\n",
"<text text-anchor=\"start\" x=\"92.5\" y=\"-36.6\" font-family=\"Lato\" font-size=\"14.00\">!i0</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;0 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>2&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M142.06,-74.55C133.71,-67.48 121.55,-58.67 109,-54.8 100.09,-52.05 89.92,-52.01 80.95,-52.93\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"73.75,-53.9 80.27,-49.84 77.22,-53.43 80.69,-52.96 80.69,-52.96 80.69,-52.96 77.22,-53.43 81.11,-56.09 73.75,-53.9 73.75,-53.9\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-58.6\" font-family=\"Lato\" font-size=\"14.00\">o0</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"256\" cy=\"-19.8\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"256\" y=\"-16.1\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>3&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M181.01,-19.8C196.43,-19.8 215.83,-19.8 230.9,-19.8\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"237.92,-19.8 230.92,-22.95 234.42,-19.8 230.92,-19.8 230.92,-19.8 230.92,-19.8 234.42,-19.8 230.91,-16.65 237.92,-19.8 237.92,-19.8\"/>\n",
"<text text-anchor=\"start\" x=\"199\" y=\"-23.6\" font-family=\"Lato\" font-size=\"14.00\">!o0</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;3 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M240.28,-10.26C234.25,-6.88 227.04,-3.51 220,-1.8 205.12,1.8 188.48,-2.97 175.76,-8.51\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"169.13,-11.61 174.13,-5.79 172.3,-10.13 175.47,-8.64 175.47,-8.64 175.47,-8.64 172.3,-10.13 176.81,-11.5 169.13,-11.61 169.13,-11.61\"/>\n",
"<text text-anchor=\"middle\" x=\"209.5\" y=\"-5.6\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n",
"</div><div style='vertical-align:text-top;display:inline-block;'><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"229pt\" height=\"85pt\"\n",
" viewBox=\"0.00 0.00 228.50 85.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 81)\">\n",
@ -3099,10 +3298,11 @@
"<text text-anchor=\"start\" x=\"196\" y=\"-61.3\" font-family=\"Lato\" font-size=\"14.00\">!o0</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
"</svg>\n",
"</div>"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f05083f2300> >"
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
@ -3179,7 +3379,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f05083f28d0> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f7a0c009ea0> >"
]
},
"metadata": {},
@ -3191,8 +3391,10 @@
"spot.solve_game(game)\n",
"spot.highlight_strategy(game)\n",
"display(game)\n",
"mealy = spot.solved_game_to_separated_mealy(game)\n",
"mealy = spot.solved_game_to_mealy(game)\n",
"display(mealy)\n",
"spot.simplify_mealy_here(mealy, 2, True)\n",
"display_inline(mealy, spot.unsplit_mealy(mealy))\n",
"aig = spot.mealy_machine_to_aig(mealy, \"isop\")\n",
"display(aig)"
]
@ -3306,7 +3508,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f05083a64b0> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f7a0c009690> >"
]
},
"metadata": {},
@ -3738,7 +3940,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f05083f2fc0> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f7a0c3edc30> >"
]
},
"metadata": {},
@ -3803,7 +4005,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f05082c7ba0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c009de0> >"
]
},
"metadata": {},
@ -3916,7 +4118,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f05082cff00> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f7a0c00fe70> >"
]
},
"metadata": {},
@ -4096,7 +4298,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f05082c7660> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f7a0c009a80> >"
]
},
"metadata": {},
@ -4220,7 +4422,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f05082c7690> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f7a0c2640c0> >"
]
},
"execution_count": 16,