Library Reference
AlgebraicPetri.AlgebraicPetri — ModuleComputing in the category of finite sets and Petri cospans
AlgebraicPetri.SchLabelledPetriNet — ConstantACSet definition for a Petri net with labels on transitions and states.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.SchLabelledReactionNet — ConstantACSet definition for a ReactionNet with labels on transitions and states.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.SchPetriNet — ConstantACSet definition for a Petri net.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.SchPropertyLabelledPetriNet — ConstantACSet definition for a LabelledPetriNet with properties on transitions and states.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.SchPropertyLabelledReactionNet — ConstantACSet definition for a LabelledReactionNet with properties on transitions and states.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.SchPropertyPetriNet — ConstantACSet definition for a PetriNet with properties on transitions and states.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.SchPropertyReactionNet — ConstantACSet definition for a ReactionNet with properties on transitions and states.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.SchReactionNet — ConstantACSet definition for a Petri net with rates on transitions and concentrations on states.
See Catlab.jl documentation for description of the @present syntax.
AlgebraicPetri.AbstractPetriNet — TypeAbstract type for C-sets that contain a petri net.
This type encompasses C-sets where the schema for graphs is a subcategory of C. This includes, for example, graphs, symmetric graphs, and reflexive graphs, but not half-edge graphs.
AlgebraicPetri.AbstractPropertyPetriNet — TypeAbstract Type for any PetriNet ACSet with properties.
AlgebraicPetri.LabelledPetriNet — MethodLabelledPetriNet(n, ts::Vararg{Union{Pair,Tuple}})
Constructs a LabelledPetriNet object with state names as elements of n and labelled transitions described by ts. Transitions are given as transition_name=>((input_states)=>(output_states)).
A LabelledPetriNet modelling the SIR model with 3 states and 2 transitions can be constructed as follows:
LabelledPetriNet([:S, :I, :R], :inf=>((:S,:I)=>(:I,:I)), :rec=>(:I=>:R))AlgebraicPetri.LabelledReactionNet — MethodLabelledReactionNet{R,C}(n, ts::Vararg{Union{Pair,Tuple}}) where {R,C}
Constructs a LabelledReactionNet object with labelled state concentrations as elements of n and labelled transitions described by ts. R is the data type used to store rates and C is the data type used to store concentrations.
Transitions are given as (t_name=>t_rate)=>((input_states)=>(output_states)).
A LabelledReactionNet modelling the SIR model with 3 states and 2 transitions, an initial population of 10 susceptible, 1 infected, 0 recovered and an infection rate of 0.5 and recovery rate of 0.1 can be constructed as follows:
LabelledReactionNet{Float64, Float64}([:S=>10,:I=>1,:R=>0], (:inf=>0.5)=>((:S,:I)=>(:I,:I)), (:rec=>0.1)=>(:I=>:R))AlgebraicPetri.ReactionNet — MethodReactionNet{R,C}(n, ts::Vararg{Union{Pair,Tuple}}) where {R,C}
Constructs a ReactionNet object with state concentrations as elements of n and transitions described by ts. R is the data type used to store rates and C is the data type used to store concentrations.
Transitions are given as transition_rate=>((input_states)=>(output_states)).
A ReactionNet modelling the SIR model with 3 states and 2 transitions, an initial population of 10 susceptible, 1 infected, 0 recovered and an infection rate of 0.5 and recovery rate of 0.1 can be constructed as follows:
ReactionNet{Float64, Float64}([10,1,0], 0.5=>((1,2)=>(2,2)), 0.1=>(2=>3))AlgebraicPetri.TransitionMatrices — TypeTransitionMatrices
This data structure stores the transition matrix of an AbstractPetriNet object. This is primarily used for constructing the vectorfield representation of the Petri net.
Core.Type — Method(::AbstractPetriNet)(pn::AbstractPetriNet)
Cast one type of AbstractPetriNet to another. Any unrepresented parts will be nothing.
pn = PetriNet(3, (1,2)=>(2,2), 2=>3)
labelled_pn = LabelledPetriNet(pn)Core.Type — Method(::AbstractPetriNet)(tm::TransitionMatrices)
Construct any AbstractPetriNet from a given transition matrice representation.
Core.Type — Method(::AbstractPropertyPetriNet)(pn::AbstractPetriNet, sprops, tprops)
Add properties to the states and transitions of a given Petri Net.
Core.Type — Method(::AbstractPetriNet)(n::Int, ts::Vararg{Union{Pair,Tuple}})
Constructs any AbstractPetriNet object with n states and transitions described by ts. Transitions are given as (input_states)=>(output_states).
A PetriNet modelling the SIR model with 3 states and 2 transitions can be constructed as follows:
PetriNet(3, (1,2)=>(2,2), 2=>3)AlgebraicPetri.Open — MethodOpen(p::AbstractPetriNet, legs...)
Generates on OpenPetriNet with legs bundled as described by legs
AlgebraicPetri.Open — MethodOpen(p::AbstractPetriNet)
Converts a PetriNet to an OpenPetriNet where each state is exposed as a leg of the cospan. The OpenPetriNet can be composed over an undirected wiring diagram (see this blog post for a description of this compositional tooling)
AlgebraicPetri.Open — MethodOpen(n, p::AbstractPetriNet, m)
Generates on OpenPetriNet with two legs, n and m
AlgebraicPetri.add_input! — Methodadd_input!(p::AbstractPetriNet,t,s;kw...)
Add an input relationship to the Petri net between the transition t and species s.
Returns the ID of the input relationship
AlgebraicPetri.add_inputs! — Methodadd_inputs!(p::AbstractPetriNet,n,t,s;kw...)
Add input relationships to the Petri net between the transitions t and species s.
Returns the ID of the input relationship
AlgebraicPetri.add_output! — Methodadd_output!(p::AbstractPetriNet,t,s;kw...)
Add an output relationship to the Petri net between the transition t and species s.
Returns the ID of the input relationship
AlgebraicPetri.add_outputs! — Methodadd_outputs!(p::AbstractPetriNet,n,t,s;kw...)
Add output relationships to the Petri net between the transitions t and species s.
Returns the ID of the input relationship
AlgebraicPetri.add_species! — MethodAdd n species to the Petri net. Label and concentration can be provided depending on the kind of Petri net.
Returns the ID of the species
AlgebraicPetri.add_species! — MethodAdd a species to the Petri net. Label and concentration can be provided depending on the kind of Petri net.
Returns the ID of the species
AlgebraicPetri.add_transition! — MethodAdd a transition to the Petri net. Label and rate can be provided depending on the kind of Petri net.
Returns the ID of the transition
AlgebraicPetri.add_transitions! — MethodAdd n transitions to the Petri net. Label and rate can be provided depending on the kind of Petri net.
Returns the ID of the transition
AlgebraicPetri.concentration — MethodConcentration of a ReactionNet
AlgebraicPetri.concentrations — MethodAll concentrations of a ReactionNet
AlgebraicPetri.flatten_labels — Methodflatten_labels(pn::AbstractPetriNet)
Takes a labelled Petri net or reaction net and flattens arbitrarily nested labels on the species and the transitions to a single symbol who's previously nested parts are separated by _.
AlgebraicPetri.inputs — MethodInput relationships for a transition
AlgebraicPetri.ni — MethodNumber of input relationships in a Petri net
AlgebraicPetri.no — MethodNumber of output relationships in a Petri net
AlgebraicPetri.ns — MethodNumber of states in a Petri net
AlgebraicPetri.nt — MethodNumber of transitions in a Petri net
AlgebraicPetri.outputs — MethodOutput relationships for a transition
AlgebraicPetri.rate — MethodRate of a ReactionNet
AlgebraicPetri.rates — MethodAll rates of a ReactionNet
AlgebraicPetri.sname — MethodName of species
Note that this returns an index if labels are not present in the PetriNet
AlgebraicPetri.snames — MethodNames of species in a Petri net
Note that this returns indices if labels are not present in the PetriNet
AlgebraicPetri.sprop — MethodProperty of species
AlgebraicPetri.sprops — MethodProperties of all species
AlgebraicPetri.tname — MethodName of transition
Note that this returns an index if labels are not present in the PetriNet
AlgebraicPetri.tnames — MethodNames of transitions in a Petri net
Note that this returns indices if labels are not present in the PetriNet
AlgebraicPetri.tprop — MethodProperty of transition
AlgebraicPetri.tprops — MethodProperties of all transitions
AlgebraicPetri.vectorfield — Methodvectorfield(pn::AbstractPetriNet)
Generates a Julia function which calculates the vectorfield of the Petri net being simulated under the law of mass action.
The resulting function has a signature of the form f!(du, u, p, t) and can be passed to the DifferentialEquations.jl solver package.
AlgebraicPetri.vectorfield_expr — Methodvectorfield_expr(pn::AbstractPetriNet)
Generates a Julia expression which is then evaluated that calculates the vectorfield of the Petri net being simulated under the law of mass action.
The resulting function has a signature of the form f!(du, u, p, t) and can be passed to the DifferentialEquations.jl solver package.
AlgebraicPetri.Epidemiology — ModuleSpecific generators and useful tools for constructing epidemiological systems
AlgebraicPetri.Epidemiology.death — ConstantLabelledPetriNet which describes the death process which moves tokens from I to D
AlgebraicPetri.Epidemiology.exposure — ConstantLabelledPetriNet which describes the exposure process where tokens in I "expose" tokens in S, changing them from S to E
AlgebraicPetri.Epidemiology.illness — ConstantLabelledPetriNet which describes the illness process which moves tokens from E to I.
AlgebraicPetri.Epidemiology.infection — ConstantLabelledPetriNet which describes the infection process of tokens in state S by tokens in state I
AlgebraicPetri.Epidemiology.recovery — ConstantLabelledPetriNet which describes the recovery process which moves tokens from I to R
AlgebraicPetri.Epidemiology.oapply_epi — Methodoapply_epi(ex, args...)
Generates a LabelledPetriNet under a composition pattern described by the undirected wiring diagram ex. This requires that the nodes in ex are only labelled with labels from the following set:
[:infection, :exposure, :illness, :recovery, :death]AlgebraicPetri.OpenTransitions.OpenT — MethodOpenT(p::AbstractPetriNet, legs...)
Generates on OpenPetriNetT with legs bundled as described by legs
AlgebraicPetri.OpenTransitions.OpenT — MethodOpenT(p::AbstractPetriNet)
Converts a PetriNet to an OpenPetriNetT where each transition is exposed as a leg of the cospan. The OpenPetriNetT can be composed over an undirected wiring diagram.
AlgebraicPetri.OpenTransitions.OpenT — MethodOpenT(n, p::AbstractPetriNet, m)
Generates on OpenPetriNetT with two legs, n and m