Sha256: b7266fb17128c52a568768598f8b15d6ca05210dbea8aa170f9c78c4b14f95cc

Contents?: true

Size: 918 Bytes

Versions: 52

Compression:

Stored size: 918 Bytes

Contents

# encoding: utf-8

# A mixin for TS transition representations.
# 
class YPetri::Simulation::TransitionRepresentation
  module Type_TS
    include Type_T
    include Type_S

    attr_reader :rate_closure

    # Initialization subroutine.
    # 
    def init
      super
      @rate_closure = to_rate_closure
    end

    # Transition's rate, given the current system state.
    # 
    def rate
      rate_closure.call
    end
    alias flux rate
    alias propensity rate

    # Firing of the transition (rate * Δtime).
    # 
    def firing Δt
      rate * Δt
    end

    # Gradient contribution of the transition to all places.
    # 
    def ∇
      codomain >> stoichiometry.map { |coeff| rate * coeff }
    end
    alias gradient_all ∇

    # Builds a flux closure.
    # 
    def to_rate_closure
      build_closure
    end
  end # module Type_TS
end # class YPetri::Simulation::TransitionRepresentation

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
y_petri-2.4.9 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.4.8 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.4.6 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.4.4 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.4.3 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.4.2 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.4.0 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.12 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.11 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.10 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.9 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.8 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.6 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.5 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.4 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.3 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.3.2 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.2.4 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.2.3 lib/y_petri/simulation/transition_representation/TS.rb
y_petri-2.2.2 lib/y_petri/simulation/transition_representation/TS.rb