y_petri 2.1.3 → 2.1.6
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/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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a26f28cc30784b84af2607346f5ae43815378cc9
|
4
|
+
data.tar.gz: 7b42c3212a0763a35a59cf0880e420bbee0f1940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78881ebf5455b9165f9fcc1545cf57523a84951e7e47721038dc5196e52912296fed36abfcb87c6cb652d6c00cf1bef83a2ab1fbc46aa7b2d5bf31943e80ef6c
|
7
|
+
data.tar.gz: 30852ad27a179bc77662c2dc1aef932299a7b4f9493cab3ab52d255f3928b794af74f904f3f60327620ddc63757f3cb6762e8af5931003e45bb03b04cc5546ea
|
@@ -78,15 +78,35 @@ module YPetri::Agent::PetriNetRelated
|
|
78
78
|
# world. Rate closure has to be supplied as a block.
|
79
79
|
#
|
80
80
|
def T( *ordered, **named, &block )
|
81
|
+
fail ArgumentError, "Timed transition constructor requires a block " +
|
82
|
+
"defining the rate function!" unless block
|
81
83
|
world.Transition.new *ordered, **named.update( rate: block )
|
82
84
|
end
|
83
85
|
|
86
|
+
# Timed stoichiometric transition constructor, that expects stoichiometry
|
87
|
+
# given directly as hash-collected arguments. Two special keys allowed are
|
88
|
+
# +:name+ (alias +:ɴ) and +:domain+. (Key +:codomain+ is not allowed.)
|
89
|
+
#
|
90
|
+
def TS **stoichiometry, &block
|
91
|
+
args = { s: stoichiometry }
|
92
|
+
args.update name: stoichiometry.delete( :name ) if
|
93
|
+
stoichiometry.has? :name, syn!: :ɴn
|
94
|
+
args.update domain: stoichiometry.delete( :domain ) if
|
95
|
+
stoichiometry.has? :domain
|
96
|
+
T **args, &block
|
97
|
+
end
|
98
|
+
|
84
99
|
# Assignment transition constructor: Creates a new assignment transition in
|
85
|
-
# the current world.
|
86
|
-
#
|
87
|
-
|
88
|
-
|
89
|
-
|
100
|
+
# the current world. Ordered arguments are collected as codomain. Domain key
|
101
|
+
# (+:domain) is optional. Assignment closure must be supplied in a block.
|
102
|
+
#
|
103
|
+
def A( *codomain, **nn, &block )
|
104
|
+
fail ArgumentError, "Assignment transition constructor requires a block " +
|
105
|
+
"defining the assignment function!" unless block
|
106
|
+
world.Transition.new codomain: codomain,
|
107
|
+
assignment: true,
|
108
|
+
action: block,
|
109
|
+
**nn
|
90
110
|
end
|
91
111
|
|
92
112
|
# Net constructor: Creates a new Net instance in the current world.
|
@@ -1,12 +1,14 @@
|
|
1
|
-
class YPetri::Agent
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
class YPetri::Agent
|
2
|
+
class Selection
|
3
|
+
# TODO: This calls for refactor as Array subclass. No time right now...
|
4
|
+
def initialize
|
5
|
+
clear
|
6
|
+
end
|
7
|
+
def clear; @selection = [] end
|
8
|
+
def set *aa; @selection = aa end
|
9
|
+
def get; @selection end
|
10
|
+
def add arg; @selection << arg end
|
11
|
+
alias :<< :add
|
12
|
+
def subtract arg; @selection -= arg end
|
5
13
|
end
|
6
|
-
def clear; @selection = [] end
|
7
|
-
def set *aa; @selection = aa end
|
8
|
-
def get; @selection end
|
9
|
-
def add arg; @selection << arg end
|
10
|
-
alias :<< :add
|
11
|
-
def subtract arg; @selection -= arg end
|
12
14
|
end
|
@@ -191,7 +191,7 @@ module YPetri::Agent::SimulationRelated
|
|
191
191
|
# collection).
|
192
192
|
#
|
193
193
|
def set_step Δt
|
194
|
-
ssc.update
|
194
|
+
ssc.update step: Δt
|
195
195
|
end
|
196
196
|
alias set_step_size set_step
|
197
197
|
|
@@ -212,7 +212,7 @@ module YPetri::Agent::SimulationRelated
|
|
212
212
|
# settings collection).
|
213
213
|
#
|
214
214
|
def set_sampling Δt
|
215
|
-
ssc.update
|
215
|
+
ssc.update sampling: Δt
|
216
216
|
end
|
217
217
|
|
218
218
|
# Changes the simulation method of the current ssc (ssc = simulation
|
@@ -258,11 +258,8 @@ module YPetri::Agent::SimulationRelated
|
|
258
258
|
# --> delta feature ids
|
259
259
|
# --> flux feature ids
|
260
260
|
# --> firing feature ids
|
261
|
-
|
262
261
|
# take these features together
|
263
|
-
|
264
262
|
# construct the labels and the time series for each
|
265
|
-
|
266
263
|
# plot them
|
267
264
|
|
268
265
|
return nil unless sim = world.simulations.values[-1] # sim@point
|
@@ -287,63 +284,22 @@ module YPetri::Agent::SimulationRelated
|
|
287
284
|
#
|
288
285
|
def plot_state( place_ids=nil, except: [] )
|
289
286
|
sim = simulation or return nil
|
290
|
-
|
291
|
-
|
292
|
-
|
287
|
+
rec = sim.recording
|
288
|
+
pp = sim.net.pp( place_ids.nil? ? net.pp : place_ids ) -
|
289
|
+
sim.net.pp( except )
|
290
|
+
dataset = sim.recording.reduce_features( marking: pp )
|
291
|
+
dataset.plot
|
293
292
|
end
|
294
293
|
alias plot_marking plot_state
|
295
294
|
|
296
295
|
# Plot the recorded flux (computed flux history at the sampling points).
|
297
296
|
#
|
298
|
-
def plot_flux( transition_ids=nil, **options )
|
299
|
-
sim =
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
sim.at( time: time, marking: record ).TS_transitions( tt ).flux_vector ]
|
306
|
-
end
|
307
|
-
# Select a time series for each feature.
|
308
|
-
time_series = tt.map.with_index do |tr, i|
|
309
|
-
tr and flux.map { |time, flux| [ time, flux[i] ] }.transpose
|
310
|
-
end
|
311
|
-
# Time axis
|
312
|
-
time = sim.target_time
|
313
|
-
# Gnuplot call
|
314
|
-
gnuplot( time, tt.compact.names, time_series.compact,
|
315
|
-
title: "Flux plot", ylabel: "Flux [µMⁿ.s⁻¹]" )
|
316
|
-
end
|
317
|
-
|
318
|
-
private
|
319
|
-
|
320
|
-
# Gnuplots a recording. Target time or time range can be supplied as :time
|
321
|
-
# named argument.
|
322
|
-
#
|
323
|
-
def gnuplot( dataset, time: nil, **nn )
|
324
|
-
event_vector = dataset.events
|
325
|
-
data_vectors = dataset.values.transpose
|
326
|
-
x_range = if time.is_a? Range then
|
327
|
-
"[#{time.begin}:#{time.end}]"
|
328
|
-
else
|
329
|
-
"[-0:#{SY::Time.magnitude( time ).amount rescue time}]"
|
330
|
-
end
|
331
|
-
labels = recording.features.labels
|
332
|
-
|
333
|
-
Gnuplot.open do |gp|
|
334
|
-
Gnuplot::Plot.new( gp ) do |plot|
|
335
|
-
plot.xrange x_range
|
336
|
-
plot.title nn[:title] || "Simulation plot"
|
337
|
-
plot.ylabel nn[:ylabel] || "Values"
|
338
|
-
plot.xlabel nn[:xlabel] || "Time [s]"
|
339
|
-
|
340
|
-
labels.zip( data_vectors ).each { |label, data_vector|
|
341
|
-
plot.data << Gnuplot::DataSet.new( [event_vector, data_vector] ) { |ds|
|
342
|
-
ds.with = "linespoints"
|
343
|
-
ds.title = lbl
|
344
|
-
}
|
345
|
-
}
|
346
|
-
end
|
347
|
-
end
|
297
|
+
def plot_flux( transition_ids=nil, except: [], **options )
|
298
|
+
sim = simulation or return nil
|
299
|
+
rec = sim.recording
|
300
|
+
tt = sim.net.tt( transition_ids.nil? ? net.tt : transition_ids ) -
|
301
|
+
sim.net.tt( except )
|
302
|
+
dataset = sim.recording.reduce_features( flux: tt )
|
303
|
+
dataset.plot( title: "Flux plot", ylabel: "Flux [µMⁿ.s⁻¹]" )
|
348
304
|
end
|
349
305
|
end # module YPetri::Agent::SimulationRelated
|
data/lib/y_petri/agent.rb
CHANGED
@@ -1,22 +1,20 @@
|
|
1
|
-
#encoding: utf-8
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative 'agent/selection'
|
4
|
+
require_relative 'agent/hash_key_pointer'
|
5
|
+
require_relative 'agent/petri_net_related'
|
6
|
+
require_relative 'agent/simulation_related'
|
2
7
|
|
3
8
|
# Public command interface of YPetri.
|
4
9
|
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@world = YPetri::World.new
|
11
|
-
super
|
12
|
-
end
|
10
|
+
class YPetri::Agent
|
11
|
+
★ PetriNetRelated # ★ means include
|
12
|
+
★ SimulationRelated
|
13
13
|
|
14
|
-
|
15
|
-
require_relative 'agent/hash_key_pointer'
|
16
|
-
require_relative 'agent/petri_net_related'
|
17
|
-
require_relative 'agent/simulation_related'
|
14
|
+
attr_reader :world
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
16
|
+
def initialize
|
17
|
+
@world = YPetri::World.new
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end # module YPetri::Agent
|
@@ -2,19 +2,17 @@
|
|
2
2
|
|
3
3
|
# Euler method.
|
4
4
|
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
5
|
+
module YPetri::Core::Timed::Euler
|
6
|
+
# Name of this method.
|
7
|
+
#
|
8
|
+
def simulation_method
|
9
|
+
:euler
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end # YPetri::Core::Timed
|
12
|
+
# Computes Δ for the period of Δt.
|
13
|
+
#
|
14
|
+
def delta Δt
|
15
|
+
gradient * Δt
|
16
|
+
end
|
17
|
+
alias Δ delta
|
18
|
+
end # YPetri::Core::Timed::Euler
|
@@ -2,30 +2,28 @@
|
|
2
2
|
|
3
3
|
# Euler method with timeless transitions firing after each step.
|
4
4
|
#
|
5
|
-
|
6
|
-
|
7
|
-
include Euler
|
5
|
+
module YPetri::Core::Timed::PseudoEuler
|
6
|
+
include YPetri::Core::Timed::Euler
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
# Name of this method.
|
9
|
+
#
|
10
|
+
def simulation_method
|
11
|
+
:pseudo_euler
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
# Computes Δ for the period of Δt.
|
15
|
+
#
|
16
|
+
def delta Δt
|
17
|
+
super + delta_timeless
|
18
|
+
end
|
19
|
+
alias Δ delta
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end # YPetri::Core::Timed
|
21
|
+
# Makes a single step by Δt.
|
22
|
+
#
|
23
|
+
def step! Δt=simulation.step
|
24
|
+
increment_marking_vector Δ( Δt )
|
25
|
+
assignment_transitions_all_fire!
|
26
|
+
simulation.increment_time! Δt
|
27
|
+
alert
|
28
|
+
end
|
29
|
+
end # YPetri::Core::Timed::PseudoEuler
|
@@ -2,22 +2,20 @@
|
|
2
2
|
|
3
3
|
# Euler method with timeless transitions firing every time tick.
|
4
4
|
#
|
5
|
-
|
6
|
-
|
7
|
-
include Euler
|
5
|
+
module YPetri::Core::Timed::QuasiEuler
|
6
|
+
include YPetri::Core::Timed::Euler
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
# Name of this method.
|
9
|
+
#
|
10
|
+
def simulation_method
|
11
|
+
:quasi_euler
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end # YPetri::Core::Timed
|
14
|
+
# Makes a single step by Δt.
|
15
|
+
#
|
16
|
+
def step! Δt=simulation.step_size
|
17
|
+
fail NotImplementedError
|
18
|
+
# Now one would have to compare whichever comes first, time tick or the
|
19
|
+
# end of Δt, and then again and again, until Δt is fired...
|
20
|
+
end
|
21
|
+
end # YPetri::Core::Timed::QuasiEuler
|
data/lib/y_petri/core/timed.rb
CHANGED
@@ -2,56 +2,54 @@
|
|
2
2
|
|
3
3
|
# Timed simulation core.
|
4
4
|
#
|
5
|
-
class YPetri::Core
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
require_relative 'timed/quasi_euler.rb' # timeless fire each time tick
|
5
|
+
class YPetri::Core::Timed < YPetri::Core
|
6
|
+
require_relative 'timed/euler.rb'
|
7
|
+
require_relative 'timed/pseudo_euler.rb' # timeless fire after each step
|
8
|
+
require_relative 'timed/quasi_euler.rb' # timeless fire each time tick
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
# Makes a single step by Δt.
|
11
|
+
#
|
12
|
+
def step! Δt=simulation.step
|
13
|
+
increment_marking_vector Δ( Δt )
|
14
|
+
increment_time! Δt
|
15
|
+
note_state_change
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
# Gradient for free places.
|
19
|
+
#
|
20
|
+
def gradient
|
21
|
+
gradient_Ts + gradient_TS
|
22
|
+
end
|
23
|
+
alias ∇ gradient
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
# Gradient contribution by Ts transitions.
|
26
|
+
#
|
27
|
+
def gradient_Ts
|
28
|
+
simulation.Ts_gradient_closure.call
|
29
|
+
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
# Gradient contribution by TS transitions.
|
32
|
+
#
|
33
|
+
def gradient_TS
|
34
|
+
( simulation.TS_stoichiometry_matrix * flux_vector_TS )
|
35
|
+
end
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
# Flux vector. The caller asserts that all the timed transitions are
|
38
|
+
# stoichiometric, or error.
|
39
|
+
#
|
40
|
+
def flux_vector
|
41
|
+
msg = "#flux_vector method only applies to the timed simulations with " +
|
42
|
+
"no Ts transitions. Try #flux_vector_TS instead!"
|
43
|
+
fail msg unless Ts_transitions().empty?
|
44
|
+
simulation.TS_rate_closure.call
|
45
|
+
end
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end # class YPetri::Core
|
47
|
+
# Flux vector of TS transitions.
|
48
|
+
#
|
49
|
+
def flux_vector_TS
|
50
|
+
simulation.TS_rate_closure.call
|
51
|
+
end
|
52
|
+
end # class YPetri::Core::Timed
|
55
53
|
|
56
54
|
# In general, it is not required that all net elements are simulated with the
|
57
55
|
# same method. Practically, ODE systems have many good simulation methods
|
@@ -3,18 +3,16 @@
|
|
3
3
|
# Implicit Euler for timeless nets. Simply, timeless transitions
|
4
4
|
# fire simultaneously, after which A transitions (if any) fire.
|
5
5
|
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
6
|
+
module YPetri::Core::Timeless::PseudoEuler
|
7
|
+
# Name of this method.
|
8
|
+
#
|
9
|
+
def simulation_method
|
10
|
+
:pseudo_euler
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end # class YPetri::Core::Timeless
|
13
|
+
def step!
|
14
|
+
increment_marking_vector Δ
|
15
|
+
assignment_transitions_all_fire!
|
16
|
+
alert
|
17
|
+
end
|
18
|
+
end # module YPetri::Core::Timeless::PseudoEuler
|
@@ -2,11 +2,14 @@
|
|
2
2
|
|
3
3
|
# Timeless simulation core.
|
4
4
|
#
|
5
|
-
class YPetri::Core
|
6
|
-
|
7
|
-
require_relative 'timeless/pseudo_euler'
|
5
|
+
class YPetri::Core::Timeless < YPetri::Core
|
6
|
+
require_relative 'timeless/pseudo_euler'
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
8
|
+
def delta
|
9
|
+
delta_timeless
|
10
|
+
end
|
11
|
+
|
12
|
+
def Δ
|
13
|
+
delta
|
14
|
+
end
|
15
|
+
end # class YPetri::Core::Timeless
|
data/lib/y_petri/core.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require_relative 'core/timed'
|
4
|
+
require_relative 'core/timeless'
|
5
|
+
|
3
6
|
class YPetri::Core
|
4
7
|
DEFAULT_METHOD = :pseudo_euler
|
5
8
|
|
@@ -95,6 +98,3 @@ class YPetri::Core
|
|
95
98
|
simulation.A_assignment_closure.call
|
96
99
|
end
|
97
100
|
end # class YPetri::Core
|
98
|
-
|
99
|
-
require_relative 'core/timed'
|
100
|
-
require_relative 'core/timeless'
|
data/lib/y_petri/dsl.rb
CHANGED
@@ -11,54 +11,54 @@ module YPetri
|
|
11
11
|
delegate :world, to: :y_petri_agent
|
12
12
|
|
13
13
|
# Petri net aspect.
|
14
|
-
delegate
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
delegate :Place,
|
15
|
+
:Transition, :T, :A,
|
16
|
+
:Net,
|
17
|
+
:place, :transition, :pl, :tr,
|
18
|
+
:places, :transitions, :nets,
|
19
|
+
:pn, :tn, :nn,
|
20
|
+
:net_point,
|
21
|
+
:net_selection,
|
22
|
+
:net, :nnet,
|
23
|
+
:net_point_reset,
|
24
|
+
:net_point=,
|
25
|
+
to: :y_petri_agent
|
26
26
|
|
27
27
|
# Simulation aspect.
|
28
|
-
delegate
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
#
|
60
|
-
|
61
|
-
|
28
|
+
delegate :simulation_point, :ssc_point, :cc_point, :imc_point,
|
29
|
+
:simulation_selection, :ssc_selection,
|
30
|
+
:cc_selection, :imc_selection,
|
31
|
+
:simulations,
|
32
|
+
:clamp_collections,
|
33
|
+
:initial_marking_collections,
|
34
|
+
:simulation_settings_collections,
|
35
|
+
:clamp_collection_names, :ncc,
|
36
|
+
:initial_marking_collection_names, :nimc,
|
37
|
+
:simulation_settings_collection_names, :nssc,
|
38
|
+
:set_clamp_collection, :set_cc,
|
39
|
+
:set_initial_marking_collection, :set_imc,
|
40
|
+
:set_simulation_settings_collection, :set_ssc,
|
41
|
+
:new_simulation,
|
42
|
+
:clamp_cc, :initial_marking_cc, :simulation_settings_cc,
|
43
|
+
:simulation_point_position,
|
44
|
+
:simulation,
|
45
|
+
:clamp_collection, :cc,
|
46
|
+
:initial_marking_collection, :imc,
|
47
|
+
:simulation_settings_collection, :ssc,
|
48
|
+
:clamp,
|
49
|
+
:initial_marking,
|
50
|
+
:set_step, :set_step_size,
|
51
|
+
:set_time, :set_target_time,
|
52
|
+
:set_sampling,
|
53
|
+
:set_simulation_method,
|
54
|
+
:new_timed_simulation,
|
55
|
+
:run!,
|
56
|
+
:print_recording,
|
57
|
+
:plot,
|
58
|
+
:plot_selected,
|
59
|
+
# :plot_state,
|
60
|
+
:plot_flux,
|
61
|
+
to: :y_petri_agent
|
62
62
|
|
63
63
|
def plot_state **nn
|
64
64
|
simulation.recording.marking.plot **nn
|
data/lib/y_petri/fixed_assets.rb
CHANGED