gen: hide ks_cobuchi(), introduce aut_pattern()

* spot/gen/automata.hh, spot/gen/automata.cc: Hide ks_cobuchi() behind
introduce aut_pattern(), as we have already done for the formulas.
* bin/genaut.cc: Simplify using this interface.
* python/spot/gen.i: Introduce aut_patterns().
* tests/python/gen.ipynb, tests/python/gen.py: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2017-04-27 11:47:19 +02:00
parent ca7f72bb4b
commit 11ca2803c9
6 changed files with 216 additions and 122 deletions

View file

@ -45,7 +45,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 13
"prompt_number": 1
},
{
"cell_type": "markdown",
@ -71,13 +71,13 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"prompt_number": 2,
"text": [
"GFp1 & GFp2 & GFp3"
]
}
],
"prompt_number": 14
"prompt_number": 2
},
{
"cell_type": "code",
@ -94,13 +94,13 @@
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 15,
"prompt_number": 3,
"text": [
"F(p & Xp & XXp & XXXp) & F(q & Xq & XXq & XXXq)"
]
}
],
"prompt_number": 15
"prompt_number": 3
},
{
"cell_type": "markdown",
@ -289,7 +289,7 @@
]
}
],
"prompt_number": 20
"prompt_number": 4
},
{
"cell_type": "markdown",
@ -304,7 +304,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"sg.ks_cobuchi(3).show('.a')"
"sg.aut_pattern(sg.AUT_KS_COBUCHI, 3).show('.a')"
],
"language": "python",
"metadata": {},
@ -312,7 +312,7 @@
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 23,
"prompt_number": 5,
"svg": [
"<svg height=\"295pt\" viewBox=\"0.00 0.00 734.00 295.41\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.906173 0.906173) rotate(0) translate(4 322)\">\n",
@ -491,7 +491,43 @@
]
}
],
"prompt_number": 23
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Multiple automata can be generated using the `aut_patterns()` function, which works similarly to `ltl_patterns()`."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for aut in sg.aut_patterns(sg.AUT_KS_COBUCHI):\n",
" print(aut.num_states())"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"3\n",
"5\n",
"7\n",
"9\n",
"11\n",
"13\n",
"15\n",
"17\n",
"19\n",
"21\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",