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.2.4 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.2.3 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.2.2 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.2.1 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.2.0 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.51 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.50 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.49 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.48 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.47 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.46 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.45 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.44 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.42 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.40 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.39 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.37 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.36 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.35 lib/y_petri/simulation/transitions/tS.rb
y_petri-2.1.34 lib/y_petri/simulation/transitions/tS.rb