rename pg_print() as print_pg() and add it to to_str()

* NEWS: Mention those change.
* spot/twaalgos/game.hh (print_pg): New function.
(pg_print): Mark as deprecated.
* spot/twaalgos/game.cc (pg_print): Redirect to print_pg().
(print_pg): Update to output state names.
* python/spot/__init__.py: Teach to_str() about print_pg().
* bin/ltlsynt.cc: Adjust to call print_pg().
* tests/python/games.ipynb: Add an example.
* tests/core/ltlsynt.test: Adjust to remove the "INIT" note.
This commit is contained in:
Alexandre Duret-Lutz 2022-07-22 16:52:03 +02:00
parent b3e994c249
commit 8b93b6967d
7 changed files with 145 additions and 68 deletions

View file

@ -897,7 +897,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f8f1861bd20> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7feee9b0ebb0> >"
]
},
"execution_count": 8,
@ -1224,7 +1224,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f8f187f5ef0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fef001c87b0> >"
]
},
"execution_count": 11,
@ -1240,7 +1240,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Input in PGSolver format\n",
"# Input/Output in PGSolver format\n",
"\n",
"The automaton parser is also able to parse the [PGSolver](https://github.com/tcsprojects/pgsolver) format. Here are two examples from the manual of PGSolver. The support for C-style comments is not part of the PGSolver format.\n",
"\n",
@ -1623,6 +1623,45 @@
"display(a.show('.g'), b.show('.g'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To output a parity-game in PG-solver format, use `to_str('pg')`."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"parity 4;\n",
"0 6 1 4,2 \"Africa\";\n",
"2 7 0 3,1,0,4 \"Asia\";\n",
"4 5 1 0 \"Antarctica\";\n",
"1 8 1 2,4,3 \"America\";\n",
"3 6 0 4,2 \"Australia\";\n",
"parity 7;\n",
"0 0 0 1,2;\n",
"2 0 0 3,4;\n",
"4 0 0 5,6;\n",
"6 0 0 7,0;\n",
"7 1 1 0,1;\n",
"1 1 1 2,3;\n",
"3 1 1 4,5;\n",
"5 1 1 6,7;\n",
"\n"
]
}
],
"source": [
"print(a.to_str('pg') + b.to_str('pg'))"
]
},
{
"cell_type": "code",
"execution_count": null,