class YPetri::Core::Timed

Timed simulation core. Knows several simulation methods applicable to timed nets.

Constants

METHODS

Attributes

time[R]

From now on, core has its own time attribute and selector.

Public Class Methods

new(**named_args) click to toggle source
Calls superclass method
# File lib/y_petri/core/timed.rb, line 34
def initialize **named_args
  super                       # TODO: Net type checking.
  @time = 0.0
  extend METHODS.fetch simulation_method
  @delta_s = simulation.MarkingVector.zero( @free_pp )
  @delta_S = simulation.MarkingVector.zero( @free_pp )
end

Public Instance Methods

flux_vector() click to toggle source

Flux vector. The caller asserts that all the timed transitions are stoichiometric, or error.

# File lib/y_petri/core/timed.rb, line 83
def flux_vector
  msg = "#flux_vector method only applies to the timed simulations with " +
    "no Ts transitions. Try #flux_vector_TS instead!"
  fail msg unless Ts_transitions().empty?
  simulation.TS_rate_closure.call
end
flux_vector_TS() click to toggle source

Flux vector of TS transitions.

# File lib/y_petri/core/timed.rb, line 92
def flux_vector_TS
  simulation.TS_rate_closure.call
end
Also aliased as: propensity_vector_TS
gradient() click to toggle source

Gradient for free places.

# File lib/y_petri/core/timed.rb, line 61
def gradient
  gradient_Ts + gradient_TS
end
Also aliased as:
gradient_TS() click to toggle source

Gradient contribution by TS transitions.

# File lib/y_petri/core/timed.rb, line 76
def gradient_TS
  ( simulation.TS_stoichiometry_matrix * flux_vector_TS )
end
gradient_Ts() click to toggle source

Gradient contribution by Ts transitions.

# File lib/y_petri/core/timed.rb, line 68
def gradient_Ts
  simulation.Ts_gradient_closure.call
  # this could be
  # @Ts_gradient_closure.call
end
increment_time!(Δt) click to toggle source

Increments core time by Δt.

# File lib/y_petri/core/timed.rb, line 44
def increment_time! Δt
  @time += Δt
end
propensity_vector_TS()
Alias for: flux_vector_TS
step!(Δt=simulation.step) click to toggle source

Makes a single step by Δt.

# File lib/y_petri/core/timed.rb, line 50
def step! Δt=simulation.step
  # TODO: This one will act directly upon simulation. Subject of potential
  # change later.
  increment_marking_vector Δ( Δt )
  # TODO: The bottom two, obviously, act directly upon simulation.
  simulation.increment_time! Δt
  simulation.recorder.alert
end
timed?() click to toggle source

This inquirer (=Boolean selector) is always true for timed cores.

# File lib/y_petri/core/timed.rb, line 28
def timed?; true end
timeless?() click to toggle source

This inquirer (=Boolean selector) is always false for timed cores.

# File lib/y_petri/core/timed.rb, line 32
def timeless?; false end
()
Alias for: gradient