example: Show how to build state graphs of TBN.
This commit is contained in:
parent
b3d2ed94ec
commit
20b3357910
1 changed files with 39 additions and 0 deletions
|
@ -1019,6 +1019,45 @@ tab
|
|||
| -2 | 1 |
|
||||
:end:
|
||||
|
||||
Finally, =dds= defines utilities for working with TBN (networks of
|
||||
TBF). For example, here is how you can define and read a TBN from
|
||||
a table:
|
||||
|
||||
#+NAME: tbfs-nots
|
||||
| - | x | y | θ |
|
||||
| y | -1 | 0 | -1 |
|
||||
| x | 0 | -1 | -1 |
|
||||
|
||||
#+BEGIN_SRC racket :results output drawer :var tbfs-nots=munch-sexp(tbfs-nots)
|
||||
(read-org-tbn tbfs-nots)
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
:results:
|
||||
(hash 'x (tbf/state '#hash((x . 0) (y . -1)) -1) 'y (tbf/state '#hash((x . -1) (y . 0)) -1))
|
||||
:end:
|
||||
|
||||
To take a look at the behaviour of this TBN, you can convert it to
|
||||
a =network= using =tbn->network= and build its state graph:
|
||||
|
||||
#+NAME: tbfs-nots-sg
|
||||
#+BEGIN_SRC racket :results silent drawer :var tbfs-nots=munch-sexp(tbfs-nots)
|
||||
(dotit ((compose pretty-print-state-graph
|
||||
build-full-01-state-graph
|
||||
make-syn-dynamics
|
||||
tbn->network
|
||||
read-org-tbn) tbfs-nots))
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC dot :file dots/examplew206DH.svg :results raw drawer :cmd sfdp :noweb yes
|
||||
<<tbfs-nots-sg()>>
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
:results:
|
||||
[[file:dots/examplew206DH.svg]]
|
||||
:end:
|
||||
|
||||
* Reaction systems
|
||||
:PROPERTIES:
|
||||
:header-args:racket: :prologue "#lang racket\n(require graph dds/rs dds/utils)"
|
||||
|
|
Loading…
Reference in a new issue