y_petri 2.1.24 → 2.1.25
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 +4 -4
- data/README.md +5 -7
- data/lib/y_petri/core/timed/gillespie.rb +8 -8
- data/lib/y_petri/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 030fcecf74aac2f5368653e8da16153bcf2e7049
|
4
|
+
data.tar.gz: 71a2bf7fa5ad36779ae3402ac4bf6a80478a971e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df9f49e6fbcb9727109a565b06465fb172a4bba0f1fc3762175cc9f4f8a790257eb640ff46cbe998fd58ada72dfe58e31d726bb171da16e2e0ae88b7996c19c8
|
7
|
+
data.tar.gz: 5046af4b8050a2169d402be60e805bebbe9b9909a3158170816c57b499e1c8ffc20d79824cde399269293f6be3ebac2788ebfa62f95247bb4c69c70cac9802ef
|
data/README.md
CHANGED
@@ -55,13 +55,11 @@ We can now play the _token_ _game_:
|
|
55
55
|
## Advanced usage
|
56
56
|
|
57
57
|
A Petri net is mostly used as a wiring diagram of some real-world system. Such
|
58
|
-
Petri net can then be used to generate
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
then be used to eg. solve the initial value problem by numeric integration of the
|
64
|
-
ODE system using one of the available numerical methods:
|
58
|
+
Petri net can then be used to generate its simulation -- represented by
|
59
|
+
`YPetri::Simulation` class. A Petri net consisting of only _timed_ transitions
|
60
|
+
can be used to generate (implicitly or explicitly) a system of ordinary
|
61
|
+
differential equations (ODE). A simulation generated from such Petri net can
|
62
|
+
then be used to solve (eg.) the initial value problem by numeric methods:
|
65
63
|
```ruby
|
66
64
|
# Start a fresh irb session!
|
67
65
|
require 'y_petri'
|
@@ -19,17 +19,17 @@ module YPetri::Core::Timed::Gillespie
|
|
19
19
|
# Makes a stochastic number of Gillespie steps necessary to span the period Δt.
|
20
20
|
#
|
21
21
|
def step! Δt=simulation.step
|
22
|
-
|
23
|
-
target_time =
|
24
|
-
@gillespie_time = current_time
|
22
|
+
@gillespie_time = curr_time = simulation.time
|
23
|
+
target_time = curr_time + Δt
|
25
24
|
propensities = propensity_vector_TS
|
26
25
|
puts "Propensity vector TS is:"
|
27
26
|
Kernel::p propensities
|
28
|
-
|
29
|
-
until ( @
|
27
|
+
update_next_gillespie_time( propensities )
|
28
|
+
until ( @next_gillespie_time > target_time )
|
30
29
|
gillespie_step!
|
30
|
+
note_state_change
|
31
31
|
propensities = propensity_vector_TS
|
32
|
-
|
32
|
+
update_next_gillespie_time( propensities )
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -41,8 +41,8 @@ module YPetri::Core::Timed::Gillespie
|
|
41
41
|
|
42
42
|
# This method updates next firing time given propensities.
|
43
43
|
#
|
44
|
-
def
|
45
|
-
@
|
44
|
+
def update_next_gillespie_time( propensities )
|
45
|
+
@next_gillespie_time =
|
46
46
|
@gillespie_time + gillespie_delta_time( propensities )
|
47
47
|
end
|
48
48
|
|
data/lib/y_petri/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: y_petri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- boris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: y_support
|