y_petri 2.1.12 → 2.1.16
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/lib/y_petri/net/data_set.rb +4 -1
- data/lib/y_petri/net/state/feature/delta.rb +1 -1
- data/lib/y_petri/net/state/feature/firing.rb +1 -1
- data/lib/y_petri/net/state/features/record.rb +1 -0
- data/lib/y_petri/simulation/dependency.rb +1 -1
- data/lib/y_petri/simulation/elements.rb +2 -2
- data/lib/y_petri/simulation/marking_vector/access.rb +9 -0
- data/lib/y_petri/simulation/timed.rb +1 -2
- data/lib/y_petri/simulation/transitions/A.rb +1 -3
- data/lib/y_petri/simulation/transitions/TS.rb +1 -6
- data/lib/y_petri/simulation/transitions/Ts.rb +1 -6
- data/lib/y_petri/simulation/transitions/tS.rb +1 -6
- data/lib/y_petri/simulation/transitions/ts.rb +1 -6
- data/lib/y_petri/version.rb +1 -1
- data/test/simulation_test.rb +0 -2
- 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: faa600d44898af726d1c1fa7fe8e7e1304713539
|
4
|
+
data.tar.gz: b9037c0ba92671423c1b7625b2d82a83a6411fb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b7be8d04a04a33505f903d2b173e715621d0be2b9a0c136b22d8fccc7a47174cf5dbb09dcb1fb66f540ec600cebd95aef06d23c28fc7a043f18ebb8bf9ac3cb
|
7
|
+
data.tar.gz: e443882ed004b50a4b2e8727961a0ab0101ac9d21e29ec67a48bd8a009545f5ce08bf3878133a1c50ba04bace33fcb602ef59715847cf2610a5203cc53f6186c
|
data/lib/y_petri/net/data_set.rb
CHANGED
@@ -213,7 +213,10 @@ class YPetri::Net::DataSet < Hash
|
|
213
213
|
events = events()
|
214
214
|
data_ss = series
|
215
215
|
x_range = if time.nil? then
|
216
|
-
|
216
|
+
from = events.first || 0
|
217
|
+
to = events.last && events.last > from ? events.last :
|
218
|
+
events.first + 1
|
219
|
+
"[#{from}:#{to}]"
|
217
220
|
elsif time.is_a? Range then
|
218
221
|
"[#{time.begin}:#{time.end}]"
|
219
222
|
else
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
# Basic elements of a simulation, a mixin intended for YPetri::Simulation.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
class YPetri::Simulation
|
6
6
|
class Elements < Array
|
7
7
|
★ Dependency
|
@@ -23,7 +23,7 @@ class YPetri::Simulation
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# Creates a subset of this collection (of the same class).
|
26
|
-
#
|
26
|
+
#
|
27
27
|
def subset element_ids=nil, &block
|
28
28
|
if block_given? then
|
29
29
|
msg = "If block is given, arguments are not allowed!"
|
@@ -33,6 +33,15 @@ class YPetri::Simulation::MarkingVector
|
|
33
33
|
places( ids ).names( true ) >> m( ids )
|
34
34
|
end
|
35
35
|
alias pn_m p_m
|
36
|
+
|
37
|
+
# Pretty prints marking of all places as hash with place names as keys.
|
38
|
+
# Takes optional list of place ids (ordered argument no. 1), and optional
|
39
|
+
# 2 named arguments (+:gap+ and +:precision+) as in
|
40
|
+
# +#pretty_print_numeric_values+.
|
41
|
+
#
|
42
|
+
def pm ids=nil, gap: 0, precision: 2
|
43
|
+
p_m( ids ).pretty_print_numeric_values gap: gap, precision: precision
|
44
|
+
end
|
36
45
|
alias pm p_m
|
37
46
|
|
38
47
|
# Modifies the marking vector. Takes one argument. If the argument is a hash
|
@@ -172,8 +172,7 @@ module YPetri::Simulation::Timed
|
|
172
172
|
# for timed simulations.
|
173
173
|
#
|
174
174
|
def init_core_and_recorder_subclasses
|
175
|
-
param_class( { Core: YPetri::Core::Timed,
|
176
|
-
Recorder: Recorder },
|
175
|
+
param_class( { Core: YPetri::Core::Timed, Recorder: Recorder },
|
177
176
|
with: { simulation: self } )
|
178
177
|
end
|
179
178
|
|
@@ -4,10 +4,7 @@
|
|
4
4
|
#
|
5
5
|
class YPetri::Simulation::Transitions
|
6
6
|
module Type_A
|
7
|
-
attr_reader :assignment_closure
|
8
|
-
|
9
7
|
def initialize
|
10
|
-
@assignment_closure = to_assignment_closure
|
11
8
|
end
|
12
9
|
|
13
10
|
# Assignment closures that directly affect the marking when called.
|
@@ -36,5 +33,6 @@ class YPetri::Simulation::Transitions
|
|
36
33
|
closures = assignment_closures
|
37
34
|
-> { closures.each &:call }
|
38
35
|
end
|
36
|
+
alias assignment_closure to_assignment_closure
|
39
37
|
end # Type_A
|
40
38
|
end # class YPetri::Simulation::Transitions
|
@@ -7,12 +7,6 @@ class YPetri::Simulation::Transitions
|
|
7
7
|
include Type_T
|
8
8
|
include Type_S
|
9
9
|
|
10
|
-
# Rate vector closure accessor.
|
11
|
-
#
|
12
|
-
def rate_closure
|
13
|
-
@rate_closure ||= to_rate_closure
|
14
|
-
end
|
15
|
-
|
16
10
|
# Rate (flux, propensity) closures.
|
17
11
|
#
|
18
12
|
def rate_closures
|
@@ -53,5 +47,6 @@ class YPetri::Simulation::Transitions
|
|
53
47
|
rc = rate_closures
|
54
48
|
-> { rc.map( &:call ).to_column_vector }
|
55
49
|
end
|
50
|
+
alias rate_closure to_rate_closure
|
56
51
|
end # module Type_TS
|
57
52
|
end # class YPetri::Simulation::Transitions
|
@@ -7,12 +7,6 @@ class YPetri::Simulation::Transitions
|
|
7
7
|
include Type_T
|
8
8
|
include Type_s
|
9
9
|
|
10
|
-
# gradient closure accessor.
|
11
|
-
#
|
12
|
-
def gradient_closure
|
13
|
-
@gradient_closure ||= to_gradient_closure
|
14
|
-
end
|
15
|
-
|
16
10
|
# Member gradient closures.
|
17
11
|
#
|
18
12
|
def gradient_closures
|
@@ -56,5 +50,6 @@ class YPetri::Simulation::Transitions
|
|
56
50
|
LAMBDA
|
57
51
|
eval λ
|
58
52
|
end
|
53
|
+
alias gradient_closure to_gradient_closure
|
59
54
|
end # module Type_Ts
|
60
55
|
end # class YPetri::Simulation::Transitions
|
@@ -7,12 +7,6 @@ class YPetri::Simulation::Transitions
|
|
7
7
|
include Type_t
|
8
8
|
include Type_S
|
9
9
|
|
10
|
-
# firing closure accessor.
|
11
|
-
#
|
12
|
-
def firing_closure
|
13
|
-
@firing_closure ||= to_firing_closure
|
14
|
-
end
|
15
|
-
|
16
10
|
# tS transitions have firing closures.
|
17
11
|
#
|
18
12
|
def firing_closures
|
@@ -51,5 +45,6 @@ class YPetri::Simulation::Transitions
|
|
51
45
|
closures = firing_closures
|
52
46
|
-> { closures.map( &:call ).to_column_vector }
|
53
47
|
end
|
48
|
+
alias firing_closure to_firing_closure
|
54
49
|
end # module Type_tS
|
55
50
|
end # class YPetri::Simulation::Transitions
|
@@ -7,12 +7,6 @@ class YPetri::Simulation::Transitions
|
|
7
7
|
include Type_t
|
8
8
|
include Type_s
|
9
9
|
|
10
|
-
# Delta closure accessor.
|
11
|
-
#
|
12
|
-
def delta_closure
|
13
|
-
@delta_closure ||= to_delta_closure
|
14
|
-
end
|
15
|
-
|
16
10
|
# ts transitions have action closures.
|
17
11
|
#
|
18
12
|
def delta_closures
|
@@ -54,5 +48,6 @@ class YPetri::Simulation::Transitions
|
|
54
48
|
LAMBDA
|
55
49
|
eval λ
|
56
50
|
end
|
51
|
+
alias delta_closure to_delta_closure
|
57
52
|
end
|
58
53
|
end # class YPetri::Simulation::Transitions
|
data/lib/y_petri/version.rb
CHANGED
data/test/simulation_test.rb
CHANGED
@@ -252,7 +252,6 @@ describe YPetri::Simulation do
|
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
255
|
-
|
256
255
|
describe "timeless simulation" do
|
257
256
|
before do
|
258
257
|
self.class.class_exec { include YPetri }
|
@@ -299,7 +298,6 @@ describe "timeless simulation" do
|
|
299
298
|
end
|
300
299
|
end
|
301
300
|
|
302
|
-
|
303
301
|
describe "timed simulation" do
|
304
302
|
before do
|
305
303
|
self.class.class_exec { include YPetri }
|
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.16
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: y_support
|