y_petri 2.1.3 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/y_petri/agent/petri_net_related.rb +25 -5
- data/lib/y_petri/agent/selection.rb +12 -10
- data/lib/y_petri/agent/simulation_related.rb +14 -58
- data/lib/y_petri/agent.rb +15 -17
- data/lib/y_petri/core/timed/euler.rb +13 -15
- data/lib/y_petri/core/timed/pseudo_euler.rb +22 -24
- data/lib/y_petri/core/timed/quasi_euler.rb +15 -17
- data/lib/y_petri/core/timed.rb +42 -44
- data/lib/y_petri/core/timeless/pseudo_euler.rb +12 -14
- data/lib/y_petri/core/timeless.rb +10 -7
- data/lib/y_petri/core.rb +3 -3
- data/lib/y_petri/dsl.rb +46 -46
- data/lib/y_petri/fixed_assets.rb +8 -0
- data/lib/y_petri/net/data_set.rb +238 -0
- data/lib/y_petri/net/own_state.rb +63 -0
- data/lib/y_petri/net/state/feature/delta.rb +98 -71
- data/lib/y_petri/net/state/feature/firing.rb +51 -54
- data/lib/y_petri/net/state/feature/flux.rb +51 -55
- data/lib/y_petri/net/state/feature/gradient.rb +55 -59
- data/lib/y_petri/net/state/feature/marking.rb +55 -59
- data/lib/y_petri/net/state/feature.rb +65 -67
- data/lib/y_petri/net/state/features/record.rb +150 -43
- data/lib/y_petri/net/state/features.rb +252 -96
- data/lib/y_petri/net/state.rb +114 -106
- data/lib/y_petri/net/visualization.rb +3 -2
- data/lib/y_petri/net.rb +29 -24
- data/lib/y_petri/place/arcs.rb +3 -3
- data/lib/y_petri/place/guard.rb +35 -117
- data/lib/y_petri/place/guarded.rb +86 -0
- data/lib/y_petri/place.rb +6 -3
- data/lib/y_petri/simulation/element_representation.rb +2 -2
- data/lib/y_petri/simulation/elements.rb +3 -1
- data/lib/y_petri/simulation/feature_set.rb +3 -1
- data/lib/y_petri/simulation/marking_vector.rb +3 -1
- data/lib/y_petri/simulation/place_mapping.rb +3 -1
- data/lib/y_petri/simulation/places.rb +1 -1
- data/lib/y_petri/simulation/recorder.rb +60 -54
- data/lib/y_petri/simulation/timed/recorder.rb +12 -1
- data/lib/y_petri/simulation/timed.rb +173 -172
- data/lib/y_petri/simulation/transitions/access.rb +97 -29
- data/lib/y_petri/simulation.rb +11 -9
- data/lib/y_petri/transition/{assignment.rb → A.rb} +2 -2
- data/lib/y_petri/transition/{timed.rb → T.rb} +2 -2
- data/lib/y_petri/transition/arcs.rb +3 -3
- data/lib/y_petri/transition/cocking.rb +3 -3
- data/lib/y_petri/transition/{init.rb → construction_convenience.rb} +6 -53
- data/lib/y_petri/transition/{ordinary_timeless.rb → t.rb} +2 -2
- data/lib/y_petri/transition/type.rb +103 -0
- data/lib/y_petri/transition/type_information.rb +103 -0
- data/lib/y_petri/transition/types.rb +107 -0
- data/lib/y_petri/transition/usable_without_world.rb +14 -0
- data/lib/y_petri/transition.rb +87 -101
- data/lib/y_petri/version.rb +1 -1
- data/lib/y_petri/world/dependency.rb +30 -28
- data/lib/y_petri/world.rb +10 -8
- data/test/acceptance/basic_usage_test.rb +3 -3
- data/test/acceptance/simulation_test.rb +3 -3
- data/test/acceptance/simulation_with_physical_units_test.rb +2 -2
- data/test/acceptance/token_game_test.rb +2 -2
- data/test/acceptance/visualization_test.rb +3 -3
- data/test/acceptance_tests.rb +2 -2
- data/test/agent_test.rb +1 -1
- data/test/net_test.rb +41 -17
- data/test/place_test.rb +1 -1
- data/test/simulation_test.rb +39 -39
- data/test/transition_test.rb +1 -1
- data/test/world_test.rb +1 -1
- data/test/y_petri_test.rb +1 -1
- metadata +13 -8
- data/lib/y_petri/net/state/features/dataset.rb +0 -135
- data/lib/y_petri/transition/construction.rb +0 -311
@@ -0,0 +1,107 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative 'T'
|
4
|
+
require_relative 't'
|
5
|
+
require_relative 'A'
|
6
|
+
|
7
|
+
module YPetri::Transition::Types
|
8
|
+
# Is this a timed stoichiometric transition?
|
9
|
+
#
|
10
|
+
def TS?
|
11
|
+
type == :TS
|
12
|
+
end
|
13
|
+
|
14
|
+
# Is this a timed non-stoichiometric transition?
|
15
|
+
#
|
16
|
+
def Ts?
|
17
|
+
type == :Ts
|
18
|
+
end
|
19
|
+
|
20
|
+
# Is this a timeless stoichiometric transition?
|
21
|
+
#
|
22
|
+
def tS?
|
23
|
+
type == :tS
|
24
|
+
end
|
25
|
+
|
26
|
+
# Is this a timeless non-stoichiometric transition?
|
27
|
+
#
|
28
|
+
def ts?
|
29
|
+
type == :ts
|
30
|
+
end
|
31
|
+
|
32
|
+
# Is this a stoichiometric transition?
|
33
|
+
#
|
34
|
+
def stoichiometric?; @stoichiometric end
|
35
|
+
alias S? stoichiometric?
|
36
|
+
|
37
|
+
# Is this a non-stoichiometric transition?
|
38
|
+
#
|
39
|
+
def nonstoichiometric?
|
40
|
+
! stoichiometric?
|
41
|
+
end
|
42
|
+
alias s? nonstoichiometric?
|
43
|
+
|
44
|
+
# Does the transition's action depend on delta time?
|
45
|
+
#
|
46
|
+
def timed?
|
47
|
+
@timed
|
48
|
+
end
|
49
|
+
alias T? timed?
|
50
|
+
|
51
|
+
# Is the transition timeless? (Opposite of #timed?)
|
52
|
+
#
|
53
|
+
def timeless?
|
54
|
+
not timed?
|
55
|
+
end
|
56
|
+
alias t? timeless?
|
57
|
+
|
58
|
+
# Is the transition functional?
|
59
|
+
#
|
60
|
+
# Explanation: If rate or action closure is supplied, a transition is always
|
61
|
+
# considered 'functional'. Otherwise, it is considered not 'functional'.
|
62
|
+
# Note that even transitions that are not functional still have standard
|
63
|
+
# action acc. to Petri's definition. Also note that a timed transition is
|
64
|
+
# necessarily functional.
|
65
|
+
#
|
66
|
+
def functional?
|
67
|
+
@functional
|
68
|
+
end
|
69
|
+
|
70
|
+
# Opposite of #functional?
|
71
|
+
#
|
72
|
+
def functionless?
|
73
|
+
not functional?
|
74
|
+
end
|
75
|
+
|
76
|
+
# Reports the transition's membership in one of the 4 basic types:
|
77
|
+
#
|
78
|
+
# 1. TS .... timed stoichiometric
|
79
|
+
# 2. tS .... timeless stoichiometric
|
80
|
+
# 3. Ts .... timed nonstoichiometric
|
81
|
+
# 4. ts .... timeless nonstoichiometric
|
82
|
+
#
|
83
|
+
# plus the fifth type
|
84
|
+
#
|
85
|
+
# 5. A .... assignment transitions
|
86
|
+
#
|
87
|
+
def type
|
88
|
+
return :A if assignment_action?
|
89
|
+
timed? ? ( stoichiometric? ? :TS : :Ts ) : ( stoichiometric? ? :tS : :ts )
|
90
|
+
end
|
91
|
+
|
92
|
+
# Is this a transition with assignment action? (Transitions with assignment
|
93
|
+
# action, or "assignment transitions", completely replace the marking of their
|
94
|
+
# codomain with their action closure result, like in spreadsheets.)
|
95
|
+
#
|
96
|
+
def assignment_action?
|
97
|
+
@assignment_action
|
98
|
+
end
|
99
|
+
alias assignment? assignment_action?
|
100
|
+
alias A? assignment_action?
|
101
|
+
|
102
|
+
# Is this a non-assignment transition? (Opposite of +#A?+)
|
103
|
+
#
|
104
|
+
def a?
|
105
|
+
! assignment_action?
|
106
|
+
end
|
107
|
+
end # class YPetri::Transition::Types
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Overrride of World::Dependency to enable Transition instances not belonging
|
4
|
+
# to any World instance.
|
5
|
+
#
|
6
|
+
module YPetri::Transition::UsableWithoutWorld
|
7
|
+
def place id
|
8
|
+
super rescue Place().instance( id )
|
9
|
+
end
|
10
|
+
|
11
|
+
def transition id
|
12
|
+
super rescue Transition().instance( id )
|
13
|
+
end
|
14
|
+
end # class YPetri::Transition::UsableWithoutWorld
|
data/lib/y_petri/transition.rb
CHANGED
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require_relative 'transition/arcs'
|
4
4
|
require_relative 'transition/cocking'
|
5
|
-
require_relative 'transition/
|
6
|
-
require_relative 'transition/
|
7
|
-
require_relative 'transition/
|
8
|
-
require_relative 'transition/assignment'
|
5
|
+
require_relative 'transition/construction_convenience'
|
6
|
+
require_relative 'transition/types'
|
7
|
+
require_relative 'transition/usable_without_world'
|
9
8
|
|
10
9
|
# Transitions -- little boxes in Petri net drawings -- represent atomic
|
11
10
|
# operations on the Petri net's marking.
|
@@ -92,59 +91,104 @@ require_relative 'transition/assignment'
|
|
92
91
|
# closure as per C. A. Petri is automatically constructed for these.
|
93
92
|
#
|
94
93
|
class YPetri::Transition
|
95
|
-
|
96
|
-
|
94
|
+
★ NameMagic # ★ means include
|
95
|
+
★ YPetri::World::Dependency
|
96
|
+
★ UsableWithoutWorld
|
97
|
+
★ Arcs
|
98
|
+
★ Cocking
|
99
|
+
★ ConstructionConvenience
|
100
|
+
★ Types
|
97
101
|
|
98
102
|
class << self
|
99
|
-
|
103
|
+
★ YPetri::World::Dependency
|
100
104
|
end
|
101
105
|
|
102
|
-
|
103
|
-
|
104
|
-
|
106
|
+
TYPES = {
|
107
|
+
T: "timed",
|
108
|
+
t: "timeless",
|
109
|
+
S: "stoichiometric",
|
110
|
+
s: "non-stoichiometric",
|
111
|
+
A: "assignment",
|
112
|
+
a: "non-assignment",
|
105
113
|
TS: "timed stoichiometric",
|
106
114
|
tS: "timeless stoichiometric",
|
107
115
|
Ts: "timed nonstoichiometric",
|
108
116
|
ts: "timeless nonstoichiometric"
|
109
117
|
}
|
110
118
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
119
|
+
delegate :world, to: "self.class"
|
120
|
+
|
121
|
+
# Transition class represents many different kinds of Petri net transitions.
|
122
|
+
# It makes the constructor syntax a bit more polymorphic. The type of the
|
123
|
+
# transition to construct is mostly inferred from the constructor arguments.
|
124
|
+
#
|
125
|
+
# Mandatorily, the constructor will always need a way to determine the domain
|
126
|
+
# (upstream arcs) and codomain (downstream arcs) of the transition. Also, the
|
127
|
+
# constructor must have a way to determine the transition's action. This is
|
128
|
+
# best explained by examples -- let us have 3 places A, B, C, for whe we will
|
129
|
+
# create different kinds of transitions:
|
130
|
+
#
|
131
|
+
#
|
132
|
+
# ==== TS (timed stoichiometric)
|
133
|
+
#
|
134
|
+
# Rate closure and stoichiometry has to be supplied. Rate closure arity should
|
135
|
+
# correspond to the domain size. Return arity should be 1 (to be multiplied by
|
136
|
+
# the stoichiometry vector, as in all other stoichiometric transitions).
|
137
|
+
#
|
138
|
+
# Transition.new stoichiometry: { A: -1, B: 1 },
|
139
|
+
# rate: -> a { a * 0.5 }
|
140
|
+
#
|
141
|
+
#
|
142
|
+
# ==== Ts (timed nonstoichiometric)
|
143
|
+
#
|
144
|
+
# Rate closure has to be supplied, whose arity should match the domain, and
|
145
|
+
# output arity codomain.
|
146
|
+
#
|
147
|
+
# ==== tS (timeless stoichiometric)
|
148
|
+
#
|
149
|
+
# Stoichiometry has to be supplied, action closure is optional. If supplied,
|
150
|
+
# its return arity should be 1 (to be multiplied by the stoichiometry vector).
|
151
|
+
#
|
152
|
+
# ==== ts transitions (timeless nonstoichiometric)
|
153
|
+
#
|
154
|
+
# Action closure is expected with return arity equal to the codomain size:
|
155
|
+
#
|
156
|
+
# Transition.new upstream_arcs: [A, C], downstream_arcs: [A, B],
|
157
|
+
# action_closure: proc { |m, x|
|
158
|
+
# if x > 0 then [-(m / 2), (m / 2)]
|
159
|
+
# else [1, 0] end
|
160
|
+
# }
|
161
|
+
#
|
162
|
+
def initialize *args, &block
|
163
|
+
check_in_arguments *args, &block # the big job
|
164
|
+
extend( if timed? then Type_T
|
165
|
+
elsif assignment_action? then Type_A
|
166
|
+
else Type_t end )
|
167
|
+
inform_upstream_places # that they have been connected
|
168
|
+
inform_downstream_places # that they have been connected
|
169
|
+
uncock # initialize in the uncocked state
|
170
|
+
end
|
115
171
|
|
116
172
|
# Domain, or 'upstream arcs', is a collection of places, whose marking
|
117
173
|
# directly affects the transition's action.
|
118
174
|
#
|
119
175
|
attr_reader :domain
|
120
|
-
alias
|
121
|
-
alias
|
122
|
-
alias
|
123
|
-
alias
|
124
|
-
alias
|
176
|
+
alias domain_arcs domain
|
177
|
+
alias domain_places domain
|
178
|
+
alias upstream domain
|
179
|
+
alias upstream_arcs domain
|
180
|
+
alias upstream_places domain
|
125
181
|
|
126
182
|
# Codomain, 'downstream arcs', or 'action arcs', is a collection of places,
|
127
183
|
# whose marking is directly changed by this transition's firing.
|
128
184
|
#
|
129
185
|
attr_reader :codomain
|
130
|
-
alias
|
131
|
-
alias
|
132
|
-
alias
|
133
|
-
alias
|
134
|
-
alias
|
135
|
-
alias
|
136
|
-
|
137
|
-
# Is the transition stoichiometric?
|
138
|
-
#
|
139
|
-
def stoichiometric?; @stoichiometric end
|
140
|
-
alias :S? :stoichiometric?
|
141
|
-
|
142
|
-
# Is the transition nonstoichiometric? (Opposite of #stoichiometric?)
|
143
|
-
#
|
144
|
-
def nonstoichiometric?
|
145
|
-
not stoichiometric?
|
146
|
-
end
|
147
|
-
alias :s? :nonstoichiometric?
|
186
|
+
alias codomain_arcs codomain
|
187
|
+
alias codomain_places codomain
|
188
|
+
alias downstream codomain
|
189
|
+
alias downstream_arcs codomain
|
190
|
+
alias downstream_places codomain
|
191
|
+
alias action_arcs codomain
|
148
192
|
|
149
193
|
# Stoichiometry (implies that the transition is stoichiometric).
|
150
194
|
#
|
@@ -170,76 +214,18 @@ class YPetri::Transition
|
|
170
214
|
# Rate closure arity should correspond to the transition's domain.
|
171
215
|
#
|
172
216
|
attr_reader :rate_closure
|
173
|
-
alias
|
174
|
-
alias
|
175
|
-
alias
|
176
|
-
alias
|
177
|
-
alias
|
217
|
+
alias rate rate_closure
|
218
|
+
alias flux_closure rate_closure
|
219
|
+
alias flux rate_closure
|
220
|
+
alias propensity_closure rate_closure
|
221
|
+
alias propensity rate_closure
|
178
222
|
|
179
223
|
# For rateless transition, action closure must be present. Action closure
|
180
224
|
# input arguments must correspond to the domain places, and for timed
|
181
225
|
# transitions, the first argument of the action closure must be Δtime.
|
182
226
|
#
|
183
227
|
attr_reader :action_closure
|
184
|
-
alias
|
185
|
-
|
186
|
-
# Does the transition's action depend on delta time?
|
187
|
-
#
|
188
|
-
def timed?
|
189
|
-
@timed
|
190
|
-
end
|
191
|
-
alias T? timed?
|
192
|
-
|
193
|
-
# Is the transition timeless? (Opposite of #timed?)
|
194
|
-
#
|
195
|
-
def timeless?
|
196
|
-
not timed?
|
197
|
-
end
|
198
|
-
alias t? timeless?
|
199
|
-
|
200
|
-
# Is the transition functional?
|
201
|
-
# Explanation: If rate or action closure is supplied, a transition is always
|
202
|
-
# considered 'functional'. Otherwise, it is considered not 'functional'.
|
203
|
-
# Note that even transitions that are not functional still have standard
|
204
|
-
# action acc. to Petri's definition. Also note that a timed transition is
|
205
|
-
# necessarily functional.
|
206
|
-
#
|
207
|
-
def functional?
|
208
|
-
@functional
|
209
|
-
end
|
210
|
-
|
211
|
-
# Opposite of #functional?
|
212
|
-
#
|
213
|
-
def functionless?
|
214
|
-
not functional?
|
215
|
-
end
|
216
|
-
|
217
|
-
# Reports the transition's membership in one of the 4 basic types:
|
218
|
-
#
|
219
|
-
# 1. TS .... timed stoichiometric
|
220
|
-
# 2. tS .... timeless stoichiometric
|
221
|
-
# 3. Ts .... timed nonstoichiometric
|
222
|
-
# 4. ts .... timeless nonstoichiometric
|
223
|
-
#
|
224
|
-
# plus the fifth type
|
225
|
-
#
|
226
|
-
# 5. A .... assignment transitions
|
227
|
-
#
|
228
|
-
def type
|
229
|
-
return :A if assignment_action?
|
230
|
-
timed? ? ( stoichiometric? ? :TS : :Ts ) : ( stoichiometric? ? :tS : :ts )
|
231
|
-
end
|
232
|
-
|
233
|
-
# Is it an assignment transition? (Transitions with 'assignment action'
|
234
|
-
# completely replace their codomain's marking.)
|
235
|
-
#
|
236
|
-
def assignment_action?; @assignment_action end
|
237
|
-
alias :assignment? :assignment_action?
|
238
|
-
alias :A? :assignment_action?
|
239
|
-
|
240
|
-
# Is it a non-assignment transition? (Opposite of +#A?+)
|
241
|
-
#
|
242
|
-
def a?; ! assignment_action? end
|
228
|
+
alias action action_closure
|
243
229
|
|
244
230
|
# Zero action.
|
245
231
|
#
|
data/lib/y_petri/version.rb
CHANGED
@@ -3,38 +3,40 @@
|
|
3
3
|
# Provides basic skeleton for dependency injection for the triples of the
|
4
4
|
# parametrized subclasses of Place, Transition and Net in different workspaces.
|
5
5
|
#
|
6
|
-
|
7
|
-
|
6
|
+
class YPetri::World
|
7
|
+
module Dependency
|
8
|
+
delegate :Place, :Transition, :Net, to: :world
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
# Place instance identification.
|
11
|
+
#
|
12
|
+
def place id
|
13
|
+
world.place( id )
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# Transition instance identification.
|
17
|
+
#
|
18
|
+
def transition id
|
19
|
+
world.transition( id )
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
begin
|
25
|
-
place( id )
|
26
|
-
rescue NameError, TypeError
|
22
|
+
# Element instance identification.
|
23
|
+
#
|
24
|
+
def element id
|
27
25
|
begin
|
28
|
-
|
29
|
-
rescue NameError, TypeError
|
30
|
-
|
26
|
+
place( id )
|
27
|
+
rescue NameError, TypeError
|
28
|
+
begin
|
29
|
+
transition( id )
|
30
|
+
rescue NameError, TypeError => err
|
31
|
+
raise TypeError, "Unrecognized place or transition: #{element} (#{err})"
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
33
|
-
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end # module
|
36
|
+
# Net instance identification.
|
37
|
+
#
|
38
|
+
def net id
|
39
|
+
Net().instance( id )
|
40
|
+
end
|
41
|
+
end # module Dependency
|
42
|
+
end # module YPetri::World
|
data/lib/y_petri/world.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative 'world/dependency'
|
4
|
+
require_relative 'world/petri_net_related'
|
5
|
+
require_relative 'world/simulation_related'
|
6
|
+
|
7
|
+
|
1
8
|
# As the name suggests, represents the world. Holds places, transitions, nets
|
2
9
|
# and other assets needed to set up and simulate Petri nets (settings, clamps,
|
3
10
|
# initial markings etc.). Provides basic methods to do what is necessary.
|
4
11
|
# More ergonomic and DSL-like methods are up to the YPetri::Agent.
|
5
12
|
#
|
6
13
|
class YPetri::World
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
require_relative 'world/petri_net_related'
|
11
|
-
require_relative 'world/simulation_related'
|
12
|
-
|
13
|
-
include self::PetriNetRelated
|
14
|
-
include self::SimulationRelated
|
14
|
+
★ NameMagic # ★ means include
|
15
|
+
★ PetriNetRelated
|
16
|
+
★ SimulationRelated
|
15
17
|
|
16
18
|
def initialize
|
17
19
|
# Parametrize the Place / Transition / Net classes.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#! /usr/bin/ruby
|
2
|
-
#
|
2
|
+
# encoding: utf-8
|
3
3
|
|
4
|
-
|
4
|
+
gem 'minitest', '=4.7.4'
|
5
5
|
require 'minitest/autorun'
|
6
6
|
require_relative '../../lib/y_petri' # tested component itself
|
7
7
|
# require 'y_petri'
|
@@ -9,7 +9,7 @@ require_relative '../../lib/y_petri' # tested component itself
|
|
9
9
|
|
10
10
|
describe "Basic use of TimedSimulation" do
|
11
11
|
before do
|
12
|
-
@m = YPetri::
|
12
|
+
@m = YPetri::Agent.new
|
13
13
|
@m.Place( name: "A", default_marking: 0.5 )
|
14
14
|
@m.Place( name: "B", default_marking: 0.5 )
|
15
15
|
@m.Transition( name: "A_pump",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#! /usr/bin/ruby
|
2
|
-
#
|
2
|
+
# encoding: utf-8
|
3
3
|
|
4
|
-
|
4
|
+
gem 'minitest', '=4.7.4'
|
5
5
|
require 'minitest/autorun'
|
6
6
|
require_relative '../../lib/y_petri' # tested component itself
|
7
7
|
# require 'y_petri'
|
@@ -9,7 +9,7 @@ require_relative '../../lib/y_petri' # tested component itself
|
|
9
9
|
|
10
10
|
describe "Simplified dTTP pathway used for demo with Dr. Chang" do
|
11
11
|
before do
|
12
|
-
@m = YPetri::
|
12
|
+
@m = YPetri::Agent.new
|
13
13
|
Cytoplasm_volume_in_litres = 5.0e-11
|
14
14
|
NA = 6.022e23
|
15
15
|
Pieces_per_micromolar = NA / 1_000_000 * Cytoplasm_volume_in_litres
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#! /usr/bin/ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
|
-
|
4
|
+
gem 'minitest', '=4.7.4'
|
5
5
|
require 'minitest/autorun'
|
6
6
|
require_relative '../../lib/y_petri' # tested component itself
|
7
7
|
# require 'y_petri'
|
@@ -11,7 +11,7 @@ describe "Use of TimedSimulation with units" do
|
|
11
11
|
before do
|
12
12
|
require 'sy'
|
13
13
|
|
14
|
-
@m = YPetri::
|
14
|
+
@m = YPetri::Agent.new
|
15
15
|
|
16
16
|
# === General assumptions
|
17
17
|
Cytoplasm_volume = 5.0e-11.l
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#! /usr/bin/ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
|
-
|
4
|
+
gem 'minitest', '=4.7.4'
|
5
5
|
require 'minitest/autorun'
|
6
6
|
require_relative '../../lib/y_petri' # tested component itself
|
7
7
|
# require 'y_petri'
|
@@ -9,7 +9,7 @@ require_relative '../../lib/y_petri' # tested component itself
|
|
9
9
|
|
10
10
|
describe "Token game" do
|
11
11
|
before do
|
12
|
-
@m = YPetri::
|
12
|
+
@m = YPetri::Agent.new
|
13
13
|
@m.Place name: "A"
|
14
14
|
@m.Place name: "B"
|
15
15
|
@m.Place name: "C", marking: 7.77
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#! /usr/bin/ruby
|
2
|
-
#
|
2
|
+
# encoding: utf-8
|
3
3
|
|
4
|
-
|
4
|
+
gem 'minitest', '=4.7.4'
|
5
5
|
require 'minitest/autorun'
|
6
6
|
require_relative '../../lib/y_petri' # tested component itself
|
7
7
|
# require 'y_petri'
|
@@ -9,7 +9,7 @@ require_relative '../../lib/y_petri' # tested component itself
|
|
9
9
|
|
10
10
|
describe "Graphviz visualization" do
|
11
11
|
before do
|
12
|
-
@m = YPetri::
|
12
|
+
@m = YPetri::Agent.new
|
13
13
|
@m.Place name: :A, m!: 1
|
14
14
|
@m.Place name: :B, m!: 1.5
|
15
15
|
@m.Place name: :C, m!: 2
|
data/test/acceptance_tests.rb
CHANGED