rename game_info to synthesis_info; move it with the synthesis code

* spot/twaalgos/game.cc, spot/twaalgos/game.hh (game_info): Move...
* spot/twaalgos/synthesis.cc,
spot/twaalgos/synthesis.hh (synthesis_info): ... here, because this
structure contains only synthesis stuff.  Also rename "solver" to
"algo" to match the ltlsynt option.
(solve_game): Move the two argument version of this function here,
since that's the only game-related generic function that use
synthesis_info.
* bin/ltlsynt.cc, tests/core/ltlsynt.test, tests/python/games.ipynb,
tests/python/synthesis.py, NEWS: Adjust all uses and mentions.
This commit is contained in:
Alexandre Duret-Lutz 2021-10-06 22:51:10 +02:00
parent 0ac5bbc05d
commit bdd20bd1a1
9 changed files with 217 additions and 225 deletions

View file

@ -676,7 +676,7 @@
"- Solving the game\n",
"- Obtaining the strategy\n",
"\n",
"Each of these steps is parametrized by the same options structure called game_info."
"Each of these steps is parametrized by the same option structure called `synthesis_info`."
]
},
{
@ -688,8 +688,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"game has 29 states, and 55 edges.\n",
"output propositions are ('o0',)\n"
"game has 29 states and 55 edges\n",
"output propositions are: o0\n"
]
},
{
@ -1340,7 +1340,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f0ddc16bd50> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f78f67a4450> >"
]
},
"metadata": {},
@ -1349,13 +1349,12 @@
],
"source": [
"#Create the game\n",
"gi = spot.game_info()\n",
"gi.s = spot.game_info.solver_LAR #Use lar solver\n",
"gi = spot.synthesis_info()\n",
"gi.s = spot.synthesis_info.algo_LAR # Use LAR algorithm\n",
"\n",
"#Todo arena changes when executed multiple times\n",
"game = spot.create_game(\"G((F(i0) && F(i1))->(G(i1<->(X(o0)))))\", [\"o0\"], gi)\n",
"print(\"game has \", game.num_states(), \" states, and \", game.num_edges(), \" edges.\")\n",
"print(\"output propositions are \", spot.get_synthesis_output_aps(game))\n",
"print(\"game has\", game.num_states(), \"states and\", game.num_edges(), \"edges\")\n",
"print(\"output propositions are:\", \", \".join(spot.get_synthesis_output_aps(game)))\n",
"display(game)"
]
},
@ -1368,7 +1367,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Found a solution: True\n"
"Found a solution: True\n"
]
},
{
@ -1974,7 +1973,7 @@
],
"source": [
"#Solve the game\n",
"print(\"Found a solution: \", spot.solve_game(game))\n",
"print(\"Found a solution:\", spot.solve_game(game))\n",
"spot.highlight_strategy(game)\n",
"game.show('.g')"
]
@ -1988,7 +1987,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"minimization lvl 0\n"
"simplification lvl 0\n"
]
},
{
@ -2223,7 +2222,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"minimization lvl 1\n"
"simplification lvl 1\n"
]
},
{
@ -2364,7 +2363,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"minimization lvl 2\n"
"simplification lvl 2\n"
]
},
{
@ -2471,7 +2470,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"minimization lvl 3\n"
"simplification lvl 3\n"
]
},
{
@ -2550,7 +2549,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"minimization lvl 4\n"
"simplification lvl 4\n"
]
},
{
@ -2629,7 +2628,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"minimization lvl 5\n"
"simplification lvl 5\n"
]
},
{
@ -2707,16 +2706,16 @@
],
"source": [
"# Create the strategy\n",
"# We have different strategies for minimization:\n",
"# 0 : No minimizaiton\n",
"# 1 : DFA minimization\n",
"# 2 : Inclusion based minimization with output assignement\n",
"# 3 : SAT based exact minimization\n",
"# We have different levels of simplification:\n",
"# 0 : No simplification\n",
"# 1 : bisimulation-based reduction\n",
"# 2 : bisimulation-based reduction with output output assignement\n",
"# 3 : SAT-based exact minimization\n",
"# 4 : First 1 then 3 (exact)\n",
"# 5 : First 2 then 3 (not exact)\n",
"for i in range(6):\n",
" print(\"minimization lvl \", i)\n",
" gi.minimize_lvl = i #Use inclusion with output assignement to minimize the strategy\n",
" print(\"simplification lvl\", i)\n",
" gi.minimize_lvl = i\n",
" strat = spot.create_strategy(game, gi)\n",
" display(strat.show())"
]
@ -3130,7 +3129,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f0ddc16b720> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f78f67a4c90> >"
]
},
"execution_count": 11,
@ -3139,8 +3138,7 @@
}
],
"source": [
"gi.minimize_lvl = 0\n",
"spot.apply_strategy(game, False, False)\n"
"spot.apply_strategy(game, False, False)"
]
},
{
@ -3409,7 +3407,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f0ddc16bf30> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f78f67a4330> >"
]
},
"execution_count": 12,
@ -3772,7 +3770,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f0ddc30cab0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f79040eeed0> >"
]
},
"execution_count": 15,
@ -4074,7 +4072,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f0ddc26b480> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f78f67b83c0> >"
]
},
"metadata": {},
@ -4201,7 +4199,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f0ddc26bea0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f78f67b8c00> >"
]
},
"execution_count": 22,
@ -4255,7 +4253,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0ddc26b930> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f79041b4420> >"
]
},
"execution_count": 23,
@ -4328,7 +4326,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0ddc26be70> >"
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f78f67a4300> >"
]
},
"execution_count": 24,