class YPetri::Transition
-
Timed transitions have rate closure, whose result is to be multiplied by +Δtime+.
-
Timeless transitions have action closure, whose result does not need to be multiplied by time.
Summary: Having vs. not having rate distinguishes the need to multiply the closure result by Δ time.
Stoichiometricity¶ ↑
-
TS transitions – rate vector = rate * stoichiometry vector
-
tS transitions – action vector = action * stoichiometry vector
-
Ts transitions – rate vector = rate closure result
-
ts transitions – action vector = action closure result
Summary: stoichiometricity distinguishes the need to multiply the rate/action closure result by stoichiometry.
Assignment action¶ ↑
Assignment transitions (_A_ transitions) are special transitions, that replace the codomain marking rather than modifying it – they assign new marking to their codomain, like we are used to from spreadsheets. Technically, this behavior is easily achievable with normal ts transitions, so the existence of separate A transitions is just a convenience, not a new type of a transition in the mathematical sense.
Functional / functionless transitions¶ ↑
Other Petri net implementation often distinguies between “ordinary” (vanilla as per C. A. Petri) and functional transitions, whose operation is governed by a function. In YPetri
, transitions are generally functional, but there remains a possibility of creating vanilla (functionless) transitions by not specifying any rate / action, while specifying the stoichiometry. Action closure as per C. A. Petri is automatically constructed for these.
Constants
- TYPES
Attributes
For rateless transition, action closure must be present. Action closure input arguments must correspond to the domain places, and for timed transitions, the first argument of the action closure must be Δtime.
Codomain, 'downstream arcs', or 'action arcs', is a collection of places, whose marking is directly changed by this transition's firing.
For rateless transition, action closure must be present. Action closure input arguments must correspond to the domain places, and for timed transitions, the first argument of the action closure must be Δtime.
Codomain, 'downstream arcs', or 'action arcs', is a collection of places, whose marking is directly changed by this transition's firing.
Codomain, 'downstream arcs', or 'action arcs', is a collection of places, whose marking is directly changed by this transition's firing.
Codomain, 'downstream arcs', or 'action arcs', is a collection of places, whose marking is directly changed by this transition's firing.
Domain, or 'upstream arcs', is a collection of places, whose marking directly affects the transition's action.
Domain, or 'upstream arcs', is a collection of places, whose marking directly affects the transition's action.
Domain, or 'upstream arcs', is a collection of places, whose marking directly affects the transition's action.
Codomain, 'downstream arcs', or 'action arcs', is a collection of places, whose marking is directly changed by this transition's firing.
Codomain, 'downstream arcs', or 'action arcs', is a collection of places, whose marking is directly changed by this transition's firing.
Codomain, 'downstream arcs', or 'action arcs', is a collection of places, whose marking is directly changed by this transition's firing.
In YPetri
, rate is a unifying term for both flux and propensity, both of which are treated as aliases of rate. The decision between discrete and continuous computation is a concern of the simulation. Rate closure arity should correspond to the transition's domain.
In YPetri
, rate is a unifying term for both flux and propensity, both of which are treated as aliases of rate. The decision between discrete and continuous computation is a concern of the simulation. Rate closure arity should correspond to the transition's domain.
In YPetri
, rate is a unifying term for both flux and propensity, both of which are treated as aliases of rate. The decision between discrete and continuous computation is a concern of the simulation. Rate closure arity should correspond to the transition's domain.
In YPetri
, rate is a unifying term for both flux and propensity, both of which are treated as aliases of rate. The decision between discrete and continuous computation is a concern of the simulation. Rate closure arity should correspond to the transition's domain.
In YPetri
, rate is a unifying term for both flux and propensity, both of which are treated as aliases of rate. The decision between discrete and continuous computation is a concern of the simulation. Rate closure arity should correspond to the transition's domain.
In YPetri
, rate is a unifying term for both flux and propensity, both of which are treated as aliases of rate. The decision between discrete and continuous computation is a concern of the simulation. Rate closure arity should correspond to the transition's domain.
Stoichiometry (implies that the transition is stoichiometric).
Domain, or 'upstream arcs', is a collection of places, whose marking directly affects the transition's action.
Domain, or 'upstream arcs', is a collection of places, whose marking directly affects the transition's action.
Domain, or 'upstream arcs', is a collection of places, whose marking directly affects the transition's action.
Public Class Methods
Transition
class represents many different kinds of Petri net transitions. It makes the constructor syntax a bit more polymorphic. The type of the transition to construct is mostly inferred from the constructor arguments.
Mandatorily, the constructor will always need a way to determine the domain (upstream arcs) and codomain (downstream arcs) of the transition. Also, the constructor must have a way to determine the transition's action. This is best explained by examples – let us have 3 places A, B, C, for whe we will create different kinds of transitions:
TS (timed stoichiometric)¶ ↑
Rate closure and stoichiometry has to be supplied. Rate closure arity should correspond to the domain size. Return arity should be 1 (to be multiplied by the stoichiometry vector, as in all other stoichiometric transitions).
Transition.new stoichiometry: { A: -1, B: 1 }, rate: -> a { a * 0.5 }
Ts (timed nonstoichiometric)¶ ↑
Rate closure has to be supplied, whose arity should match the domain, and output arity codomain.
tS (timeless stoichiometric)¶ ↑
Stoichiometry has to be supplied, action closure is optional. If supplied, its return arity should be 1 (to be multiplied by the stoichiometry vector).
ts transitions (timeless nonstoichiometric)¶ ↑
Action closure is expected with return arity equal to the codomain size:
Transition.new upstream_arcs: [A, C], downstream_arcs: [A, B], action_closure: proc { |m, x| if x > 0 then [-(m / 2), (m / 2)] else [1, 0] end }
# File lib/y_petri/transition.rb, line 165 def initialize *args, &block check_in_arguments *args, &block # the big job extend( if timed? then Type_T elsif assignment_action? then Type_A else Type_t end ) inform_upstream_places # that they have been connected inform_downstream_places # that they have been connected uncock # initialize in uncocked state end
Public Instance Methods
# Conversion to a string. # def to_s
"#<Transition: %s>" % "#{'%s ' % name if name}(#{type})#{' id:%s' % object_id unless name}"
end
# File lib/y_petri/transition.rb, line 280 def place id super rescue Place().instance( id ) end
Stoichiometry as a hash of pairs: { codomain_place_name_symbol => stoichiometric_coefficient }
# File lib/y_petri/transition.rb, line 210 def s stoichio.with_keys { |k| k.name || k.object_id } end
Stoichiometry as a hash of pairs: { codomain_place_instance => stoichiometric_coefficient }
# File lib/y_petri/transition.rb, line 203 def stoichio Hash[ codomain.zip( @stoichiometry ) ] end
Object#transition
# File lib/y_petri/transition.rb, line 284 def transition id super rescue Transition().instance( id ) end
Zero action.
# File lib/y_petri/transition.rb, line 235 def zero_action codomain.map { 0 } end