Sha256: 07c712f7018321024c219eadb97434e49a11fdd53d992baea51df29a6a8e3596

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8

# A mixin for collections of tS transitions.
# 
class YPetri::Simulation::Transitions
  module Type_tS
    include Type_t
    include Type_S

    # tS transitions have firing closures.
    # 
    def firing_closures
      map &:firing_closure
    end
    
    # Firing vector (to be multiplied by the stoichiometry to get deltas)
    # 
    def firing_vector
      firing_closure.call
    end

    # Firing vector for these tS transitions, returned as array.
    # 
    def firing
      firing_closures.map &:call
    end

    # Delta contribution to free places.
    # 
    def delta
      stoichiometry_matrix * firing_vector
    end

    # Delta contribution to all places
    # 
    def Δ
      SM() * firing_vector
    end
    alias delta_all Δ

    # Builds the firing vector closure, that outputs the firing vector based on
    # the system state when called.
    # 
    def to_firing_closure
      closures = firing_closures
      -> { closures.map( &:call ).to_column_vector }
    end
    alias firing_closure to_firing_closure
  end # module Type_tS
end # class YPetri::Simulation::Transitions

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
y_petri-2.4.9 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.4.8 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.4.6 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.4.4 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.4.3 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.4.2 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.4.0 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.12 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.11 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.10 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.9 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.8 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.6 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.5 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.4 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.3 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.3.2 lib/y_petri/simulation/transitions/tS.rb