Sha256: c18f1f1653a2401d4869ac003d5ed35cc783b0f1d3f2d20e5b27b74d688e3833
Contents?: true
Size: 1.19 KB
Versions: 17
Compression:
Stored size: 1.19 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 action closures. # def delta_closures map &:delta_closure end # Delta contribution to free places. # def delta delta_closure.call end # Delta contribution to all places # def Δ f2a * delta end alias delta_all Δ # 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. # 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 alias delta_closure to_delta_closure end end # class YPetri::Simulation::Transitions
Version data entries
17 entries across 17 versions & 1 rubygems