Module: YPetri::Simulation::TransitionRepresentation::Type_T

Includes:
Type_a
Included in:
Type_TS, Type_Ts
Defined in:
lib/y_petri/simulation/transition_representation/T.rb

Instance Method Summary collapse

Methods included from Type_a

#A?, #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

#gObject

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_allObject

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

#gradientObject

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

#initObject

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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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