Browse Source

Full C-Set implementation (#17)

* [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

Co-authored-by: olynch <oclynch888@gmail.com>
Co-authored-by: Owen Lynch <root@owenlynch.org>
pull/21/head
Micah Halter 1 year ago
committed by GitHub
parent
commit
ffbfec8891
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Project.toml
  2. 13
      codecov.yml
  3. 1
      docs/Project.toml
  4. 2
      examples/covid/Project.toml
  5. 4
      examples/covid/_generate_figs.jl
  6. 922
      examples/covid/chime/Manifest.toml
  7. 8
      examples/covid/chime/Project.toml
  8. 54
      examples/covid/chime/README.md
  9. 38
      examples/covid/chime/chime-cset.jl
  10. 41
      examples/covid/chime/chime.jl
  11. 27
      examples/covid/chime/chime.json
  12. BIN
      examples/covid/chime/cset-json-schema.pdf
  13. 89
      examples/covid/chime/cset-json-schema.rmd
  14. BIN
      examples/covid/chime/ode-chime.png
  15. BIN
      examples/covid/chime/sde-chime.png
  16. BIN
      examples/covid/chime/sir.png
  17. 14
      examples/covid/covid.jl
  18. 32
      examples/covid/epidemiology.jl
  19. 36
      examples/predation/lotka-volterra.jl
  20. 74
      src/AlgebraicPetri.jl
  21. 13
      src/Epidemiology.jl
  22. 264
      src/Types.jl
  23. 7
      test/core.jl
  24. 5
      test/epidemiology.jl
  25. 6
      test/petri.jl
  26. 12
      test/runtests.jl
  27. 34
      test/types.jl

4
Project.toml

@ -7,11 +7,13 @@ version = "0.3.2"
[deps]
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"
[compat]
AutoHashEquals = "^0.2.0"
Catlab = "0.7.4"
Catlab = "^0.8"
Petri = "^1.1.0"
julia = "1.0"

13
codecov.yml

@ -0,0 +1,13 @@
comment: false
coverage:
precision: 2
status:
patch:
default:
target: 0%
threshold: 100%
project:
default:
target: 0%
threshold: 100%

1
docs/Project.toml

@ -2,6 +2,7 @@
AlgebraicPetri = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"

2
examples/covid/Project.toml

@ -1,6 +1,8 @@
[deps]
AlgebraicPetri = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Petri = "4259d249-1051-49fa-8328-3f8ab9391c33"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

4
examples/covid/_generate_figs.jl

@ -78,13 +78,13 @@ splot(sol, "seird_soln.svg")
include("covid.jl")
[save_graph(Graph(decoration(p)), pname) for (p,pname) in [(spontaneous_petri, "spont.svg"),
[save_graph(Graph(Petri.Model(decoration(p))), pname) for (p,pname) in [(spontaneous_petri, "spont.svg"),
(transmission_petri, "transmission.svg"),
(exposure_petri, "exposure.svg"),
(travel_petri, "travel.svg")]]
save_wd(seird_city, "seird_city.svg")
save_graph(Graph(decoration(F(seird_city))), "seird_graph.svg")
save_graph(Graph(Petri.Model(decoration(F(seird_city)))), "seird_graph.svg")
save_wd(seird_3, "seird_3.svg")
save_graph(Graph(p_seird_3), "seird_3_graph.svg")

922
examples/covid/chime/Manifest.toml

@ -0,0 +1,922 @@
# This file is machine-generated - editing it directly is not advised
[[AbstractTrees]]
deps = ["Markdown"]
git-tree-sha1 = "33e450545eaf7699da1a6e755f9ea65f14077a45"
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
version = "0.3.3"
[[Adapt]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "95f8bda0555209f122bc796b0382ea4a3a121720"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "2.1.0"
[[AlgebraicPetri]]
deps = ["AutoHashEquals", "Catlab", "LabelledArrays", "LinearAlgebra", "Petri"]
path = "../../.."
uuid = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
version = "0.3.2"
[[ArnoldiMethod]]
deps = ["DelimitedFiles", "LinearAlgebra", "Random", "SparseArrays", "StaticArrays", "Test"]
git-tree-sha1 = "2b6845cea546604fb4dca4e31414a6a59d39ddcd"
uuid = "ec485272-7323-5ecc-a04f-4719b315124d"
version = "0.0.4"
[[ArrayInterface]]
deps = ["LinearAlgebra", "Requires", "SparseArrays"]
git-tree-sha1 = "a2b4a1b7c725297565105f98dcee04e362d955d6"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "2.12.0"
[[AutoHashEquals]]
git-tree-sha1 = "45bb6705d93be619b81451bb2006b7ee5d4e4453"
uuid = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
version = "0.2.0"
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[Bzip2_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "03a44490020826950c68005cafb336e5ba08b7e8"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.6+4"
[[CanonicalTraits]]
deps = ["MLStyle"]
git-tree-sha1 = "e4581e3fadda3824e0df04396c85258a2107035d"
uuid = "a603d957-0e48-4f86-8fbd-0b7bc66df689"
version = "0.2.2"
[[Catlab]]
deps = ["AutoHashEquals", "Compat", "Compose", "DataStructures", "FunctionWrappers", "GeneralizedGenerated", "JSON", "LightGraphs", "LightXML", "LinearAlgebra", "Logging", "MLStyle", "MetaGraphs", "Parameters", "Pkg", "Random", "Reexport", "Requires", "SparseArrays", "StaticArrays", "Statistics", "StructArrays"]
git-tree-sha1 = "9f7375342edcfb0f8719eaa91f268e453a45b70c"
uuid = "134e5e36-593f-5add-ad60-77f754baafbe"
version = "0.8.0"
[[ChainRulesCore]]
deps = ["LinearAlgebra", "MuladdMacro"]
git-tree-sha1 = "ac64a416997ae87eb86550020d0607ff608253d1"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "0.9.10"
[[CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "ded953804d019afa9a3f98981d99b33e3db7b6da"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.0"
[[ColorSchemes]]
deps = ["ColorTypes", "Colors", "FixedPointNumbers", "Random", "StaticArrays"]
git-tree-sha1 = "7a15e3690529fd1042f0ab954dff7445b1efc8a5"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.9.0"
[[ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "4bffea7ed1a9f0f3d1a131bbcd4b925548d75288"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.10.9"
[[Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Reexport"]
git-tree-sha1 = "008d6bc68dea6beb6303fdc37188cb557391ebf2"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.12.4"
[[CommonSubexpressions]]
deps = ["MacroTools", "Test"]
git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
version = "0.3.0"
[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "7c7f4cda0d58ec999189d70f5ee500348c4b4df1"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.16.0"
[[CompilerSupportLibraries_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "7c4f882c41faa72118841185afc58a2eb00ef612"
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "0.3.3+0"
[[Compose]]
deps = ["Base64", "Colors", "DataStructures", "Dates", "IterTools", "JSON", "LinearAlgebra", "Measures", "Printf", "Random", "Requires", "Statistics", "UUIDs"]
git-tree-sha1 = "a2b4df8e2dc688f2d63b5cfcc00c773218fa9e7f"
uuid = "a81c6b42-2e10-5240-aca2-a61377ecd94b"
version = "0.9.1"
[[ConsoleProgressMonitor]]
deps = ["Logging", "ProgressMeter"]
git-tree-sha1 = "3ab7b2136722890b9af903859afcf457fa3059e8"
uuid = "88cd18e8-d9cc-4ea6-8889-5259c0d15c8b"
version = "0.1.2"
[[Contour]]
deps = ["StaticArrays"]
git-tree-sha1 = "d05a3a25b762720d40246d5bedf518c9c2614ef5"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.5.5"
[[CpuId]]
deps = ["Markdown", "Test"]
git-tree-sha1 = "f0464e499ab9973b43c20f8216d088b61fda80c6"
uuid = "adafc99b-e345-5852-983c-f28acb93d879"
version = "0.2.2"
[[DataAPI]]
git-tree-sha1 = "176e23402d80e7743fc26c19c681bfb11246af32"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.3.0"
[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "88d48e133e6d3dd68183309877eac74393daa7eb"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.17.20"
[[DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"
[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
[[DiffEqBase]]
deps = ["ArrayInterface", "ChainRulesCore", "ConsoleProgressMonitor", "DataStructures", "Distributed", "DocStringExtensions", "FunctionWrappers", "IterativeSolvers", "IteratorInterfaceExtensions", "LabelledArrays", "LinearAlgebra", "Logging", "LoggingExtras", "MuladdMacro", "Parameters", "Printf", "ProgressLogging", "RecipesBase", "RecursiveArrayTools", "RecursiveFactorization", "Requires", "Roots", "SparseArrays", "StaticArrays", "Statistics", "SuiteSparse", "TableTraits", "TerminalLoggers", "TreeViews", "ZygoteRules"]
git-tree-sha1 = "4dde9a142bc3780f0216e564673f477ec6f6a6df"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
version = "6.44.3"
[[DiffEqCallbacks]]
deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "LinearAlgebra", "NLsolve", "OrdinaryDiffEq", "RecipesBase", "RecursiveArrayTools", "StaticArrays"]
git-tree-sha1 = "63afe1bc146559c7329b6429713916c7f9e61d2f"
uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def"
version = "2.13.5"
[[DiffEqJump]]
deps = ["ArrayInterface", "Compat", "DataStructures", "DiffEqBase", "FunctionWrappers", "LinearAlgebra", "PoissonRandom", "Random", "RandomNumbers", "RecursiveArrayTools", "StaticArrays", "TreeViews", "UnPack"]
git-tree-sha1 = "97c44c5f94827bb4605e4c72b652629a9d6d10d4"
uuid = "c894b116-72e5-5b58-be3c-e6d8d4ac2b12"
version = "6.10.0"
[[DiffEqNoiseProcess]]
deps = ["DiffEqBase", "Distributions", "LinearAlgebra", "PoissonRandom", "Random", "RandomNumbers", "RecipesBase", "RecursiveArrayTools", "Requires", "ResettableStacks", "StaticArrays", "Statistics"]
git-tree-sha1 = "5f8ba8bbdc8a4d6f2504c9cf34ba42a0274b7e97"
uuid = "77a26b50-5914-5dd7-bc55-306e6241c503"
version = "5.3.0"
[[DiffResults]]
deps = ["StaticArrays"]
git-tree-sha1 = "da24935df8e0c6cf28de340b958f6aac88eaa0cc"
uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
version = "1.0.2"
[[DiffRules]]
deps = ["NaNMath", "Random", "SpecialFunctions"]
git-tree-sha1 = "eb0c34204c8410888844ada5359ac8b96292cfd1"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.0.1"
[[Distances]]
deps = ["LinearAlgebra", "Statistics"]
git-tree-sha1 = "bed62cc5afcff16de797a9f38fb358b74071f785"
uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
version = "0.9.0"
[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[Distributions]]
deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns"]
git-tree-sha1 = "9c41285c57c6e0d73a21ed4b65f6eec34805f937"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.23.8"
[[DocStringExtensions]]
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
git-tree-sha1 = "50ddf44c53698f5e784bbebb3f4b21c5807401b1"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.3"
[[EarCut_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "eabac56550a7d7e0be499125673fbff560eb8b20"
uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"
version = "2.1.5+0"
[[ExponentialUtilities]]
deps = ["LinearAlgebra", "Printf", "Requires", "SparseArrays"]
git-tree-sha1 = "4e7db935d55d4a11acb74856ee6cb113a7808c6f"
uuid = "d4d017d3-3776-5f7e-afef-a10c40355c18"
version = "1.8.0"
[[FFMPEG]]
deps = ["FFMPEG_jll", "x264_jll"]
git-tree-sha1 = "9a73ffdc375be61b0e4516d83d880b265366fe1f"
uuid = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
version = "0.4.0"
[[FFMPEG_jll]]
deps = ["Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "LAME_jll", "LibVPX_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "Pkg", "Zlib_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"]
git-tree-sha1 = "13a934b9e74a8722bf1786c989de346a9602e695"
uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5"
version = "4.3.1+2"
[[FastClosures]]
git-tree-sha1 = "acebe244d53ee1b461970f8910c235b259e772ef"
uuid = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
version = "0.3.2"
[[FileIO]]
deps = ["Pkg"]
git-tree-sha1 = "992b4aeb62f99b69fcf0cb2085094494cc05dfb3"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.4.3"
[[FillArrays]]
deps = ["LinearAlgebra", "Random", "SparseArrays"]
git-tree-sha1 = "4863cbb7910079369e258dee4add9d06ead5063a"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.8.14"
[[FiniteDiff]]
deps = ["ArrayInterface", "LinearAlgebra", "Requires", "SparseArrays", "StaticArrays"]
git-tree-sha1 = "a78ee56e4636c20c2db9ccde8afe57065f6ab387"
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
version = "2.7.0"
[[FixedPointNumbers]]
deps = ["Statistics"]
git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.4"
[[ForwardDiff]]
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "NaNMath", "Random", "SpecialFunctions", "StaticArrays"]
git-tree-sha1 = "1d090099fb82223abc48f7ce176d3f7696ede36d"
uuid = "f6369f11-7733-5829-9624-2563aa707210"
version = "0.10.12"
[[FreeType2_jll]]
deps = ["Bzip2_jll", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "720eee04e3b496c15e5e2269669c2532fb5005c0"
uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7"
version = "2.10.1+4"
[[FriBidi_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "cfc3485a0a968263c789e314fca5d66daf75ed6c"
uuid = "559328eb-81f9-559d-9380-de523a88c83c"
version = "1.0.5+5"
[[FunctionWrappers]]
git-tree-sha1 = "e4813d187be8c7b993cb7f85cbf2b7bfbaadc694"
uuid = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
version = "1.1.1"
[[GR]]
deps = ["Base64", "DelimitedFiles", "HTTP", "JSON", "LinearAlgebra", "Printf", "Random", "Serialization", "Sockets", "Test", "UUIDs"]
git-tree-sha1 = "cd0f34bd097d4d5eb6bbe01778cf8a7ed35f29d9"
uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
version = "0.52.0"
[[GeneralizedGenerated]]
deps = ["CanonicalTraits", "DataStructures", "JuliaVariables", "MLStyle"]
git-tree-sha1 = "50e0ed8fbcd56ae2e65b9aa73394f20b30269b2d"
uuid = "6b9d7cbe-bcb9-11e9-073f-15a7a543e2eb"
version = "0.2.7"
[[GenericSVD]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "62909c3eda8a25b5673a367d1ad2392ebb265211"
uuid = "01680d73-4ee2-5a08-a1aa-533608c188bb"
version = "0.3.0"
[[GeometryBasics]]
deps = ["EarCut_jll", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"]
git-tree-sha1 = "49d13ebd048bd71315ff98bdc2c560ec16eda2b4"
uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
version = "0.3.1"
[[GeometryTypes]]
deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "StaticArrays"]
git-tree-sha1 = "34bfa994967e893ab2f17b864eec221b3521ba4d"
uuid = "4d00f742-c7ba-57c2-abde-4428a4b178cb"
version = "0.8.3"
[[HTTP]]
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"]
git-tree-sha1 = "c7ec02c4c6a039a98a15f955462cd7aea5df4508"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "0.8.19"
[[Inflate]]
git-tree-sha1 = "f5fc07d4e706b84f72d54eedcc1c13d92fb0871c"
uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9"
version = "0.1.2"
[[IniFile]]
deps = ["Test"]
git-tree-sha1 = "098e4d2c533924c921f9f9847274f2ad89e018b8"
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
version = "0.5.0"
[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[IterTools]]
git-tree-sha1 = "05110a2ab1fc5f932622ffea2a003221f4782c18"
uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
version = "1.3.0"
[[IterativeSolvers]]
deps = ["LinearAlgebra", "Printf", "Random", "RecipesBase", "SparseArrays"]
git-tree-sha1 = "3b7e2aac8c94444947facea7cc7ca91c49169be0"
uuid = "42fd0dbc-a981-5370-80f2-aaf504508153"
version = "0.8.4"
[[IteratorInterfaceExtensions]]
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"
[[JLD2]]
deps = ["CodecZlib", "DataStructures", "FileIO", "Mmap", "Pkg", "Printf", "UUIDs"]
git-tree-sha1 = "9353b717ee4e27beab4e902c92a06bb5f160d2cf"
uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
version = "0.1.14"
[[JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "81690084b6198a2e1da36fcfda16eeca9f9f24e4"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.1"
[[JuliaVariables]]
deps = ["MLStyle", "NameResolution"]
git-tree-sha1 = "e0fcfa0a2f6122fbe13603764c5310dde00c5593"
uuid = "b14d175d-62b4-44ba-8fb7-3064adc8c3ec"
version = "0.2.3"
[[LAME_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "a7999edc634307964d5651265ebf7c2e14b4ef91"
uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d"
version = "3.100.0+2"
[[LabelledArrays]]
deps = ["ArrayInterface", "LinearAlgebra", "MacroTools", "StaticArrays"]
git-tree-sha1 = "5e04374019448f8509349948ab504f117e3b575a"
uuid = "2ee39098-c373-598a-b85f-a56591580800"
version = "1.3.0"
[[LeftChildRightSiblingTrees]]
deps = ["AbstractTrees"]
git-tree-sha1 = "71be1eb5ad19cb4f61fa8c73395c0338fd092ae0"
uuid = "1d6d02ad-be62-4b6b-8a6d-2f90e265016e"
version = "0.1.2"
[[LibGit2]]
deps = ["Printf"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[LibVPX_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "e02378f5707d0f94af22b99e4aba798e20368f6e"
uuid = "dd192d2f-8180-539f-9fb4-cc70b1dcf69a"
version = "1.9.0+0"
[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[Libiconv_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "7c36dfe7971e55da03d8f54b67d4b3fb8ee01d63"
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
version = "1.16.0+6"
[[LightGraphs]]
deps = ["ArnoldiMethod", "DataStructures", "Distributed", "Inflate", "LinearAlgebra", "Random", "SharedArrays", "SimpleTraits", "SparseArrays", "Statistics"]
git-tree-sha1 = "6f85a35d2377cb2db1bc448ed0d6340d2bb1ea64"
uuid = "093fc24a-ae57-5d10-9952-331d41423f4d"
version = "1.3.3"
[[LightXML]]
deps = ["Libdl", "XML2_jll"]
git-tree-sha1 = "e129d9391168c677cd4800f5c0abb1ed8cb3794f"
uuid = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
version = "0.9.0"
[[LineSearches]]
deps = ["LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "Printf"]
git-tree-sha1 = "d6e6b2ed397a402a22e474a3f1859c8c1db82c8c"
uuid = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
version = "7.1.0"
[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[LoggingExtras]]
deps = ["Dates"]
git-tree-sha1 = "03289aba73c0abc25ff0229bed60f2a4129cd15c"
uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36"
version = "0.4.2"
[[LoopVectorization]]
deps = ["DocStringExtensions", "LinearAlgebra", "OffsetArrays", "SIMDPirates", "SLEEFPirates", "UnPack", "VectorizationBase"]
git-tree-sha1 = "3242a8f411e19eda9adc49d0b877681975c11375"
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
version = "0.8.26"
[[MLStyle]]
git-tree-sha1 = "937eda9ce36fcce082a42edd7181c8d23f4eb550"
uuid = "d8e11817-5142-5d16-987a-aa16d5891078"
version = "0.4.6"
[[MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "f7d2e3f654af75f01ec49be82c231c382214223a"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.5"
[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"]
git-tree-sha1 = "426a6978b03a97ceb7ead77775a1da066343ec6e"
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
version = "1.0.2"
[[MbedTLS_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "c0b1286883cac4e2b617539de41111e0776d02e8"
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.16.8+0"
[[Measures]]
git-tree-sha1 = "e498ddeee6f9fdb4551ce855a46f54dbd900245f"
uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
version = "0.3.1"
[[MetaGraphs]]
deps = ["JLD2", "LightGraphs", "Random"]
git-tree-sha1 = "8900d368fa44bd61c7e598d6a0f577e347f3cf67"
uuid = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
version = "0.6.5"
[[Missings]]
deps = ["DataAPI"]
git-tree-sha1 = "ed61674a0864832495ffe0a7e889c0da76b0f4c8"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "0.4.4"
[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[MuladdMacro]]
git-tree-sha1 = "c6190f9a7fc5d9d5915ab29f2134421b12d24a68"
uuid = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
version = "0.2.2"
[[NLSolversBase]]
deps = ["DiffResults", "Distributed", "FiniteDiff", "ForwardDiff"]
git-tree-sha1 = "db63edd0199a4813a1fa117e3c840a4528b59d72"
uuid = "d41bc354-129a-5804-8e4c-c37616107c6c"
version = "7.7.0"
[[NLsolve]]
deps = ["Distances", "LineSearches", "LinearAlgebra", "NLSolversBase", "Printf", "Reexport"]
git-tree-sha1 = "650f266dcb5a24b4095fdab92f0137c0f4ee9392"
uuid = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
version = "4.4.1"
[[NaNMath]]
git-tree-sha1 = "c84c576296d0e2fbb3fc134d3e09086b3ea617cd"
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "0.3.4"
[[NameResolution]]
deps = ["PrettyPrint"]
git-tree-sha1 = "1a0fa0e9613f46c9b8c11eee38ebb4f590013c5e"
uuid = "71a1bf82-56d0-4bbc-8a3c-48b961074391"
version = "0.1.5"
[[OffsetArrays]]
git-tree-sha1 = "663d3402efa943c95f4736fa7b462e9dd97be1a9"
uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
version = "1.2.0"
[[Ogg_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "4c3275cda1ba99d1244d0b82a9d0ca871c3cf66b"
uuid = "e7412a2a-1a6e-54c0-be00-318e2571c051"
version = "1.3.4+1"
[[OpenSSL_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "997359379418d233767f926ea0c43f0e731735c0"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "1.1.1+5"
[[OpenSpecFun_jll]]
deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"]
git-tree-sha1 = "d51c416559217d974a1113522d5919235ae67a87"
uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
version = "0.5.3+3"
[[Opus_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "cc90a125aa70dbb069adbda2b913b02cf2c5f6fe"
uuid = "91d4177d-7536-5919-b921-800302f37372"
version = "1.3.1+2"
[[OrderedCollections]]
git-tree-sha1 = "16c08bf5dba06609fe45e30860092d6fa41fde7b"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.3.1"
[[OrdinaryDiffEq]]
deps = ["Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "ExponentialUtilities", "FastClosures", "FiniteDiff", "ForwardDiff", "GenericSVD", "LinearAlgebra", "Logging", "MacroTools", "MuladdMacro", "NLsolve", "RecursiveArrayTools", "Reexport", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"]
git-tree-sha1 = "e6806009a3a5e74c5a6d44365c15b967daa7f798"
uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
version = "5.42.3"
[[PDMats]]
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse", "Test"]
git-tree-sha1 = "b3405086eb6a974eba1958923d46bc0e1c2d2d63"
uuid = "90014a1f-27ba-587c-ab20-58faa44d9150"
version = "0.10.0"
[[Parameters]]
deps = ["OrderedCollections", "UnPack"]
git-tree-sha1 = "38b2e970043613c187bd56a995fe2e551821eb4a"
uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a"
version = "0.12.1"
[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "8077624b3c450b15c087944363606a6ba12f925e"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "1.0.10"
[[Petri]]
deps = ["AutoHashEquals", "Catlab", "DiffEqBase", "DiffEqJump", "OrdinaryDiffEq", "SparseArrays", "SteadyStateDiffEq", "StochasticDiffEq"]
git-tree-sha1 = "39ef72184e048c853162d4086ae2ddcc0cc6046f"
uuid = "4259d249-1051-49fa-8328-3f8ab9391c33"
version = "1.2.2"
[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
[[PlotThemes]]
deps = ["PlotUtils", "Requires", "Statistics"]
git-tree-sha1 = "c6f5ea535551b3b16835134697f0c65d06c94b91"
uuid = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
version = "2.0.0"
[[PlotUtils]]
deps = ["ColorSchemes", "Colors", "Dates", "Printf", "Random", "Reexport", "Statistics"]
git-tree-sha1 = "8d23333aee2e2733a5cd4e1985462df8203f47f7"
uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
version = "1.0.6"
[[Plots]]
deps = ["Base64", "Contour", "Dates", "FFMPEG", "FixedPointNumbers", "GR", "GeometryBasics", "GeometryTypes", "JSON", "LinearAlgebra", "Measures", "NaNMath", "PlotThemes", "PlotUtils", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "Requires", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs"]
git-tree-sha1 = "392a4007f3584cbf98c89273d2453f9441ead3d4"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
version = "1.6.4"
[[PoissonRandom]]
deps = ["Random", "Statistics", "Test"]
git-tree-sha1 = "44d018211a56626288b5d3f8c6497d28c26dc850"
uuid = "e409e4f3-bfea-5376-8464-e040bb5c01ab"
version = "0.4.0"
[[PrettyPrint]]
git-tree-sha1 = "632eb4abab3449ab30c5e1afaa874f0b98b586e4"
uuid = "8162dcfd-2161-5ef2-ae6c-7681170c5f98"
version = "0.2.0"
[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[ProgressLogging]]
deps = ["Logging", "SHA", "UUIDs"]
git-tree-sha1 = "59398022b661b6fd569f25de6b18fde39843196a"
uuid = "33c8b6b6-d38a-422a-b730-caa89a2f386c"
version = "0.1.3"
[[ProgressMeter]]
deps = ["Distributed", "Printf"]
git-tree-sha1 = "ddfd3ab9d50916fa39c4167c0324f56163482d6a"
uuid = "92933f4c-e287-5a05-a399-4b506db050ca"
version = "1.3.3"
[[QuadGK]]
deps = ["DataStructures", "LinearAlgebra"]
git-tree-sha1 = "12fbe86da16df6679be7521dfb39fbc861e1dc7b"
uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
version = "2.4.1"
[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[RandomNumbers]]
deps = ["Random", "Requires"]
git-tree-sha1 = "441e6fc35597524ada7f85e13df1f4e10137d16f"
uuid = "e6cf234a-135c-5ec9-84dd-332b85af5143"
version = "1.4.0"
[[RecipesBase]]
git-tree-sha1 = "6ee6c35fe69e79e17c455a386c1ccdc66d9f7da4"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.1.0"
[[RecipesPipeline]]
deps = ["Dates", "NaNMath", "PlotUtils", "RecipesBase"]
git-tree-sha1 = "4a325c9bcc2d8e62a8f975b9666d0251d53b63b9"
uuid = "01d81517-befc-4cb6-b9ec-a95719d0359c"
version = "0.1.13"
[[RecursiveArrayTools]]
deps = ["ArrayInterface", "LinearAlgebra", "RecipesBase", "Requires", "StaticArrays", "Statistics", "ZygoteRules"]
git-tree-sha1 = "47e117a002fc1dbbe905557b333a84126c93671c"
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
version = "2.7.0"
[[RecursiveFactorization]]
deps = ["LinearAlgebra", "LoopVectorization", "VectorizationBase"]
git-tree-sha1 = "4ca0bdad1d69abbd59c35af89a9a2ab6cd5ef0f1"
uuid = "f2c3362d-daeb-58d1-803e-2bc74f2840b4"
version = "0.1.4"
[[Reexport]]
deps = ["Pkg"]
git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "0.2.0"
[[Requires]]
deps = ["UUIDs"]
git-tree-sha1 = "8c08d0c7812169e438a8478dae2a529377ad13f7"
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
version = "1.0.2"
[[ResettableStacks]]
deps = ["StaticArrays"]
git-tree-sha1 = "d19e9c93de6020a96dbb2820567c78d0ab8f7248"
uuid = "ae5879a3-cd67-5da8-be7f-38c6eb64a37b"
version = "1.0.0"
[[Rmath]]
deps = ["Random", "Rmath_jll"]
git-tree-sha1 = "86c5647b565873641538d8f812c04e4c9dbeb370"
uuid = "79098fc4-a85e-5d69-aa6a-4863f24498fa"
version = "0.6.1"
[[Rmath_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "d76185aa1f421306dec73c057aa384bad74188f0"
uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f"
version = "0.2.2+1"
[[Roots]]
deps = ["Printf"]
git-tree-sha1 = "1211c7c1928c1ed29cdcef65979b7a791e3b9fbe"
uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
version = "1.0.5"
[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
[[SIMDPirates]]
deps = ["VectorizationBase"]
git-tree-sha1 = "450d163d3279a1d35e3aad3352a5167ef21b84a4"
uuid = "21efa798-c60a-11e8-04d3-e1a92915a26a"
version = "0.8.25"
[[SLEEFPirates]]
deps = ["Libdl", "SIMDPirates", "VectorizationBase"]
git-tree-sha1 = "67ae90a18aa8c22bf159318300e765fbd89ddf6e"
uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa"
version = "0.5.5"
[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
[[Showoff]]
deps = ["Dates"]
git-tree-sha1 = "e032c9df551fb23c9f98ae1064de074111b7bc39"
uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f"
version = "0.3.1"
[[SimpleTraits]]
deps = ["InteractiveUtils", "MacroTools"]
git-tree-sha1 = "daf7aec3fe3acb2131388f93a4c409b8c7f62226"
uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
version = "0.9.3"
[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[SortingAlgorithms]]
deps = ["DataStructures", "Random", "Test"]
git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "0.3.1"
[[SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[SparseDiffTools]]
deps = ["Adapt", "ArrayInterface", "Compat", "DataStructures", "FiniteDiff", "ForwardDiff", "LightGraphs", "LinearAlgebra", "Requires", "SparseArrays", "VertexSafeGraphs"]
git-tree-sha1 = "69de355cb5e2b9a0e89f383c1762bba5ae70b580"
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
version = "1.10.0"
[[SpecialFunctions]]
deps = ["OpenSpecFun_jll"]
git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "0.10.3"
[[StaticArrays]]
deps = ["LinearAlgebra", "Random", "Statistics"]
git-tree-sha1 = "016d1e1a00fabc556473b07161da3d39726ded35"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "0.12.4"
[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[StatsBase]]
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"]
git-tree-sha1 = "d72a47c47c522e283db774fc8c459dd5ed773710"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.33.1"
[[StatsFuns]]
deps = ["Rmath", "SpecialFunctions"]
git-tree-sha1 = "04a5a8e6ab87966b43f247920eab053fd5fdc925"
uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
version = "0.9.5"
[[SteadyStateDiffEq]]
deps = ["DiffEqBase", "DiffEqCallbacks", "LinearAlgebra", "NLsolve", "Reexport"]
git-tree-sha1 = "75f258513b7ef8b235876f4cf146577ffd545094"
uuid = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
version = "1.5.1"
[[StochasticDiffEq]]
deps = ["ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqJump", "DiffEqNoiseProcess", "FillArrays", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEq", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"]
git-tree-sha1 = "ea25d14313775646f9aa4b2158156fb1b3815001"
uuid = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
version = "6.25.0"
[[StructArrays]]
deps = ["Adapt", "DataAPI", "Tables"]
git-tree-sha1 = "8099ed9fb90b6e754d6ba8c6ed8670f010eadca0"
uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
version = "0.4.4"
[[SuiteSparse]]
deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"]
uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
[[TableTraits]]
deps = ["IteratorInterfaceExtensions"]
git-tree-sha1 = "b1ad568ba658d8cbb3b892ed5380a6f3e781a81e"
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.0"
[[Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"]
git-tree-sha1 = "b7f762e9820b7fab47544c36f26f54ac59cf8abf"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.0.5"
[[TerminalLoggers]]
deps = ["LeftChildRightSiblingTrees", "Logging", "Markdown", "Printf", "ProgressLogging", "UUIDs"]
git-tree-sha1 = "cbea752b5eef52a3e1188fb31580c3e4fa0cbc35"
uuid = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
version = "0.1.2"
[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TranscodingStreams]]
deps = ["Random", "Test"]
git-tree-sha1 = "7c53c35547de1c5b9d46a4797cf6d8253807108c"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.9.5"
[[TreeViews]]
deps = ["Test"]
git-tree-sha1 = "8d0d7a3fe2f30d6a7f833a5f19f7c7a5b396eae6"
uuid = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7"
version = "0.3.0"
[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[[UnPack]]
git-tree-sha1 = "387c1f73762231e86e0c9c5443ce3b4a0a9a0c2b"
uuid = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
version = "1.0.2"
[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[VectorizationBase]]
deps = ["CpuId", "Libdl", "LinearAlgebra"]
git-tree-sha1 = "03e2fbb479a1ea350398195b6fbf439bae0f8260"
uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
version = "0.12.33"
[[VertexSafeGraphs]]
deps = ["LightGraphs"]
git-tree-sha1 = "b9b450c99a3ca1cc1c6836f560d8d887bcbe356e"
uuid = "19fa3120-7c27-5ec5-8db8-b0b0aa330d6f"
version = "0.1.2"
[[XML2_jll]]
deps = ["Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"]
git-tree-sha1 = "ecff6bff03b35d482ad5eb51276d6fc4c823cd39"
uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a"
version = "2.9.10+2"
[[Zlib_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "fdd89e5ab270ea0f2a0174bd9093e557d06d4bfa"
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.11+16"
[[ZygoteRules]]
deps = ["MacroTools"]
git-tree-sha1 = "b3b4882cc9accf6731a08cc39543fbc6b669dca8"
uuid = "700de1a5-db45-46bc-99cf-38207098b444"
version = "0.2.0"
[[libass_jll]]
deps = ["Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "f02d0db58888592e98c5f4953cef620ce9274eee"
uuid = "0ac62f75-1d6f-5e53-bd7c-93b484bb37c0"
version = "0.14.0+3"
[[libfdk_aac_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "e17b4513993b4413d31cffd1b36a63625ebbc3d3"
uuid = "f638f0a6-7fb0-5443-88ba-1cc74229b280"
version = "0.1.6+3"
[[libvorbis_jll]]
deps = ["Libdl", "Ogg_jll", "Pkg"]
git-tree-sha1 = "8014e1c1033009edcfe820ec25877a9f1862ba4c"
uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a"
version = "1.3.6+5"
[[x264_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "e496625b900df1b02ab0e02fad316b77446616ef"
uuid = "1270edf5-f2f9-52d2-97e9-ab00b5d0237a"
version = "2020.7.14+1"
[[x265_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "ac7d44fa1639a780d0ae79ca1a5a7f4181131825"
uuid = "dfaa095f-4041-5dcd-9319-2fabd8486b76"
version = "3.0.0+2"

8
examples/covid/chime/Project.toml

@ -0,0 +1,8 @@
[deps]
AlgebraicPetri = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
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"

54
examples/covid/chime/README.md

@ -0,0 +1,54 @@
# CHIME Model
The folder contains implementations of the [CHIME COVID-19
Model](https://github.com/CodeForPhilly/chime). This model is an SIR
epidemiological model where the rate of infection changes over time to represent
policy changes such as shelter in place orders or masking requirements.
Both
[`chime.jl`](https://github.com/AlgebraicJulia/AlgebraicPetri.jl/blob/petset/examples/covid/chime/chime.jl)
and
[`chime-cset.jl`](https://github.com/AlgebraicJulia/AlgebraicPetri.jl/blob/petset/examples/covid/chime/chime-cset.jl)
implement the same model. Here
[`chime.jl`](https://github.com/AlgebraicJulia/AlgebraicPetri.jl/blob/petset/examples/covid/chime/chime.jl)
represents building the model out of the composition of open systems using
AlgebraicJulia's Epidemiology module, and
[`chime-cset.jl`](https://github.com/AlgebraicJulia/AlgebraicPetri.jl/blob/petset/examples/covid/chime/chime-cset.jl)
uses the new C-Set implementation of Petri Nets that keeps track of initial
conditions and rates automatically. This is a new notation and has not yet been
built to support the open systems of decorated cospans, but this is on the way!
## Running the Models
To initialize the project in Julia, `cd` into this directory and run `julia
--project -e 'pkg"instantiate"'`
Once the project has been instantiated, both of these models can be run easily
from within this folder with `julia --project chime.jl` or `julia --project
chime-cset.jl`.
These models can be represented as a JSON format for interoperability purposes
which can be found in
[`chime.json`](https://github.com/AlgebraicJulia/AlgebraicPetri.jl/blob/petset/examples/covid/chime/chime.json).
An explanation on how to read this schema can be found in
[`cset-json-schema.pdf`](https://github.com/AlgebraicJulia/AlgebraicPetri.jl/blob/petset/examples/covid/chime/cset-json-schema.pdf).
## Example Solutions
When running these models,
[`Petri.jl`](https://mehalter.github.io/Petri.jl/stable/) supports solvers using
ODEs, SDEs, and Gillespie discrete simulations. Some example outputs are shown
below with the following initial conditions and parameters:
- Enacted policy changing after 20, 40, and then 60 days
- A relative contact rate of 0.05
- an infectious day length of 14
- And initial conditions of 990 susceptible, 10 infected, and 0 recovered
### ODE Solution
![ODE Solution of the CHIME Model](ode-chime.png)
### SDE Solution
![SDE Solution of the CHIME Model](sde-chime.png)

38
examples/covid/chime/chime-cset.jl

@ -0,0 +1,38 @@
using AlgebraicPetri
using Petri: Model, Graph
using OrdinaryDiffEq
using Plots
using Catlab.Meta
using JSON
import OrdinaryDiffEq: ODEProblem
ODEProblem(p::LabelledReactionNet, t) = ODEProblem(vectorfield(p), concentrations(p), t, rates(p))
# help capture JSON of defined functions
macro capture(funcname, exname, ex)
quote
$(esc(exname)) = $(repr(strip_lines(ex, recurse=true)))
$(esc(funcname)) = $ex
end
end
@capture γ γ_text 1/14
@capture β β_text t->begin
policy_days = [20,60,120] .+ 17
contact_rate = 0.05
pol = findfirst(x->t<=x, policy_days) # array of days when policy changes
growth_rate = pol == 1 ? 0.0 : (2^(1/((pol-1)*5)) - 1) # growth rate depending on policy
return (growth_rate + γ) / 990 * (1-contact_rate) # calculate rate of infection
end
sir_cset= LabelledReactionNet{Function, Float64}((:S=>990, :I=>10, :R=>0), (:inf, β)=>((:S, :I)=>(:I,:I)), (:rec, t->γ)=>(:I=>:R))
Graph(Model(sir_cset))
prob = ODEProblem(sir_cset, (17.0, 120.0))
sol = OrdinaryDiffEq.solve(prob,Tsit5())
plot(sol)
## Getting Sharable JSON
sir_cset_string = LabelledReactionNet{String, Int}((:S=>990, :I=>10, :R=>0), (:inf, β_text)=>((:S, :I)=>(:I,:I)), (:rec, γ_text)=>(:I=>:R))
JSON.print(sir_cset_string.tables, 2)

41
examples/covid/chime/chime.jl

@ -0,0 +1,41 @@
using AlgebraicPetri
using AlgebraicPetri.Epidemiology
using Petri: Model, Graph
using OrdinaryDiffEq
using StochasticDiffEq
using Plots
using Catlab.Theories
using Catlab.CategoricalAlgebra.FreeDiagrams
using Catlab.Graphics
display_wd(ex) = to_graphviz(ex, orientation=LeftToRight, labels=true);
sir = transmission recovery
p_sir = decoration(F_epi(sir));
display_wd(sir)
#-
Graph(Model(p_sir))
u0 = [990.0, 10, 0];
t_span = (17.0,120.0)
γ = 1/14
β = t->begin
policy_days = [20,60,120] .+ 17
contact_rate = 0.05
pol = findfirst(x->t<=x, policy_days) # array of days when policy changes
growth_rate = pol == 1 ? 0.0 : (2^(1/((pol-1)*5)) - 1) # growth rate depending on policy
return (growth_rate + γ) / 990 * (1-contact_rate) # calculate rate of infection
end
p = [β, γ];
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")

27
examples/covid/chime/chime.json

@ -0,0 +1,27 @@
{
"T": [
{
"rate": ":(t->begin\n policy_days = [20, 60, 120] .+ 17\n contact_rate = 0.05\n pol = findfirst((x->begin\n t <= x\n end), policy_days)\n growth_rate = if pol == 1\n 0.0\n else\n 2 ^ (1 / ((pol - 1) * 5)) - 1\n end\n return ((growth_rate + γ) / 990) * (1 - contact_rate)\n end)",
"tname": "inf"
},
{
"rate": ":(1 / 14)",
"tname": "rec"
}
],
"S": [
{ "concentration": 990, "sname": "S" },
{ "concentration": 10, "sname": "I" },
{ "concentration": 0, "sname": "R" }
],
"I": [
{ "it": 1, "is": 1 },
{ "it": 1, "is": 2 },
{ "it": 2, "is": 2 }
],
"O": [
{ "ot": 1, "os": 2 },
{ "ot": 1, "os": 2 },
{ "ot": 2, "os": 3 }
]
}

BIN
examples/covid/chime/cset-json-schema.pdf

Binary file not shown.

89
examples/covid/chime/cset-json-schema.rmd

@ -0,0 +1,89 @@
---
title: Petri Net JSON Schema
date: September 10, 2020
author: Micah Halter
output: pdf_document
header-includes:
- \usepackage{tikz-cd}
---
# Formulation
We can define a Petri net to be the following diagram of finite sets
$$
\begin{tikzcd}[row sep=large, column sep=large]
Str & \arrow[l, "sname" swap] S \arrow[r, "conc."] & \mathbb{R}^+ \\
I \arrow[ru, "is" swap] \arrow[rd, "it"] & & O \arrow[lu, "os"] \arrow[ld, "ot" swap] \\
Str &\arrow[l, "tname"] T \arrow[r, "rate" swap] & \mathbb{R}^+
\end{tikzcd}
$$
Here, $T$ is the set of transitions, $S$ is the set of states, $I$ is the set of input edges from some state $s$ to some transition $t$, and $O$ is the set of output edges from some transition $t$ to some state $s$ where $s \in S$ and $t \in T$. Along with these definitions for transitions, we also have maps from $S \rightarrow \mathbb{R}^+$ that map states to their initial concentrations and $S \rightarrow Str$ that map states to labels. Similarly, we have maps from $T \rightarrow \mathbb{R}^+$ that map transitions to their transition rates and $T \rightarrow Str$ that map transitions to labels.
With this formulation, we can naturally convert the resulting structure into JSON schema:
```json
{
"T": [
{ "rate": 0.0003, "tname": "inf" },
{ "rate": 0.2, "tname": "rec" }
],
"S": [
{ "concentration": 990, "sname": "S" },
{ "concentration": 10, "sname": "I" },
{ "concentration": 0, "sname": "R" }
],
"I": [
{ "it": 1, "is": 1 },
{ "it": 1, "is": 2 },
{ "it": 2, "is": 2 }
],
"O": [
{ "ot": 1, "os": 2 },
{ "ot": 1, "os": 2 },
{ "ot": 2, "os": 3 }
]
}
```
**Fields:**
- `T`: an array of transitions each with both a `rate` and `tname` specified to represent the transition rate and the label of the transition respectively
- `S`: an array of states each with both a `concentration` and `sname` specified to represent the initial concentration and the label of the state respectively
- `I`: an array of input edges each with an input transition (`it`) and input state (`is`) whose values are indexes into the `T` and `S` arrays respectively. These represent an edge from state `is` to transition `it`.
- `O`: an array of output edges each with an output transition (`it`) and output state (`is`) whose values are indexes into the `T` and `S` arrays respectively. These represent an edge from transition `it` to state `is`.
### Dynamic Transition Rates
In order to support dynamic transition rates, we will be providing raw Julia code blocks that defines a function as either a function of time (`t->begin ... end`) or both time and current state (`(u,t)->begin ... end`). This will allow us to provide the math the defines the change of the rate in regards to different parts of the system while maintaining the structure of the original model. For interoperability, these rates can either be transpiled between languages or you can focus on just extracting the model structure from the `json` file and write your own definitions for the rates. An example of this would be `{ "rate": ":((u,t)->((3/sum(u))/(t+1)))", "tname": "inf" }`. Here the rate of the transition `inf` changes as a function of the current state of the system (total population) and time, where infection rate decreases over time to represent a virus weakening over time. Another example can be found in the [`chime.json`](https://github.com/AlgebraicJulia/AlgebraicPetri.jl/blob/petset/examples/covid/chime/chime.json) where the rate of infection is dependent on time to model changes in intervention policies.
*Note:* While this is how we plan to represent dynamic rates currently, we are investigating using a dataflow graph in the future to represent the math that defines dynamic rates in a more programming language/implementation agnostic way.
## SIR Example
```json
{
"T": [
{ "rate": 0.0003, "tname": "inf" },
{ "rate": 0.2, "tname": "rec" }
],
"S": [
{ "concentration": 990, "sname": "S" },
{ "concentration": 10, "sname": "I" },
{ "concentration": 0, "sname": "R" }
],
"I": [
{ "it": 1, "is": 1 },
{ "it": 1, "is": 2 },
{ "it": 2, "is": 2 }
],
"O": [
{ "ot": 1, "os": 2 },
{ "ot": 1, "os": 2 },
{ "ot": 2, "os": 3 }
]
}
```
![Resulting SIR Petri Net](sir.png)

BIN
examples/covid/chime/ode-chime.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
examples/covid/chime/sde-chime.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
examples/covid/chime/sir.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

14
examples/covid/covid.jl

@ -5,14 +5,14 @@
using AlgebraicPetri
using AlgebraicPetri.Epidemiology
using Petri
using Petri: Model, Graph
using OrdinaryDiffEq
using Plots
using Catlab
using Catlab.Theories
using Catlab.Programs
using Catlab.CategoricalAlgebra.ShapeDiagrams
using Catlab.CategoricalAlgebra.FreeDiagrams
using Catlab.WiringDiagrams
using Catlab.Graphics
@ -25,7 +25,7 @@ id(args...) = foldl((x,y)->id(x) ⊗ id(y), args);
travel_petri = PetriCospan(
[1,2,3],
Petri.Model(1:6, [(Dict(1=>1), Dict(4=>1)), (Dict(2=>1), Dict(5=>1)), (Dict(3=>1), Dict(6=>1))]),
PetriNet(6, (1,4), (2,5), (3,6)),
[4,5,6]);
# #### Step 2: Extend the Infectious Disease presentation,
@ -62,7 +62,7 @@ seird_city = to_hom_expr(FreeBiproductCategory, seird_city)
display_wd(seird_city)
# -
Graph(decoration(F(seird_city)))
Graph(Model(decoration(F(seird_city))))
# create a multi-city SEIRD models
@ -73,7 +73,7 @@ pc_seird_3 = F(seird_3)
p_seird_3 = decoration(pc_seird_3)
display_wd(seird_3)
# -
Graph(p_seird_3)
Graph(Model(p_seird_3))
# Define time frame and initial parameters
@ -94,7 +94,7 @@ params = seirdparams(3, 5);
# Generate, solve, and visualize resulting ODE
prob = ODEProblem(p_seird_3,u0,tspan,params);
prob = ODEProblem(vectorfield(p_seird_3),u0,tspan,params);
sol = solve(prob,Tsit5());
plot(sol)
@ -125,7 +125,7 @@ a,b,p = 10, 1, 1/6
dynparams = waveparams(asymptotic, a/sum(u0), b/sum(u0),p)
prob = ODEProblem(p_seird_3,u0,tspan, dynparams)
prob = ODEProblem(vectorfield(p_seird_3),u0,tspan, dynparams)
sol = solve(prob,Tsit5(), saveat=1:1:tspan[2])
plot(sol)

32
examples/covid/epidemiology.jl

@ -2,14 +2,16 @@
#
#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/covid/epidemiology.ipynb)
using AlgebraicPetri
using AlgebraicPetri.Epidemiology
using Petri
using Petri: Model, Graph
using OrdinaryDiffEq
using StochasticDiffEq
using Plots
using Catlab.Theories
using Catlab.CategoricalAlgebra.ShapeDiagrams
using Catlab.CategoricalAlgebra.FreeDiagrams
using Catlab.Graphics
display_wd(ex) = to_graphviz(ex, orientation=LeftToRight, labels=true);
@ -20,12 +22,15 @@ display_wd(ex) = to_graphviz(ex, orientation=LeftToRight, labels=true);
sir = transmission recovery
# get resulting petri net and visualize model
# get resulting petri net as a C-Set
p_sir = decoration(F_epi(sir));
cset_sir = decoration(F_epi(sir));
display_wd(sir)
#-
Graph(p_sir)
# Use Petri.jl to visualize the C-Set
Graph(Model(cset_sir))
# define initial states and transition rates, then
# create, solve, and visualize ODE problem
@ -33,8 +38,10 @@ Graph(p_sir)
u0 = [10.0, 1, 0];
p = [0.4, 0.4];
prob,cb = SDEProblem(p_sir,u0,(0.0,7.5),p);
sol = solve(prob,SRA1(),callback=cb)
# The C-Set representation has direct support for generating a DiffEq vector field
prob = ODEProblem(vectorfield(cset_sir),u0,(0.0,7.5),p);
sol = solve(prob,Tsit5())
plot(sol)
@ -46,9 +53,10 @@ sei = exposure ⋅ (illness ⊗ id(I)) ⋅ ∇(I)
seir = sei recovery
# get resulting petri net and visualize model
# here we convert the C-Set decoration to a Petri.jl model
# to use its StochasticDifferentialEquations support
p_seir = decoration(F_epi(seir));
p_seir = Model(decoration(F_epi(seir)));
display_wd(seir)
#-
@ -58,7 +66,7 @@ Graph(p_seir)
# create, solve, and visualize ODE problem
u0 = [10.0, 1, 0, 0];
p = [0.9, 0.2, 0.5];
p = [.9, .2, .5];
prob,cb = SDEProblem(p_seir,u0,(0.0,15.0),p);
sol = solve(prob,SRA1(),callback=cb)
@ -73,7 +81,7 @@ seird = sei ⋅ Δ(I) ⋅ (death ⊗ recovery)
# get resulting petri net and visualize model
p_seird = decoration(F_epi(seird));
p_seird = Model(decoration(F_epi(seird)));
display_wd(seird)
#-
@ -88,4 +96,4 @@ 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)
plot(sol)
plot(sol)

36
examples/predation/lotka-volterra.jl

@ -4,14 +4,14 @@
using AlgebraicPetri
using Petri
using Petri: Model, Graph
using OrdinaryDiffEq
using Plots
using Catlab
using Catlab.Theories
using Catlab.Programs
using Catlab.CategoricalAlgebra.ShapeDiagrams
using Catlab.CategoricalAlgebra.FreeDiagrams
using Catlab.WiringDiagrams
using Catlab.Graphics
@ -19,14 +19,14 @@ display_wd(ex) = to_graphviz(ex, orientation=LeftToRight, labels=true);
# #### Step 1: Define the building block Petri nets needed to construct the model
birth_petri = PetriCospan([1], Petri.Model([1], [(Dict(1=>1), Dict(1=>2))]), [1]);
Graph(decoration(birth_petri))
birth_petri = PetriCospan([1], PetriNet(1, (1, (1,1))), [1]);
Graph(Model(decoration(birth_petri)))
#-
predation_petri = PetriCospan([1,2], Petri.Model(1:2, [(Dict(1=>1,2=>1), Dict(2=>1.15))]), [2]);
Graph(decoration(predation_petri))
predation_petri = PetriCospan([1,2], PetriNet(2, ((1,2), (2,2))), [2]);
Graph(Model(decoration(predation_petri)))
#-
death_petri = PetriCospan([1], Petri.Model([1], [(Dict(1=>1), Dict{Int,Int}())]), [1]);
Graph(decoration(death_petri))
death_petri = PetriCospan([1], PetriNet(1, (1, ())), [1]);
Graph(Model(decoration(death_petri)))
# #### Step 2: Define a presentation of the free biproduct category
# that encodes the domain specific information
@ -51,14 +51,14 @@ lotka_volterra = (birth ⊗ id(wolves)) ⋅ predation ⋅ death
lotka_petri = decoration(F(lotka_volterra))
display_wd(lotka_volterra)
#-
Graph(lotka_petri)
Graph(Model(lotka_petri))
# Generate appropriate vector fields, define parameters, and visualize solution
u0 = [40, 2];
p = [4.0, 1.0, 2.0];
prob = ODEProblem(lotka_petri,u0,(0.0,8.0),p);
sol = solve(prob,Tsit5(),abstol=1e-6);
u0 = [100, 10];
p = [.3, .015, .7];
prob = ODEProblem(vectorfield(lotka_petri),u0,(0.0,100.0),p);
sol = solve(prob,Tsit5(),abstol=1e-8);
plot(sol)
# There is also a second syntax that is easier to write for programmers
@ -101,12 +101,12 @@ end
display_wd(dual_lv)
#-
dual_lv_petri = decoration(F(to_hom_expr(FreeBiproductCategory, dual_lv)))
Graph(dual_lv_petri)
Graph(Model(dual_lv_petri))
# Generate a new solver, provide parameters, and analyze results
u0 = [40, 2, 1];
p = [4.0, 1.0, 2.0, 2.5, 1.5];
prob = ODEProblem(dual_lv_petri,u0,(0.0,8.0),p);
u0 = [100, 10, 2];
p = [.3, .015, .7, .017, .35];
prob = ODEProblem(vectorfield(dual_lv_petri),u0,(0.0,100.0),p);
sol = solve(prob,Tsit5(),abstol=1e-6);
plot(sol)
plot(sol)

74
src/AlgebraicPetri.jl

@ -5,17 +5,18 @@ export PetriCospanOb, PetriFunctor, PetriCospan
using Catlab.GAT
using Catlab.Theories: BiproductCategory
using Catlab.CategoricalAlgebra.ShapeDiagrams
using Catlab.CategoricalAlgebra.FreeDiagrams
using Catlab.Theories
using Catlab.CategoricalAlgebra.Limits
using Catlab.CategoricalAlgebra.FinSets
using Petri
using AutoHashEquals
import Petri: EmptyPetri
using Catlab.CategoricalAlgebra.FinSets: FinSet
import Catlab.Theories: dom, codom, id, compose, , , otimes, , munit,
braid, σ, mcopy, Δ, mmerge, , create, , delete, ,
pair, copair, proj1, proj2, coproj1, coproj2
include("Types.jl")
""" Finite ordinal (natural number)
@ -26,7 +27,8 @@ An object in the category of Open Petri Nets.
end
PetriCospanOb(X::FinSet) = PetriCospanOb(length(X))
FinSet(X::PetriCospanOb) = FinSet(length(X))
EmptyPetri(X::PetriCospanOb) = EmptyPetri(length(X))
# TODO: Extend to a type parameter for arbitrary petri net types (petri net, reaction net, labelled, etc)
EmptyPetriNet(X::PetriCospanOb) = PetriNet(length(X))
Base.iterate(X::PetriCospanOb, args...) = iterate(iterable(X), args...)
Base.length(X::PetriCospanOb) = length(iterable(X))
@ -53,23 +55,9 @@ element is in the set. Here we take any julia value and test whether it is a
Petri net on n states.
"""
function (pd::PetriDecorator)(n::FinSet)
return p -> typeof(p) <: Petri.Model && length(p.S) == length(n)
return p -> typeof(p) <: AbstractPetriNet && ns(p) == length(n)
end
map(f::Function, d::Dict{K,V}) where {K,V} = begin
out = Dict{K,V}()
for p in Base.map(x->Pair(f(x[1]), x[2]), collect(d))
if p[1] in keys(out)
out[p[1]] += p[2]
else
out[p[1]] = p[2]
end
end
out
end
map(f::Function, ts::Vector{Tuple{S,T}}) where {S<:Dict, T<:Dict} = [(map(f, t[1]), map(f, t[2])) for t in ts]
""" AlgebraicPetri.PetriDecorator(f::FinFunction)
A functor from FinSet to Set has a hom part, which given a hom f in FinSet
@ -77,8 +65,8 @@ A functor from FinSet to Set has a hom part, which given a hom f in FinSet
here we implement this as a function that takes a Petri net of size n to a Petri
net of size m, such that the transitions are mapped appropriately.
"""
function (pd::PetriDecorator)(f::FinFunction)
return (p::Petri.Model) -> Petri.Model(collect(codom(f)), map(x->f(x), p.Δ))
function (pd::PetriDecorator)(f::FinFunction) # TODO: MOVE TO AbstractPetriNet
return (p::PetriNet) -> PetriNet(length(codom(f)), [(map(f, inputs(p, t)), map(f, outputs(p, t))) for t in 1:nt(p)]...)
end
""" AlgebraicPetri.PetriLaxator(p::Petri.Model, q::Petri.Model)
@ -87,30 +75,30 @@ The laxitor takes a pair of decorations and returns the coproduct decoration
For Petri nets, this encodes the idea that you shift the states of q up by the
number of states in p.
"""
function (l::PetriLaxator)(p::Petri.Model, q::Petri.Model)
return Petri.Model(collect(1:(length(p.S)+length(q.S))),
vcat(p.Δ, map(x->x+length(p.S), q.Δ)))
function (l::PetriLaxator)(p::PetriNet, q::PetriNet) # TODO: MOVE TO AbstractPetriNet
return PetriNet(ns(p)+ns(q), [(inputs(p, t), outputs(p, t)) for t in 1:nt(p)]...,
[(map(x->x+ns(p), inputs(q, t)), (map(x->x+ns(p), outputs(q, t)))) for t in 1:nt(q)]...)
end
""" Petri Cospan
A morphism in the category of Open Petri Nets defined as a decorated cospan with
a [`PetriFunctor`](@ref) as the decorator which maps the category of finite
ordinals to the category Petri and a Petri.Model as the decoration
ordinals to the category Petri and an AbstractPetriNet as the decoration
"""
const PetriCospan = DecoratedCospan{PetriFunctor, Petri.Model}
const PetriCospan = DecoratedCospan{PetriFunctor, AbstractPetriNet}
""" AlgebraicPetri.PetriCospan(l::Vector{Int}, m::Petri.Model, r::Vector{Int})
""" AlgebraicPetri.PetriCospan(l::Vector{Int}, m::AbstractPetriNet, r::Vector{Int})
A constructor for Petri Cospans where `l` is a vector of the input states from
Petri.Model `m`, and `r` is a vector of the output states from Petri.Model `m`
AbstractPetriNet `m`, and `r` is a vector of the output states from AbstractPetriNet `m`
Constructs the cospan: l m r
"""
function (::Type{PetriCospan})(l::AbstractVector, m::Petri.Model, r::AbstractVector)
return PetriCospan(Cospan(FinFunction(l, length(m.S)),
FinFunction(r, length(m.S))),
id(PetriFunctor), m)
function (::Type{PetriCospan})(l::AbstractVector, p::AbstractPetriNet, r::AbstractVector)
return PetriCospan(Cospan(FinFunction(l, ns(p)),
FinFunction(r, ns(p))),
id(PetriFunctor), p)
end
@instance BiproductCategory(PetriCospanOb, PetriCospan) begin
@ -121,19 +109,18 @@ end
# reimplementation of pushout of Span{FinSetFunc, FinSetFun}
# to save the value of coeq
f, g = right(p), left(q)
coprod = coproduct(codom(f), codom(g))
ι1, ι2 = left(coprod), right(coprod)
coeq = coequalizer(f⋅ι1, g⋅ι2)
f′, g′ = ι1⋅coeq, ι2⋅coeq
ι1, ι2 = coproduct(codom(f), codom(g))
π = proj(coequalizer(f⋅ι1, g⋅ι2))
f′, g′ = ι1⋅π, ι2⋅π
composite = Cospan(left(p)f′, right(q)g′)
dpuq = decorator(p).L(decoration(p), decoration(q))
return PetriCospan(composite, decorator(p), decorator(p).F(coeq)(dpuq))
return PetriCospan(composite, decorator(p), decorator(p).F(π)(dpuq))
end
id(X::PetriCospanOb) = PetriCospan(
Cospan(id(FinSet(X)), id(FinSet(X))),
id(PetriFunctor),
EmptyPetri(X))
EmptyPetriNet(X))
otimes(X::PetriCospanOb, Y::PetriCospanOb) = PetriCospanOb(length(X) + length(Y))
@ -160,28 +147,28 @@ end
Cospan(
id(FinSet(Z)),
FinFunction(vcat(length(X)+1:length(Z), iterable(X)), length(Z), length(Z))
), id(PetriFunctor), EmptyPetri(Z))
), id(PetriFunctor), EmptyPetriNet(Z))
end
mcopy(X::PetriCospanOb) = PetriCospan(
Cospan(
id(FinSet(X)),
FinFunction(vcat(iterable(X),iterable(X)), 2*length(X), length(X))
), id(PetriFunctor), EmptyPetri(X))
), id(PetriFunctor), EmptyPetriNet(X))
mmerge(X::PetriCospanOb) = PetriCospan(
Cospan(
FinFunction(vcat(iterable(X),iterable(X)), 2*length(X), length(X)),
id(FinSet(X))
), id(PetriFunctor), EmptyPetri(X))