y_petri 2.1.30 → 2.1.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -0
- data/lib/y_petri/version.rb +1 -1
- data/test/examples/gillespie.rb +13 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c98edfb8140dbc62e7012bd0ce4d25978451e22
|
4
|
+
data.tar.gz: 6c3d695901347b8bf8deac87999bc588c21ed503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78e6c1c2aa034e7e893411600381d3e4bad5cd4ec3e5a12f5dbc1a10fb938d7c90c0258a252474391b7f3092994f8b6b28e74bc17c26d61c8a6d7721871e30c6
|
7
|
+
data.tar.gz: bec532ac1b9c25649a75e34d6e7806a774d231e6cdefc990c555559324ebc92a98cc460ac28004bba5f3f357a66a9191fcf1475c76c272ac26caaff20fb43997
|
data/README.md
CHANGED
@@ -85,6 +85,37 @@ If you have `gnuplot` gem installed properly, you can view plots:
|
|
85
85
|
plot_state
|
86
86
|
plot_flux
|
87
87
|
```
|
88
|
+
## Gillespie method
|
89
|
+
|
90
|
+
To try out another simulation method, Gillespie algorithm, open a fresh session
|
91
|
+
and type:
|
92
|
+
```ruby
|
93
|
+
require 'y_petri'
|
94
|
+
require 'sy'
|
95
|
+
require 'mathn'
|
96
|
+
include YPetri
|
97
|
+
|
98
|
+
A = Place m!: 10
|
99
|
+
B = Place m!: 10
|
100
|
+
AB = Place m!: 0
|
101
|
+
AB_association = Transition s: { A: -1, B: -1, AB: 1 }, rate: 0.1
|
102
|
+
AB_dissociation = Transition s: { AB: -1, A: 1, B: 1 }, rate: 0.1
|
103
|
+
A2B = Transition s: { A: -1, B: 1 }, rate: 0.05
|
104
|
+
B2A = Transition s: { A: 1, B: -1 }, rate: 0.07
|
105
|
+
|
106
|
+
set_step 1
|
107
|
+
set_target_time 50
|
108
|
+
set_sampling 1
|
109
|
+
set_simulation_method :gillespie
|
110
|
+
|
111
|
+
run!
|
112
|
+
|
113
|
+
print_recording
|
114
|
+
```
|
115
|
+
Again, you can visualize the results using `gnuplot` gem:
|
116
|
+
```ruby
|
117
|
+
plot_state
|
118
|
+
```
|
88
119
|
So much for the demo for now! Thanks for trying YPetri!
|
89
120
|
|
90
121
|
## Contributing
|
data/lib/y_petri/version.rb
CHANGED
data/test/examples/gillespie.rb
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
#! /usr/bin/ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
# ==============================================================================
|
5
|
-
#
|
6
2
|
# encoding: utf-8
|
7
3
|
|
8
4
|
require 'y_petri'
|
9
|
-
require 'sy'
|
10
|
-
require 'mathn'
|
11
|
-
include YPetri
|
5
|
+
require 'sy'
|
6
|
+
require 'mathn'
|
7
|
+
include YPetri
|
12
8
|
|
13
9
|
A = Place m!: 10
|
14
10
|
B = Place m!: 10
|
15
|
-
|
16
|
-
|
11
|
+
AB = Place m!: 0
|
12
|
+
AB_association = Transition s: { A: -1, B: -1, AB: 1 }, rate: 0.1
|
13
|
+
AB_dissociation = Transition s: { AB: -1, A: 1, B: 1 }, rate: 0.1
|
14
|
+
A2B = Transition s: { A: -1, B: 1 }, rate: 0.05
|
15
|
+
B2A = Transition s: { A: 1, B: -1 }, rate: 0.07
|
17
16
|
|
18
|
-
set_step 1
|
19
|
-
set_target_time
|
17
|
+
set_step 1
|
18
|
+
set_target_time 50
|
20
19
|
set_sampling 1
|
21
20
|
set_simulation_method :gillespie
|
22
|
-
|
21
|
+
|
23
22
|
run!
|
24
23
|
|
24
|
+
print_recording
|
25
|
+
|
25
26
|
plot_state
|