y_petri 2.0.3 → 2.0.7

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.
data/test/y_petri_test.rb CHANGED
@@ -1,405 +1,14 @@
1
1
  #! /usr/bin/ruby
2
- #encoding: utf-8
2
+ # -*- coding: utf-8 -*-
3
3
 
4
4
  require 'minitest/spec'
5
5
  require 'minitest/autorun'
6
6
  require_relative '../lib/y_petri' # tested component itself
7
7
  # require 'y_petri'
8
-
9
8
  # require 'sy'
10
9
 
11
10
  include Pyper if require 'pyper'
12
11
 
13
- # **************************************************************************
14
- # Test of Place class, part I.
15
- # **************************************************************************
16
- #
17
- describe ::YPetri::Place do
18
- before do
19
- # skip "to speed up testing"
20
- @pç = pç = Class.new ::YPetri::Place
21
- @p = pç.new! default_marking: 3.2,
22
- marking: 1.1,
23
- quantum: 0.1,
24
- name: "P1"
25
- end
26
-
27
- describe "place behavior" do
28
- before do
29
- @p.m = 1.1
30
- end
31
-
32
- it "should have constant magic included" do
33
- assert_respond_to @p, :name
34
- assert_equal @p.name, :P1
35
- end
36
-
37
- it "should have own marking and be able to update it" do
38
- assert_equal 1.1, @p.marking
39
- assert_equal 0.1, @p.quantum
40
- assert_equal :P1, @p.name
41
- @p.add 1
42
- assert_equal 2.1, @p.value # alias for #marking
43
- @p.subtract 0.5
44
- assert_equal 1.6, @p.m
45
- @p.reset_marking
46
- assert_equal 3.2, @p.marking
47
- end
48
-
49
- it "should respond to the arc getters" do
50
- # #action_arcs & aliases
51
- assert_equal [], @p.upstream_arcs
52
- assert_equal [], @p.upstream_transitions
53
- assert_equal [], @p.ϝ
54
- # #test_arcs & aliases
55
- assert_equal [], @p.downstream_arcs
56
- assert_equal [], @p.downstream_transitions
57
- # #arcs & aliasesnn
58
- assert_equal [], @p.arcs
59
- # #precedents & aliases
60
- assert_equal [], @p.precedents
61
- assert_equal [], @p.upstream_places
62
- # #dependents & aliases
63
- assert_equal [], @p.dependents
64
- assert_equal [], @p.downstream_places
65
- end
66
-
67
- it "should respond to register and fire conn. transitions methods" do
68
- assert_respond_to @p, :fire_upstream!
69
- assert_respond_to @p, :fire_downstream!
70
- assert_respond_to @p, :fire_upstream_recursively
71
- assert_respond_to @p, :fire_downstream_recursively
72
- end
73
- end
74
- end
75
-
76
- # **************************************************************************
77
- # Test of Transition class, part I.
78
- # **************************************************************************
79
- #
80
- describe ::YPetri::Transition do
81
- before do
82
- # skip "to speed up testing"
83
- @ç = ç = Class.new ::YPetri::Transition
84
- @pç = pç = Class.new ::YPetri::Place
85
- [ ç, pç ].each { |ç|
86
- ç.class_exec {
87
- define_method :Place do pç end
88
- define_method :Transition do ç end
89
- private :Place, :Transition
90
- }
91
- }
92
- @p1 = pç.new default_marking: 1.0
93
- @p2 = pç.new default_marking: 2.0
94
- @p3 = pç.new default_marking: 3.0
95
- @p4 = pç.new default_marking: 4.0
96
- @p5 = pç.new default_marking: 5.0
97
- end
98
-
99
- describe "1. timeless nonstoichiometric (ts) transitions" do
100
-
101
- # Note that timeless nonstoichiometric transitions require a function
102
- # block, and thus are always functional
103
-
104
- before do
105
- @t1 = @ç.new codomain: [ @p1, @p3 ], domain: @p2, action: λ { |a| [ a, a ] }
106
- # saying that the trans. is timed saves the day here:
107
- @t2 = @ç.new codomain: [ @p1, @p3 ], action: λ { |t| [ t, t ] }, timed: true
108
- # Only with domain is 1-ary closure allowed to be timeless:
109
- @t3 = @ç.new codomain: [ @p1, @p3 ], action: λ { |t| [ t, t ] }, timed: false, domain: [ @p2 ]
110
- # With nullary action closure, timeless is implied, so this is allowed
111
- @t4 = @ç.new action: λ { [ 0.5, 0.5 ] }, codomain: [ @p1, @p3 ]
112
- # ... also for stoichiometric variety
113
- @t5 = @ç.new action: λ { 0.5 }, codomain: [ @p1, @p3 ], s: [ 1, 1 ]
114
- end
115
-
116
- it "should raise errors for bad parameters" do
117
- # omitting the domain should raise ArgumentError about too much ambiguity:
118
- assert_raises AErr do @ç.new codomain: [ @p1, @p3 ], action: λ { |t| [ t, t ] } end
119
- # saying that the transition is timeless points to a conflict:
120
- assert_raises AErr do @ç.new codomain: [ @p1, @p3 ], action: λ { |t| [ t, t ] }, timeless: true end
121
- end
122
-
123
- it "should initi and perform" do
124
- assert_equal [ @p2 ], @t1.domain
125
- assert_equal [ @p1, @p3 ], @t1.action_arcs
126
- assert @t1.functional?
127
- assert @t1.timeless?
128
- assert @t2.timed?
129
- assert [@t3, @t4, @t5].all? { |t| t.timeless? }
130
- assert @t2.rateless?
131
- # that's enough, now let's flex them:
132
- @t1.fire!
133
- assert_equal [3, 5], [ @p1.marking, @p3.marking ]
134
- @t3.fire!
135
- assert_equal [5, 7], [ @p1.marking, @p3.marking ]
136
- @t4.fire!
137
- assert_equal [5.5, 7.5], [ @p1.marking, @p3.marking ]
138
- @t5.fire!
139
- assert_equal [6, 8], [ @p1.marking, @p3.marking ]
140
- # now t2 for firing requires delta time
141
- @t2.fire! 1
142
- assert_equal [7, 9], [ @p1.marking, @p3.marking ]
143
- @t2.fire! 0.1
144
- assert_equal [7.1, 9.1], [@p1.marking, @p3.marking ]
145
- # let's change @p2 marking
146
- @p2.marking = 0.1
147
- @t1.fire!
148
- assert_in_epsilon 7.2, @p1.marking, 1e-9
149
- assert_in_epsilon 9.2, @p3.marking, 1e-9
150
- # let's test #domain_marking, #codomain_marking, #zero_action
151
- assert_equal [ @p1.marking, @p3.marking ], @t1.codomain_marking
152
- assert_equal [ @p2.marking ], @t1.domain_marking
153
- assert_equal [ 0, 0 ], @t1.zero_action
154
- end
155
- end
156
-
157
- describe "2. timed rateless non-stoichiometric (Tsr) transitions" do
158
- #LATER: To save time, I omit the full test suite.
159
- end
160
-
161
- describe "3. timeless stoichiometric (tS) transitions" do
162
- describe "functionless tS transitions" do
163
-
164
- # For transitions with no function given (ie. functionless), it is
165
- # required that their stoichiometric vector be given and their action
166
- # closure is then automatically generated from the stoichio. vector
167
-
168
- before do
169
- # timeless transition with stoichiometric vector only, as hash
170
- @ftS1 = @ç.new stoichiometry: { @p1 => 1 }
171
- # timeless transition with stoichiometric vector as array + codomain
172
- @ftS2 = @ç.new stoichiometry: 1, codomain: @p1
173
- # :stoichiometric_vector is aliased as :sv
174
- @ftS3 = @ç.new s: 1, codomain: @p1
175
- # :codomain is aliased as :action_arcs
176
- @ftS4 = @ç.new s: 1, action_arcs: @p1
177
- # dropping of square brackets around size 1 vectors is optional
178
- @ftS5 = @ç.new s: [ 1 ], downstream: [ @p1 ]
179
- # another alias for :codomain is :downstream_places
180
- @ftS6 = @ç.new s: [ 1 ], downstream_places: [ @p1 ]
181
- # and now, all of the above transitions...
182
- @tt = @ftS1, @ftS2, @ftS3, @ftS4, @ftS5, @ftS6
183
- end
184
-
185
- it "should work" do
186
- # ...should be the same, having a single action arc:
187
- assert @tt.all?{ |t| t.action_arcs == [ @p1 ] }
188
- # timeless:
189
- assert @tt.all?{ |t| t.timeless? }
190
- # rateless:
191
- assert @tt.all?{ |t| t.rateless? }
192
- assert @tt.all?{ |t| not t.has_rate? }
193
- # no assignment action
194
- assert @tt.all?{ |t| not t.assignment_action? }
195
- # not considered functional
196
- assert @tt.all?{ |t| t.functionless? }
197
- assert @tt.all?{ |t| not t.functional? }
198
- # and having nullary action closure
199
- assert @tt.all?{ |t| t.action_closure.arity == 0 }
200
- # the transitions should be able to #fire!
201
- @ftS1.fire!
202
- # the difference is apparent: marking of place @p1 jumped to 2:
203
- assert_equal 2, @p1.marking
204
- # but should not #fire (no exclamation mark) unless cocked
205
- assert !@ftS1.cocked?
206
- @ftS1.fire
207
- assert_equal 2, @p1.marking
208
- # cock it
209
- @ftS1.cock
210
- assert @ftS1.cocked?
211
- # uncock again, just to test cocking
212
- @ftS1.uncock
213
- assert @ftS1.uncocked?
214
- @ftS1.cock
215
- assert !@ftS1.uncocked?
216
- @ftS1.fire
217
- assert_equal 3, @p1.marking
218
- # enough playing, we'll reset @p1 marking
219
- @p1.reset_marking
220
- assert_equal 1, @p1.marking
221
- # #action
222
- assert @tt.all?{ |t| t.action == [ 1 ] }
223
- # #zero_action
224
- assert @tt.all?{ |t| t.zero_action }
225
- # #action_after_feasibility_check
226
- assert @tt.all?{ |t| t.action_after_feasibility_check == [ 1 ] }
227
- # #domain_marking
228
- assert @tt.all?{ |t| t.domain_marking == [] }
229
- # #codomain_marking
230
- assert @tt.all?{ |t| t.codomain_marking == [ @p1.marking ] }
231
- # #enabled?
232
- assert @tt.all?{ |t| t.enabled? == true }
233
- end
234
- end
235
-
236
- describe "functional tS transitions" do
237
-
238
- # If function block is supplied to tS transitions, it governs
239
- # their action based on marking of the domain places.
240
-
241
- before do
242
- # stoichiometric vector given as hash
243
- @FtS1 = @ç.new action_closure: λ { 1 }, s: { @p1 => 1 }
244
- # instead of :action_closure, just saying :action is enough
245
- @FtS2 = @ç.new action: λ { 1 }, s: { @p1 => 1 }
246
- # stoichiometric vector given as coeff. array + codomain
247
- @FtS3 = @ç.new s: 1, codomain: @p1, action: λ { 1 }
248
- # while saying timed: false and timeless: true should be ok
249
- @FtS4 = @ç.new s: { @p1 => 1 }, action: λ { 1 }, timed: false
250
- @FtS5 = @ç.new s: { @p1 => 1 }, action: λ { 1 }, timeless: true
251
- # even both are ok
252
- @FtS6 = @ç.new s: { @p1 => 1 }, action: λ { 1 }, timed: false, timeless: true
253
- @tt = @FtS1, @FtS2, @FtS3, @FtS4, @FtS5, @FtS6
254
- end
255
-
256
- it "should raise errors for bad parameters" do
257
- # saying timed: true should raise a complaint:
258
- assert_raises AErr do @ç.new sv: { @p1 => 1 }, action: λ{ 1 }, timed: true end
259
- # same for saying timeless: false
260
- assert_raises AErr do
261
- @ç.new sv: { @p1 => 1 }, action: λ{ 1 }, timeless: false end
262
- # while conflicting values will raise error
263
- assert_raises AErr do
264
- @ç.new sv: { @p1 => 1 }, action: λ { 1 }, timeless: true, timed: true
265
- end
266
- end
267
-
268
- it "should init and perform" do
269
- assert @tt.all?{ |t| t.action_arcs == [ @p1 ] }
270
- assert @tt.all?{ |t| t.timeless? }
271
- assert @tt.all?{ |t| not t.has_rate? }
272
- assert @tt.all?{ |t| t.rateless? }
273
- assert @tt.all?{ |t| not t.assignment_action? }
274
- assert @tt.all?{ |t| not t.functionless? }
275
- assert @tt.all?{ |t| t.functional? }
276
- # and having nullary action closure
277
- assert @tt.all?{ |t| t.action_closure.arity == 0 }
278
- # the transitions should be able to #fire!
279
- @FtS1.fire!
280
- # no need for more testing here
281
- end
282
- end
283
- end
284
-
285
- describe "4. timed rateless stoichiometric (TSr) transitions" do
286
-
287
- # Rateless stoichiometric transitions have action closure, and they
288
- # require a function block, and thus are always functional. Their
289
- # function block must take Δt as its first argument.
290
-
291
- #LATER: To save time, I omit the tests of TSr transitions for now.
292
- end
293
-
294
- describe "5. nonstoichiometric transitions with rate (sR transitions)" do
295
-
296
- # They require a function block with arity equal to their domain, whose
297
- # output is an array of rates of the size equal to that of codomain.
298
-
299
- #LATER: To save time, I omit the full test suite.
300
- end
301
-
302
- describe "6. stoichiometric transitions with rate (SR transitions)" do
303
- before do
304
- # now this should give standard mass action by magic:
305
- @SR1 = @ç.new s: { @p1 => -1, @p2 => -1, @p4 => 1 }, rate: 0.1
306
- # while this has custom closure
307
- @SR2 = @ç.new s: { @p1 => -1, @p3 => 1 }, rate: λ { |a| a * 0.5 }
308
- # while this one even has domain specified:
309
- @SR3 = @ç.new s: { @p1 => -1, @p2 => -1, @p4 => 1 }, upstream_arcs: @p3, rate: λ { |a| a * 0.5 }
310
- end
311
-
312
- it "should init and work" do
313
- assert_equal true, @SR1.has_rate?
314
- assert_equal [ @p1, @p2 ], @SR1.upstream_arcs
315
- assert_equal [ @p1, @p2, @p4 ], @SR1.action_arcs
316
- assert_equal [ @p1 ], @SR2.domain
317
- assert_equal [ @p1, @p3 ], @SR2.action_arcs
318
- assert_equal [ @p3 ], @SR3.domain
319
- assert_equal [ @p1, @p2, @p4 ], @SR3.action_arcs
320
- # and flex them
321
- @SR1.fire! 1.0
322
- assert_equal [ 0.8, 1.8, 4.2 ], [ @p1, @p2, @p4 ].map( &:marking )
323
- @SR2.fire! 1.0
324
- assert_equal [ 0.4, 3.4 ], [ @p1, @p3 ].map( &:marking )
325
- # the action t3 cannot fire with delta time 1.0
326
- assert_raises RuntimeError do @SR3.fire! 1.0 end
327
- assert_equal [ 0.4, 1.8, 3.4, 4.2 ], [ @p1, @p2, @p3, @p4 ].map( &:marking )
328
- # but it can fire with eg. delta time 0.1
329
- @SR3.fire! 0.1
330
- assert_in_epsilon 0.23, @p1.marking, 1e-15
331
- assert_in_epsilon 1.63, @p2.marking, 1e-15
332
- assert_in_epsilon 3.4, @p3.marking, 1e-15
333
- assert_in_epsilon 4.37, @p4.marking, 1e-15
334
- end
335
- end
336
- end
337
-
338
-
339
- # **************************************************************************
340
- # Test of mutual knowedge of upstream/downstream arcs of places/transitions.
341
- # **************************************************************************
342
- #
343
- describe "upstream and downstream reference mτs of places and transitions" do
344
- before do
345
- # skip "to speed up testing"
346
- @tç = tç = Class.new ::YPetri::Transition
347
- @pç = pç = Class.new ::YPetri::Place
348
- [ tç, pç ].each { |ç|
349
- ç.class_exec {
350
- define_method :Place do pç end
351
- define_method :Transition do tç end
352
- private :Place, :Transition
353
- }
354
- }
355
- @a = @pç.new( dflt_m: 1.0 )
356
- @b = @pç.new( dflt_m: 2.0 )
357
- @c = @pç.new( dflt_m: 3.0 )
358
- end
359
-
360
- describe "Place" do
361
- it "should have #register_ustream/downstream_transition methods" do
362
- @t1 = @tç.new s: {}
363
- @a.instance_variable_get( :@upstream_arcs ).must_equal []
364
- @a.instance_variable_get( :@downstream_arcs ).must_equal []
365
- @a.send :register_upstream_transition, @t1
366
- @a.instance_variable_get( :@upstream_arcs ).must_equal [ @t1 ]
367
- end
368
- end
369
-
370
- describe "upstream and downstream reference methods" do
371
- before do
372
- @t1 = @tç.new s: { @a => -1, @b => 1 }, rate: 1
373
- end
374
-
375
- it "should show on the referencers" do
376
- @a.upstream_arcs.must_equal [ @t1 ]
377
- @b.downstream_arcs.must_equal [ ]
378
- @b.ϝ.must_equal [ @t1 ]
379
- @t1.upstream_arcs.must_equal [ @a ]
380
- @t1.action_arcs.must_equal [ @a, @b ]
381
- end
382
- end
383
-
384
- describe "assignment action transitions" do
385
- before do
386
- @p = @pç.new default_marking: 1.0
387
- @t = @tç.new codomain: @p, action: λ { 1 }, assignment_action: true
388
- end
389
-
390
- it "should work" do
391
- @p.marking = 3
392
- assert_equal 3, @p.marking
393
- assert @t.assignment_action?
394
- assert_equal @t.domain, []
395
- assert_equal 0, @t.action_closure.arity
396
- @t.fire!
397
- assert_equal 1, @p.marking
398
- end
399
- end # context assignment action transiotions
400
- end
401
-
402
-
403
12
  # **************************************************************************
404
13
  # Test of Net class.
405
14
  # **************************************************************************
@@ -411,7 +20,7 @@ describe ::YPetri::Net do
411
20
  @pç = pç = Class.new ::YPetri::Place
412
21
  @nç = nç = Class.new ::YPetri::Net
413
22
  [ tç, pç, nç ].each { |ç|
414
- ç.class_exec {
23
+ ç.namespace!.class_exec {
415
24
  define_method :Place do pç end
416
25
  define_method :Transition do tç end
417
26
  define_method :Net do nç end
@@ -422,8 +31,8 @@ describe ::YPetri::Net do
422
31
  @p2 = pç.new ɴ: "B", quantum: 0.1, marking: 2.2
423
32
  @p3 = pç.new ɴ: "C", quantum: 0.1, marking: 3.3
424
33
  @net = nç.new
425
- [ @p1, @p2, @p3 ].each { |p| @net.include_place! p }
426
- @p_not_included = pç.new ɴ: "X", m: 0
34
+ [@p1, @p2, @p3].each { |p| @net.include_place! p }
35
+ @p_not_included = pç.new ɴ: "X", marking: 0
427
36
  end
428
37
 
429
38
  describe "net of 3 places and no transitions" do
@@ -450,7 +59,7 @@ describe ::YPetri::Net do
450
59
  it "should tell its qualities" do
451
60
  assert_equal true, @net.functional?
452
61
  assert_equal true, @net.timed?
453
- assert @net.include?( @p1 ) && !@net.include?( nil )
62
+ assert @net.include?( @p1 ) && !@net.include?( YPetri::Place.new )
454
63
  end
455
64
 
456
65
  it "should have 'standard equipment' methods" do
@@ -540,11 +149,7 @@ describe ::YPetri::Net do
540
149
  assert_equal [], @net.nonstoichiometric_tt_with_rate
541
150
  assert_equal [@t1], @net.stoichiometric_transitions_with_rate
542
151
  assert_equal [:T1], @net.stoichiometric_tt_with_rate
543
- assert_equal [], @net.transitions_with_explicit_assignment_action
544
- assert_equal [], @net.transitions_with_assignment_action
545
152
  assert_equal [], @net.assignment_transitions
546
- assert_equal [], @net.tt_with_explicit_assignment_action
547
- assert_equal [], @net.tt_with_assignment_action
548
153
  assert_equal [], @net.assignment_tt
549
154
  assert_equal [@t1, @t2], @net.stoichiometric_transitions
550
155
  assert_equal [:T1, nil], @net.stoichiometric_tt
@@ -584,7 +189,7 @@ describe ::YPetri::Simulation do
584
189
  @tç = tç = Class.new( ::YPetri::Transition )
585
190
  @nç = nç = Class.new( ::YPetri::Net )
586
191
  [ @pç, @tç, @nç ].each { |klass|
587
- klass.class_exec {
192
+ klass.namespace!.class_exec {
588
193
  private
589
194
  define_method :Place do pç end
590
195
  define_method :Transition do tç end
@@ -601,17 +206,17 @@ describe ::YPetri::Simulation do
601
206
  rate: 0.1
602
207
  @t2 = @tç.new name: "T2",
603
208
  s: { @p1 => -1, @p3 => 1 },
604
- rate: λ { |a| a * 0.5 }
209
+ rate: -> a { a * 0.5 }
605
210
  @t3 = @tç.new name: "T3",
606
211
  s: { @p1 => -1, @p2 => -1, @p4 => 1 },
607
212
  domain: @p3,
608
- rate: λ { |a| a * 0.5 }
213
+ rate: -> a { a * 0.5 }
609
214
  @net = @nç.new << @p1 << @p2 << @p3 << @p4 << @p5
610
215
  @net.include_transition! @t1
611
216
  @net.include_transition! @t2
612
217
  @net << @t3
613
218
  @s = YPetri::Simulation.new net: @net,
614
- place_clamps: { @p1 => 2.0, @p5 => 2.0 },
219
+ marking_clamps: { @p1 => 2.0, @p5 => 2.0 },
615
220
  initial_marking: { @p2 => @p2.default_marking,
616
221
  @p3 => @p3.default_marking,
617
222
  @p4 => @p4.default_marking }
@@ -792,8 +397,8 @@ describe ::YPetri::Simulation do
792
397
  end
793
398
 
794
399
  it "1. handles ts transitions" do
795
- @s.Δ_closures_for_ts.must_equal []
796
- @s.Δ_if_ts_fire_once.must_equal Matrix.zero( @s.free_pp.size, 1 )
400
+ @s.Δ_closures_for_tsa.must_equal []
401
+ @s.Δ_if_tsa_fire_once.must_equal Matrix.zero( @s.free_pp.size, 1 )
797
402
  end
798
403
 
799
404
  it "2. handles Tsr transitions" do
@@ -938,7 +543,7 @@ describe ::YPetri::TimedSimulation do
938
543
  describe "timed 'isomerization' with given as λ" do
939
544
  before do
940
545
  @t2 = ::YPetri::Transition.new s: { @a => -1, @c => 1 },
941
- rate_closure: λ { |a| a * 0.5 }
546
+ rate_closure: -> a { a * 0.5 }
942
547
  @net = ::YPetri::Net.new << @a << @b << @c << @t2
943
548
  end
944
549
 
@@ -964,7 +569,7 @@ describe ::YPetri::TimedSimulation do
964
569
  before do
965
570
  @t3 = ::YPetri::Transition.new s: { @a => -1, @c => 1 },
966
571
  domain: @b,
967
- rate: λ { |a| a * 0.5 }
572
+ rate: -> a { a * 0.5 }
968
573
  @net = ::YPetri::Net.new << @a << @b << @c << @t3
969
574
  @sim = ::YPetri::TimedSimulation.new net: @net,
970
575
  initial_marking: { @a => 1, @b => 0.6, @c => 3 },
@@ -1007,7 +612,7 @@ describe ::YPetri::Workspace do
1007
612
  ɴ: "AA_BB_assembly"
1008
613
  t2 = @w.Transition.new! ɴ: "AA_appearing",
1009
614
  codomain: a,
1010
- rate: λ{ 0.1 },
615
+ rate: -> { 0.1 },
1011
616
  stoichiometry: 1
1012
617
  @pp, @tt = [a, b, c], [t1, t2]
1013
618
  @f_name = "test_output.csv"
@@ -1130,7 +735,7 @@ describe ::YPetri::Manipulator do
1130
735
  @p = @m.Place ɴ: "P", default_marking: 1
1131
736
  @q = @m.Place ɴ: "Q", default_marking: 1
1132
737
  @decay_t = @m.Transition ɴ: "Tp", s: { P: -1 }, rate: 0.1
1133
- @constant_flux_t = @m.Transition ɴ: "Tq", s: { Q: 1 }, rate: λ{ 0.02 }
738
+ @constant_flux_t = @m.Transition ɴ: "Tq", s: { Q: 1 }, rate: -> { 0.02 }
1134
739
  @m.initial_marking @p => 1.2
1135
740
  @m.initial_marking @q => 2
1136
741
  @m.set_step 0.01
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.0.3
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-13 00:00:00.000000000 Z
11
+ date: 2013-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: y_support
@@ -69,6 +69,7 @@ files:
69
69
  - lib/y_petri/demonstrator_2.rb
70
70
  - lib/y_petri/demonstrator_3.rb
71
71
  - lib/y_petri/demonstrator_4.rb
72
+ - lib/y_petri/dependency_injection.rb
72
73
  - lib/y_petri/manipulator.rb
73
74
  - lib/y_petri/manipulator/hash_key_pointer.rb
74
75
  - lib/y_petri/manipulator/petri_net_related_methods.rb
@@ -76,15 +77,22 @@ files:
76
77
  - lib/y_petri/manipulator/simulation_related_methods.rb
77
78
  - lib/y_petri/net.rb
78
79
  - lib/y_petri/place.rb
80
+ - lib/y_petri/place/arcs.rb
81
+ - lib/y_petri/place/guard.rb
79
82
  - lib/y_petri/simulation.rb
80
83
  - lib/y_petri/timed_simulation.rb
81
84
  - lib/y_petri/transition.rb
85
+ - lib/y_petri/transition/arcs.rb
86
+ - lib/y_petri/transition/cocking.rb
87
+ - lib/y_petri/transition/constructor_syntax.rb
82
88
  - lib/y_petri/version.rb
83
89
  - lib/y_petri/workspace.rb
84
90
  - lib/y_petri/workspace/parametrized_subclassing.rb
85
91
  - lib/y_petri/workspace/petri_net_related_methods.rb
86
92
  - lib/y_petri/workspace/simulation_related_methods.rb
93
+ - test/place_test.rb
87
94
  - test/simple_manual_examples.rb
95
+ - test/transition_test.rb
88
96
  - test/y_petri_test.rb
89
97
  - y_petri.gemspec
90
98
  homepage: ''
@@ -111,5 +119,7 @@ signing_key:
111
119
  specification_version: 4
112
120
  summary: a Petri net domain model and simulator
113
121
  test_files:
122
+ - test/place_test.rb
114
123
  - test/simple_manual_examples.rb
124
+ - test/transition_test.rb
115
125
  - test/y_petri_test.rb