Browse Source

Petset (#18)

* [WIP] implementation of whole-grained Petri nets (#12)

* implementation of whole-grained Petri nets

* ENH: Some cleanup of basic Petri net implementation

Co-authored-by: Owen Lynch <root@owenlynch.org>

* Updated reaction network definition

* Catch up petset to master (#16)

* Updated catlab interface (#14)

* Updated catlab interface

* patch version bump to fix broken catlab

* Don't dev catlab for docs

* Updated petri to fix graphing

* Update examples to match new interface

* Change test versions

* Added code coverage (#15)

* Added code coverage

* Fix documentation dependency incorrect resolution

* Use newest version of catlab

* Updated Catlab API

* Working on CSet implementation of Petri nets

* Added better constructor for building petri nets

* Updated to newer cset type definitions

* Improve interface to work with both Petri and ReactionNets

* Added labelled petri nets

* Added more nice constructors for building petri nets

* Finished constructors and cleaned up duplicate code a little

* Updated comment of example code

* Added interface for Petri.jl

* Added chime toy model

* Removed unnecessary comments

* Separated time span to variable for clearer definition

* Added JSON generation

* Added final json form and cleaned up

* Added executable CHIME model using CSet implementation as well as JSON generation with code

* Cleaned up code some more

* Final code clean up for this example

* Fix typo

* Added chime model folder

* Updated README

* Updated documentation for CHIME models

* Updated README

* Updated README

* Updated types with new patch in Catlab

* Update to catlab 0.8 and petri 1.2.1

* Added looser codecov rules

* Moved open petri nets to use the cset implementation

* Updated examples

* Updated chime-cset imports

* Updated examples

* Added more testing

* Fix julia v1.0 support

* Simplified each row iterator

* Fix dimensionality mismatch in rate_eq

* Added support for labelled petri net vector field generation

* Split out vectorfield generation using multiple dispatch

* Removed duplicate function

* Moved to LabelledArrays to fix diffeq bug with dictionaries

* Fix typo and update tests

* final push on petsets

* Fixed typo in epi:

Co-authored-by: olynch <oclynch888@gmail.com>
Co-authored-by: Owen Lynch <root@owenlynch.org>
pull/21/head
Micah Halter 2 years ago committed by GitHub
parent
commit
eaa7cb8cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Project.toml
  2. 1
      docs/Project.toml
  3. 1
      examples/covid/Project.toml
  4. 1
      examples/covid/chime/Project.toml
  5. 6
      examples/covid/chime/chime.jl
  6. 17
      examples/covid/epidemiology.jl

2
Project.toml

@ -2,7 +2,7 @@ name = "AlgebraicPetri"
uuid = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
license = "MIT"
authors = ["Micah Halter <micah@mehalter.com>"]
version = "0.3.2"
version = "0.4.0"
[deps]
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"

1
docs/Project.toml

@ -7,4 +7,3 @@ Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"

1
examples/covid/Project.toml

@ -6,4 +6,3 @@ LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"

1
examples/covid/chime/Project.toml

@ -5,4 +5,3 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"

6
examples/covid/chime/chime.jl

@ -2,7 +2,6 @@ using AlgebraicPetri
using AlgebraicPetri.Epidemiology
using Petri: Model, Graph
using OrdinaryDiffEq
using StochasticDiffEq
using Plots
using Catlab.Theories
using Catlab.CategoricalAlgebra.FreeDiagrams
@ -34,8 +33,3 @@ prob = ODEProblem(vectorfield(p_sir),u0,t_span,p)
sol = OrdinaryDiffEq.solve(prob,Tsit5())
plot(sol)
png("ode-chime.png")
prob,cb = SDEProblem(Model(p_sir),u0,t_span,p);
sol = solve(prob,SRA1(),callback=cb)
plot(sol)
png("sde-chime.png")

17
examples/covid/epidemiology.jl

@ -7,7 +7,6 @@ using AlgebraicPetri.Epidemiology
using Petri: Model, Graph
using OrdinaryDiffEq
using StochasticDiffEq
using Plots
using Catlab.Theories
@ -56,11 +55,11 @@ seir = sei ⋅ recovery
# here we convert the C-Set decoration to a Petri.jl model
# to use its StochasticDifferentialEquations support
p_seir = Model(decoration(F_epi(seir)));
p_seir = decoration(F_epi(seir));
display_wd(seir)
#-
Graph(p_seir)
Graph(Model(p_seir))
# define initial states and transition rates, then
# create, solve, and visualize ODE problem
@ -68,8 +67,8 @@ Graph(p_seir)
u0 = [10.0, 1, 0, 0];
p = [.9, .2, .5];
prob,cb = SDEProblem(p_seir,u0,(0.0,15.0),p);
sol = solve(prob,SRA1(),callback=cb)
prob = ODEProblem(vectorfield(p_seir),u0,(0.0,15.0),p);
sol = solve(prob,Tsit5())
plot(sol)
@ -81,11 +80,11 @@ seird = sei ⋅ Δ(I) ⋅ (death ⊗ recovery)
# get resulting petri net and visualize model
p_seird = Model(decoration(F_epi(seird)));
p_seird = decoration(F_epi(seird));
display_wd(seird)
#-
Graph(p_seird)
Graph(Model(p_seird))
# define initial states and transition rates, then
# create, solve, and visualize ODE problem
@ -93,7 +92,7 @@ Graph(p_seird)
u0 = [10.0, 1, 0, 0, 0];
p = [0.9, 0.2, 0.5, 0.1];
prob,cb = SDEProblem(p_seird,u0,(0.0,15.0),p);
sol = solve(prob,SRA1(),callback=cb)
prob = ODEProblem(vectorfield(p_seird),u0,(0.0,15.0),p);
sol = solve(prob,Tsit5())
plot(sol)

Loading…
Cancel
Save