y_petri 2.4.3 → 2.4.4
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/net/state/feature/assignment.rb +1 -1
- data/lib/y_petri/simulation.rb +1 -1
- data/lib/y_petri/simulation/timed.rb +1 -1
- data/lib/y_petri/transition/A.rb +6 -0
- data/lib/y_petri/transition/T.rb +6 -0
- data/lib/y_petri/transition/t.rb +7 -1
- data/lib/y_petri/version.rb +1 -1
- data/test/transition_test.rb +5 -0
- data/test/world_test.rb +0 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c63e099442746fc3480cc52b48b42e861628a4ce
|
4
|
+
data.tar.gz: ca4e673252e6d4f6423de630b42c3ebaef6a1900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa7d484e3812dc8f8cf049a07c387d62742081921995c0b60912eaa4de17c5f6fd95e5c74debd34cc1318b108aba53fc75137f837a7e3593aa205be3251618cf
|
7
|
+
data.tar.gz: 6db8186f8252fb678dae074bd418e430c254e458b4b63ca4953c87bf3261e948e8843abf1cbb20ec2e61ad0a7395065277e871a243605dc5ee3f214e568b287c
|
@@ -65,7 +65,7 @@ class YPetri::Net::State::Feature::Assignment < YPetri::Net::State::Feature
|
|
65
65
|
# The constructor of an assignment feature takes 1 ordered and 1 named
|
66
66
|
# (+:transition+) argument, which must identify the place and the transitions.
|
67
67
|
#
|
68
|
-
def initialize place, transition: transition
|
68
|
+
def initialize place, transition: transition()
|
69
69
|
@place = net.place( place )
|
70
70
|
@transition = net.transition( transition )
|
71
71
|
@place_index_in_codomain = @transition.codomain.index( @place ) or
|
data/lib/y_petri/simulation.rb
CHANGED
@@ -206,7 +206,7 @@ class YPetri::Simulation
|
|
206
206
|
# of the new instance is the same as the creator's. Arguments can partially or
|
207
207
|
# wholly modify the attributes of the duplicate.
|
208
208
|
#
|
209
|
-
def dup( marking: marking, recording: recording, **named_args )
|
209
|
+
def dup( marking: marking(), recording: recording(), **named_args )
|
210
210
|
named_args.reverse_merge! settings( true )
|
211
211
|
self.class.new( named_args ).tap do |duplicate|
|
212
212
|
duplicate.recorder.reset! recording: recording
|
@@ -190,7 +190,7 @@ module YPetri::Simulation::Timed
|
|
190
190
|
# Customized dup method that allows to modify the attributes of
|
191
191
|
# the duplicate upon creation.
|
192
192
|
#
|
193
|
-
def dup time: time, **named_args
|
193
|
+
def dup time: time(), **named_args
|
194
194
|
super( **named_args ).tap { |instance| instance.reset_time! time }
|
195
195
|
end
|
196
196
|
|
data/lib/y_petri/transition/A.rb
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
# Mixin for the transitions with assignment action.
|
4
4
|
#
|
5
5
|
module YPetri::Transition::Type_A
|
6
|
+
# For assignment transitions, "function" refers to their action closure.
|
7
|
+
#
|
8
|
+
def function
|
9
|
+
action_closure
|
10
|
+
end
|
11
|
+
|
6
12
|
# Transition's action (before validation).
|
7
13
|
#
|
8
14
|
def action
|
data/lib/y_petri/transition/T.rb
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
# Mixin for timed Petri net transitions.
|
4
4
|
#
|
5
5
|
module YPetri::Transition::Type_T
|
6
|
+
# For timed transitions, "function" refers to their rate closure.
|
7
|
+
#
|
8
|
+
def function
|
9
|
+
rate_closure
|
10
|
+
end
|
11
|
+
|
6
12
|
# Transition's action (before validation). Requires Δt as an argument.
|
7
13
|
#
|
8
14
|
def action Δt
|
data/lib/y_petri/transition/t.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
# Mixin for
|
3
|
+
# Mixin for timeless non-assignment Petri net transitions.
|
4
4
|
#
|
5
5
|
module YPetri::Transition::Type_t
|
6
|
+
# For timeless transitions, "function" refers to their action closure.
|
7
|
+
#
|
8
|
+
def function
|
9
|
+
action_closure
|
10
|
+
end
|
11
|
+
|
6
12
|
# Result of the transition's "function", regardless of the #enabled? status.
|
7
13
|
#
|
8
14
|
def action
|
data/lib/y_petri/version.rb
CHANGED
data/test/transition_test.rb
CHANGED
@@ -72,6 +72,7 @@ describe ::YPetri::Transition do
|
|
72
72
|
@t1.codomain_marking.must_equal [ @p1.marking, @p3.marking ]
|
73
73
|
@t1.domain_marking.must_equal [@p2.marking ]
|
74
74
|
@t1.zero_action.must_equal [0, 0]
|
75
|
+
@t1.action_closure.must_equal @t1.function
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
@@ -103,6 +104,7 @@ describe ::YPetri::Transition do
|
|
103
104
|
[ @p1.marking, @p5.marking ].must_equal [2, 4]
|
104
105
|
@t2.fire!
|
105
106
|
[ @p1.marking, @p5.marking ].must_equal [3, 3]
|
107
|
+
@t1.action_closure.must_equal @t1.function
|
106
108
|
end
|
107
109
|
end
|
108
110
|
|
@@ -120,6 +122,7 @@ describe ::YPetri::Transition do
|
|
120
122
|
@t1.domain.must_equal [@p5]
|
121
123
|
[ @p1.marking, @p5.marking ].must_equal [1, 5]
|
122
124
|
@t1.rate_closure.arity.must_equal 0
|
125
|
+
@t1.rate_closure.must_equal @t1.function
|
123
126
|
@t1.fire! 0.5
|
124
127
|
[ @p1.marking, @p5.marking ].must_equal [1.5, 4.5]
|
125
128
|
end
|
@@ -158,6 +161,7 @@ describe ::YPetri::Transition do
|
|
158
161
|
assert_in_epsilon 1.63, @p2.marking, 1e-15
|
159
162
|
assert_in_epsilon 3.4, @p3.marking, 1e-15
|
160
163
|
assert_in_epsilon 4.37, @p4.marking, 1e-15
|
164
|
+
@TS1.rate_closure.must_equal @TS1.function
|
161
165
|
end
|
162
166
|
end
|
163
167
|
end
|
@@ -219,6 +223,7 @@ describe "upstream and downstream reference mτs of places and transitions" do
|
|
219
223
|
assert @t.assignment_action?
|
220
224
|
@t.domain.must_equal []
|
221
225
|
@t.action_closure.arity.must_equal 0
|
226
|
+
@t.action_closure.must_equal @t.function
|
222
227
|
@t.fire!
|
223
228
|
@p.marking.must_equal 1
|
224
229
|
end
|
data/test/world_test.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.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- boris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
283
|
version: '0'
|
284
284
|
requirements: []
|
285
285
|
rubyforge_project:
|
286
|
-
rubygems_version: 2.
|
286
|
+
rubygems_version: 2.5.1
|
287
287
|
signing_key:
|
288
288
|
specification_version: 4
|
289
289
|
summary: Systems modelling and simulation gem. Biologically inspired, but concerns
|