Module: YPetri::Simulation::TransitionRepresentation::Type_T
- Includes:
- Type_a
- Defined in:
- lib/y_petri/simulation/transition_representation/T.rb
Instance Method Summary collapse
-
#d(Δt) ⇒ Object
Change, for free places, as it would happen if the transition fired for time Δt, returned as hash codomain place names >> change.
-
#d_all(Δt) ⇒ Object
Change, for all places, as it would happen if the transition fired for time Δt, returned as hash codomain place names >> change.
-
#delta(Δt) ⇒ Object
Change, for free places, as it would happen if the transition fired for time Δt, returned as hash codomain places >> change.
-
#g ⇒ Object
Returns the gradient contribution to the free places, as hash place names >> gradient contribution.
-
#g_all ⇒ Object
Returns the gradient contribution to all the places, as hash place names >> gradient contribution.
-
#gradient ⇒ Object
Gradient contribution of the transition to the free places.
-
#init ⇒ Object
Initialization subroutine.
-
#t? ⇒ Boolean
(also: #timeless?)
False for timed transitions.
-
#T? ⇒ Boolean
(also: #timed?)
True for timed transitions.
-
#Δ(Δt) ⇒ Object
(also: #delta_all)
Change, for all places, as it would happen if the transition fired for time Δt, returned as hash codomain places >> change.
Methods included from Type_a
Instance Method Details
#d(Δt) ⇒ Object
Change, for free places, as it would happen if the transition fired for time Δt, returned as hash codomain place names >> change.
61 62 63 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 61 def d Δt delta( Δt ).with_keys do |p| p.name || p end end |
#d_all(Δt) ⇒ Object
Change, for all places, as it would happen if the transition fired for time Δt, returned as hash codomain place names >> change.
76 77 78 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 76 def d_all( Δt ) delta( Δt ).with_keys do |p| p.name || p end end |
#delta(Δt) ⇒ Object
Change, for free places, as it would happen if the transition fired for time Δt, returned as hash codomain places >> change.
54 55 56 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 54 def delta Δt gradient.with_values { |v| v * Δt } end |
#g ⇒ Object
Returns the gradient contribution to the free places, as hash place names >> gradient contribution.
40 41 42 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 40 def g gradient.with_keys do |p| p.name || p end end |
#g_all ⇒ Object
Returns the gradient contribution to all the places, as hash place names >> gradient contribution.
47 48 49 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 47 def g_all ∇.with_keys do |p| p.name || p end end |
#gradient ⇒ Object
Gradient contribution of the transition to the free places.
33 34 35 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 33 def gradient ∇.select { |p, v| p.free? } end |
#init ⇒ Object
Initialization subroutine.
25 26 27 28 29 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 25 def init simulation.extend YPetri::Simulation::Timed unless simulation.timed? super @function = source.rate_closure end |
#t? ⇒ Boolean Also known as: timeless?
False for timed transitions.
18 19 20 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 18 def t? false end |
#T? ⇒ Boolean Also known as: timed?
True for timed transitions.
11 12 13 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 11 def T? true end |
#Δ(Δt) ⇒ Object Also known as: delta_all
Change, for all places, as it would happen if the transition fired for time Δt, returned as hash codomain places >> change.
68 69 70 |
# File 'lib/y_petri/simulation/transition_representation/T.rb', line 68 def Δ( Δt ) gradient.with_values { |v| v * Δt } end |