Improving minimize_mealy benchmarking

* python/spot/__init__.py: Adding helper function for
inline plot of csv
*spot/twaalgos/mealy_machine.cc, spot/twaalgos/mealy_machine.hh:
Main changes
* tests/python/_mealy.ipynb: Update
* tests/python/ipnbdoctest.py: Ignore timing table
* tests/python/synthesis.ipynb: Update
This commit is contained in:
Philipp Schlehuber-Caissier 2022-09-14 16:44:12 +02:00
parent c63c1796b9
commit 4a24739c3f
6 changed files with 1609 additions and 63 deletions

View file

@ -3,6 +3,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "4f84fa79",
"metadata": {},
"outputs": [],
"source": [
@ -13,6 +14,7 @@
},
{
"cell_type": "markdown",
"id": "4ad017a0",
"metadata": {},
"source": [
"This notebook presents functions that can be used to solve the Reactive Synthesis problem using games.\n",
@ -37,6 +39,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "e333be09",
"metadata": {},
"outputs": [
{
@ -655,6 +658,7 @@
},
{
"cell_type": "markdown",
"id": "4d030586",
"metadata": {},
"source": [
"Solving the game, is done with `solve_game()` as with any game. There is also a version that takes a `synthesis_info` as second argument in case the time it takes has to be recorded. Here passing `si` or not makes no difference."
@ -663,6 +667,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "f13ac820",
"metadata": {},
"outputs": [
{
@ -1222,6 +1227,7 @@
},
{
"cell_type": "markdown",
"id": "98aa1402",
"metadata": {},
"source": [
"Once a strategy has been found, it can be extracted as an automaton and simplified using 6 different levels (the default is 2). The output should be interpreted as a Mealy automaton, where transition have the form `(ins)&(outs)` where `ins` and `outs` are Boolean formulas representing possible inputs and outputs (they could be more than just conjunctions of atomic proposition). Mealy machines with this type of labels are called \"separated\" in Spot."
@ -1230,6 +1236,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "4c93add7",
"metadata": {},
"outputs": [
{
@ -2228,6 +2235,7 @@
},
{
"cell_type": "markdown",
"id": "9d8d52f6",
"metadata": {},
"source": [
"If needed, a separated Mealy machine can be turned into game shape using `split_sepearated_mealy()`, which is more efficient than `split_2step()`."
@ -2236,6 +2244,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "707f4cf6",
"metadata": {},
"outputs": [
{
@ -2517,6 +2526,7 @@
},
{
"cell_type": "markdown",
"id": "b9e4412e",
"metadata": {},
"source": [
"# Converting the separated Mealy machine to AIG\n",
@ -2529,6 +2539,7 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "9f344931",
"metadata": {},
"outputs": [
{
@ -2604,6 +2615,7 @@
},
{
"cell_type": "markdown",
"id": "92bbe8d0",
"metadata": {},
"source": [
"While we are at it, let us mention that you can render those circuits horizontally as follows:"
@ -2612,6 +2624,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "3ae7ce32",
"metadata": {},
"outputs": [
{
@ -2687,6 +2700,7 @@
},
{
"cell_type": "markdown",
"id": "44fbc0ac",
"metadata": {},
"source": [
"To encode the circuit in the AIGER format (ASCII version) use:"
@ -2695,6 +2709,7 @@
{
"cell_type": "code",
"execution_count": 8,
"id": "566715d5",
"metadata": {},
"outputs": [
{
@ -2718,6 +2733,7 @@
},
{
"cell_type": "markdown",
"id": "ef304f36",
"metadata": {},
"source": [
"# Adding more inputs and outputs by force"
@ -2725,6 +2741,7 @@
},
{
"cell_type": "markdown",
"id": "5c2b0b78",
"metadata": {},
"source": [
"It can happen that propositions declared as output are ommited in the aig circuit (either because they are not part of the specification, or because they do not appear in the winning strategy). In that case those \n",
@ -2736,6 +2753,7 @@
{
"cell_type": "code",
"execution_count": 9,
"id": "874c7df1",
"metadata": {},
"outputs": [
{
@ -3260,6 +3278,7 @@
},
{
"cell_type": "markdown",
"id": "c564dba3",
"metadata": {},
"source": [
"To force the presence of extra variables in the circuit, they can be passed to `mealy_machine_to_aig()`."
@ -3268,6 +3287,7 @@
{
"cell_type": "code",
"execution_count": 10,
"id": "c31a3b38",
"metadata": {},
"outputs": [
{
@ -3378,6 +3398,7 @@
},
{
"cell_type": "markdown",
"id": "3323fc84",
"metadata": {},
"source": [
"# Combining Mealy machines\n",
@ -3397,6 +3418,7 @@
{
"cell_type": "code",
"execution_count": 11,
"id": "5d8e4cdb",
"metadata": {},
"outputs": [
{
@ -3991,6 +4013,7 @@
},
{
"cell_type": "markdown",
"id": "c7a1986f",
"metadata": {},
"source": [
"# Reading an AIGER-file\n",
@ -4005,6 +4028,7 @@
{
"cell_type": "code",
"execution_count": 12,
"id": "a10d7e3b",
"metadata": {},
"outputs": [],
"source": [
@ -4025,6 +4049,7 @@
{
"cell_type": "code",
"execution_count": 13,
"id": "2c40e19b",
"metadata": {},
"outputs": [
{
@ -4149,6 +4174,7 @@
{
"cell_type": "code",
"execution_count": 14,
"id": "0ad6c566",
"metadata": {},
"outputs": [
{
@ -4177,6 +4203,7 @@
{
"cell_type": "code",
"execution_count": 15,
"id": "2e1996c1",
"metadata": {},
"outputs": [
{
@ -4193,6 +4220,7 @@
},
{
"cell_type": "markdown",
"id": "41a8e042",
"metadata": {},
"source": [
"An AIG circuit can be transformed into a monitor/Mealy machine. This can be used for instance to check that it does not intersect the negation of the specification."
@ -4201,6 +4229,7 @@
{
"cell_type": "code",
"execution_count": 16,
"id": "7399ea38",
"metadata": {},
"outputs": [
{
@ -4268,6 +4297,7 @@
},
{
"cell_type": "markdown",
"id": "7ac06afc",
"metadata": {},
"source": [
"Note that the generation of aiger circuits from Mealy machines is flexible and accepts separated Mealy machines\n",
@ -4277,6 +4307,7 @@
{
"cell_type": "code",
"execution_count": 17,
"id": "bac68923",
"metadata": {},
"outputs": [
{
@ -4424,6 +4455,7 @@
{
"cell_type": "code",
"execution_count": 18,
"id": "03ceb2a8",
"metadata": {},
"outputs": [
{
@ -4626,7 +4658,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@ -4640,7 +4672,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.8.10"
}
},
"nbformat": 4,