class YPetri::Simulation::TransitionRepresentation
A mixin for S transition representations.
A mixin for timed transition representations.
A mixin for TS transition representations.
A mixin for Ts transition representations.
A mixin for s (nonstoichiometric) transition representations.
A mixin for timed transition representations.
A mixin for tS transition representations.
A mixin for ts transition representations.
A mixin with transition types.
Attributes
Public Class Methods
Expect a single YPetri
place as an argument.
YPetri::Simulation::NodeRepresentation::new
# File lib/y_petri/simulation/transition_representation.rb, line 16 def initialize net_transition super @domain, @codomain = Places( source.domain ), Places( source.codomain ) type_init end
Public Instance Methods
Builds a code string that assigns to the free places of the codomain.
# File lib/y_petri/simulation/transition_representation.rb, line 56 def codomain_assignment_code vector: (fail ArgumentError, "No vector!"), source: (fail ArgumentError, "No source array!") Matrix.column_vector_assignment_code( vector: vector, indices: free_codomain_indices, source: source ) end
Returns the indices of this transition's codomain in the marking vector.
# File lib/y_petri/simulation/transition_representation.rb, line 30 def codomain_indices codomain.map { |p| places.index p } end
Builds a code string for accessing the domain directly from a marking vector, given as argument.
# File lib/y_petri/simulation/transition_representation.rb, line 49 def domain_access_code( vector: :m_vector ) Matrix.column_vector_access_code( vector: vector, indices: domain_indices ) end
Returns the indices of this transition's domain in the marking vector.
# File lib/y_petri/simulation/transition_representation.rb, line 24 def domain_indices domain.map { |p| places.index p } end
Returns the indices of this transition's codomain among the free places.
# File lib/y_petri/simulation/transition_representation.rb, line 42 def free_codomain_indices codomain.map { |p| free_places.index p } end
Returns the indices of this transition's domain among the free places.
# File lib/y_petri/simulation/transition_representation.rb, line 36 def free_domain_indices domain.map { |p| free_places.index p } end
Builds a closure that increments a vector with this transition's codomain.
# File lib/y_petri/simulation/transition_representation.rb, line 65 def increment_by_codomain_code vector: (fail ArgumentError, "No vector!"), source: (fail ArgumentError, "No source array!") Matrix.column_vector_increment_by_array_code vector: vector, indices: free_codomain_indices, source: source end