Petrex.Transition (petrex v1.0.0)

Copy Markdown View Source

A transition of a Petri net.

guard and action are used only by the executor; analysis ignores both.

  • guard receives the tokens the transition would consume, as a map of input place to list of tokens, and returns a boolean. nil means always true.
  • action receives the same map and returns the tokens to produce, as a map of output place to list of tokens. nil means produce :token once per unit of arc weight in every output place.

Summary

Types

id()

@type id() :: atom() | String.t()

t()

@type t() :: %Petrex.Transition{
  action: (tokens_by_place() -> tokens_by_place()) | nil,
  extra: Petrex.Place.extra(),
  guard: (tokens_by_place() -> boolean()) | nil,
  id: id(),
  name: String.t() | nil
}

tokens_by_place()

@type tokens_by_place() :: %{required(Petrex.Place.id()) => [term()]}