y_petri 2.1.30 → 2.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a29f67d51f216827623f8644ed4d62b5b9571413
4
- data.tar.gz: f7f37ade4f8d98a67325bde2fd05da466d27a1d6
3
+ metadata.gz: 4c98edfb8140dbc62e7012bd0ce4d25978451e22
4
+ data.tar.gz: 6c3d695901347b8bf8deac87999bc588c21ed503
5
5
  SHA512:
6
- metadata.gz: 51718ecc0d946472ac976594d6a6be4ff530b53b07d9eb060be4371b07434a6a32263e8ef262ac00b8ffc13bc1b5f8e2241220b1bd1d96ab2236bcaf3ad6bda2
7
- data.tar.gz: 67437f897b783d283e19542186b22670b3dc43ea1bed8510b9114b8b2e470dcc4562d876e8d3a89918da799430102c3bd2e0ab3fa3a1668a4073696a8d2f29cb
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
@@ -1,4 +1,4 @@
1
1
  module YPetri
2
- VERSION = "2.1.30"
2
+ VERSION = "2.1.31"
3
3
  DEBUG = false
4
4
  end
@@ -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' # This pathway model uses 'sy' metrology domain model.
10
- require 'mathn' # Standard library 'mathn' is required.
11
- include YPetri # pull in the DSL
5
+ require 'sy'
6
+ require 'mathn'
7
+ include YPetri
12
8
 
13
9
  A = Place m!: 10
14
10
  B = Place m!: 10
15
- A2B = Transition s: { A: -1, B: 1 }, rate: 0.1
16
- B2A = Transition s: { A: 1, B: -1 }, rate: 0.05
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 # in seconds
19
- set_target_time 100
17
+ set_step 1
18
+ set_target_time 50
20
19
  set_sampling 1
21
20
  set_simulation_method :gillespie
22
- sim = new_simulation guarded: false
21
+
23
22
  run!
24
23
 
24
+ print_recording
25
+
25
26
  plot_state
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_petri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.30
4
+ version: 2.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris