Sha256: 1dc516f7fbdf3da29de042fd17a7360ec48f0f06fba6cfc98c0701f9e1171b7c

Contents?: true

Size: 1.1 KB

Versions: 32

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

32 entries across 32 versions & 1 rubygems

Version Path
y_petri-2.1.33 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.31 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.30 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.26 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.25 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.24 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.22 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.21 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.20 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.18 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.17 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.16 lib/y_petri/simulation/transitions/tS.rb