Module: YPetri::Simulation::Transitions::Type_ts

Includes:
Type_s, Type_t
Defined in:
lib/y_petri/simulation/transitions/ts.rb

Instance Method Summary collapse

Instance Method Details

#deltaObject

Delta contribution to free places.



18
19
20
# File 'lib/y_petri/simulation/transitions/ts.rb', line 18

def delta
  delta_closure.call
end

#delta_closuresObject

ts transitions have action closures.



12
13
14
# File 'lib/y_petri/simulation/transitions/ts.rb', line 12

def delta_closures
  map &:delta_closure
end

#to_delta_closureObject Also known as: delta_closure

Constructs a delta closure that outputs a delta vector corresponding to free places. The vector is the delta contribution of the transitions in this collection.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/y_petri/simulation/transitions/ts.rb', line 33

def to_delta_closure
  fp = free_places
  closures = delta_closures
  sMV = simulation.MarkingVector
  code_sections = map.with_index do |t, i|
    "a = closures[#{i}].call\n" +
      t.increment_by_codomain_code( vector: "delta", source: "a" )
  end
  body = code_sections.join( "\n" )
  λ = <<-LAMBDA
    -> do
    delta = sMV.zero( fp )
    #{body}
    return delta
    end
  LAMBDA
  eval λ
end

#ΔObject Also known as: delta_all

Delta contribution to all places



24
25
26
# File 'lib/y_petri/simulation/transitions/ts.rb', line 24

def Δ
  f2a * delta
end