diff --git a/Project.toml b/Project.toml
index 8e65daf..4ced505 100644
--- a/Project.toml
+++ b/Project.toml
@@ -5,8 +5,8 @@ version = "0.2.2"
[deps]
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
+ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
Compose = "a81c6b42-2e10-5240-aca2-a61377ecd94b"
-LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
@@ -32,7 +32,6 @@ AlgebraicPetri = "0.9"
Catlab = "0.15, 0.16"
Compose = "^0.9.1"
DelayDiffEq = "5"
-LabelledArrays = "1"
LinearAlgebra = "1.9"
LinearMaps = "^3.1.0"
OrdinaryDiffEq = "^5.49.0, 6"
diff --git a/docs/Project.toml b/docs/Project.toml
index bfaa2af..71fda8f 100644
--- a/docs/Project.toml
+++ b/docs/Project.toml
@@ -2,11 +2,11 @@
AlgebraicDynamics = "5fd6ff03-a254-427e-8840-ba658f502e32"
AlgebraicPetri = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
+ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DynamicalSystems = "61744808-ddfa-5f27-97ff-6e42cc95d634"
-LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
NLSolvers = "337daf1e-9722-11e9-073e-8b9effe078ba"
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
diff --git a/docs/src/AlgebraicPetri.md b/docs/src/AlgebraicPetri.md
index 471f2fa..0fdeb30 100644
--- a/docs/src/AlgebraicPetri.md
+++ b/docs/src/AlgebraicPetri.md
@@ -58,15 +58,13 @@ open_bruss = Open([:A, :D], Brusselator, [:A, :B])
rs = ContinuousResourceSharer{Float64}(open_bruss)
````
-!!! note
-@example AlgPetri
- SciML integration for LabelledArrays is broken due to this [issue](https://github.com/SciML/LabelledArrays.jl/issues/162) on LabelledArrays.jl. Once that issue is closed, you should be able to solve LabelledPetriNets with SciML Solvers.
````julia
-using LabelledArrays
+using ComponentArrays
tspan = (0.0,100.0)
-params = LVector(t1=1.0, t2=1.2, t3=3.14, t4=0.1)
-u0 = LVector(A=1.0, B=3.17, D=0.0, E=0.0, X=1.0, Y=1.9)
+params = ComponentArray(t1=1.0, t2=1.2, t3=3.14, t4=0.1)
+u0 = ComponentArray(A=1.0, B=3.17, D=0.0, E=0.0, X=1.0, Y=1.9)
+eval_dynamics(rs, u0, params, 0.0)
prob = ODEProblem((u,p,t) -> eval_dynamics(rs, u, p, t), u0, tspan, params)
sol = solve(prob, Tsit5())
plot(sol, idxs=[:X, :Y])
diff --git a/examples/Cyber-Physical.jl b/examples/Cyber-Physical.jl
index 71857c4..0eed9e0 100644
--- a/examples/Cyber-Physical.jl
+++ b/examples/Cyber-Physical.jl
@@ -10,8 +10,7 @@
using AlgebraicDynamics
using Catlab
-
-using LabelledArrays
+using ComponentArrays
using DifferentialEquations
using Plots
@@ -58,10 +57,11 @@ to_graphviz(UAV)
# Then we assign behaviors to inhabit the boxes.
+
function 𝗟(𝐖)
𝐿(u, x, p, t) = [ -p.𝓐l * (u[1] - x[1] - x[2]) ] # sc
𝐶(u, x, p, t) = [ -p.𝓐c * (u[1] + p.𝓑c*x[1] - x[2]) ] # sl
- 𝐷(u, x, p, t) = LVector(α = -0.313*u[1] + 56.7*u[2] + 0.232*x[1],
+ 𝐷(u, x, p, t) = ComponentArray(α = -0.313*u[1] + 56.7*u[2] + 0.232*x[1],
q = -0.013*u[1] - 0.426*u[2] + 0.0203*x[1],
θ = 56.7*u[2] )
@@ -81,17 +81,18 @@ end
# Lastly, we compute and plot the solution.
## initial values
-xₒ = LVector( e = 0.01, # [e, d] -> [θ offset, 𝛿 control input]
+
+x₀ = ComponentArray( e = 0.01, # [e, d] -> [θ offset, 𝛿 control input]
d = 0.05);
-uₒ = [0.0, 0, 0, 0, 0]
+u₀ = [0.0, 0, 0, 0, 0]
tspan = (0, 20.0)
params = (𝓐l = 100, # decay constant of sensor
𝓐c = 100, # decay constant of controller
𝓑c = 0) # ratio of velocity to reference velocity
-prob = ODEProblem(𝑢ᵤₐᵥ, uₒ, xₒ, tspan, params)
+prob = ODEProblem(𝑢ᵤₐᵥ, u₀, x₀, tspan, params)
sol = solve(prob, alg_hints=[:stiff]);
#-
diff --git a/examples/Ecosystem.jl b/examples/Ecosystem.jl
index e3cb1b4..2af7797 100644
--- a/examples/Ecosystem.jl
+++ b/examples/Ecosystem.jl
@@ -5,7 +5,7 @@
using AlgebraicDynamics
using Catlab
-using LabelledArrays
+using ComponentArrays
using OrdinaryDiffEq
using Plots, Plots.PlotMeasures
@@ -16,7 +16,8 @@ using Plots, Plots.PlotMeasures
# - parameters $\gamma$ represent the rate at which a population of predators grows in a predation interaction
# - parameters $\delta$ represent the rate at with a species population declines
-params = LVector(αr=0.3, βrf=0.015, γrf=0.015, δf=0.7,
+
+params = ComponentArray(αr=0.3, βrf=0.015, γrf=0.015, δf=0.7,
βrh=0.01, γrh=0.01, δh=0.5,
γfishh=0.001, βfishh=0.003,
αfish=0.35, βfishF=0.015, γfishF=0.015,
diff --git a/examples/Lotka-Volterra.jl b/examples/Lotka-Volterra.jl
index bc2155b..17dfe66 100644
--- a/examples/Lotka-Volterra.jl
+++ b/examples/Lotka-Volterra.jl
@@ -24,7 +24,7 @@
using AlgebraicDynamics
using Catlab.WiringDiagrams, Catlab.Programs
-using LabelledArrays
+using ComponentArrays
using OrdinaryDiffEq, Plots, Plots.PlotMeasures
const UWD = UndirectedWiringDiagram
@@ -47,10 +47,11 @@ end
## Compose
rabbitfox_system = oapply(rf, [rabbit_growth, rabbitfox_predation, fox_decline])
+
## Solve and plot
u0 = [10.0, 100.0]
-params = LVector(α=.3, β=0.015, γ=0.015, δ=0.7)
+params = ComponentArray(α=.3, β=0.015, γ=0.015, δ=0.7)
tspan = (0.0, 100.0)
prob = ODEProblem(rabbitfox_system, u0, tspan, params)
@@ -100,7 +101,7 @@ rabbitfox_system = oapply(rabbitfox_pattern, [rabbit, fox])
## Solve and plot
u0 = [10.0, 100.0]
-params = LVector(α=.3, β=0.015, γ=0.015, δ=0.7)
+params = ComponentArray(α=.3, β=0.015, γ=0.015, δ=0.7)
tspan = (0.0, 100.0)
prob = ODEProblem(rabbitfox_system, u0, tspan, params)
@@ -123,9 +124,8 @@ rabbitfox_pattern = barbell(1)
## Compose
rabbitfox_system = oapply(rabbitfox_pattern, [rabbit, fox])
-## Solve and plot
u0 = [10.0, 100.0]
-params = LVector(α=.3, β=0.015, γ=0.015, δ=0.7)
+params = ComponentArray(α=.3, β=0.015, γ=0.015, δ=0.7)
tspan = (0.0, 100.0)
prob = ODEProblem(rabbitfox_system, u0, tspan, params)
diff --git a/examples/Ross-Macdonald.jl b/examples/Ross-Macdonald.jl
index 374aa13..0447d85 100644
--- a/examples/Ross-Macdonald.jl
+++ b/examples/Ross-Macdonald.jl
@@ -7,8 +7,7 @@
using AlgebraicDynamics
using Catlab.WiringDiagrams, Catlab.Graphics
-using LabelledArrays
-
+using ComponentArrays
using DelayDiffEq, DifferentialEquations
using Plots
@@ -106,9 +105,10 @@ malaria_model = oapply(rm,
)
#-
-params = LVector(a = 0.3, b = 0.55, c = 0.15,
+params = ComponentArray(a = 0.3, b = 0.55, c = 0.15,
g = 0.1, n = 10, r = 1.0/200, m = 0.5)
+
u0 = [0.1, 0.3]
tspan = (0.0, 365.0*2)
@@ -254,7 +254,7 @@ malaria_delay_model = oapply(rm,
Dict(:humans => human_delay_model, :mosquitos => mosquito_delay_model)
)
#-
-params = LVector(a = 0.3, b = 0.55, c = 0.15,
+params = ComponentArray(a = 0.3, b = 0.55, c = 0.15,
g = 0.1, n = 10, r = 1.0/200, m = 0.5)
u0_delay = [0.09, .01, 0.3]
diff --git a/ext/AlgebraicDynamicsAlgebraicPetriExt.jl b/ext/AlgebraicDynamicsAlgebraicPetriExt.jl
index 6f91ca4..731336d 100644
--- a/ext/AlgebraicDynamicsAlgebraicPetriExt.jl
+++ b/ext/AlgebraicDynamicsAlgebraicPetriExt.jl
@@ -3,7 +3,7 @@ module AlgebraicDynamicsAlgebraicPetriExt
using AlgebraicPetri
using AlgebraicDynamics
using Catlab
-using LabelledArrays
+using ComponentArrays
import AlgebraicDynamics.UWDDynam: ContinuousResourceSharer
export OpenNet
@@ -21,16 +21,17 @@ function dynamics(pn::OpenPetriNet,T::Type,ns::Int64)
vf(u, p, t) = begin f!(storage, u, p, t); return storage end
end
+
function dynamics(pn::OpenLabelledPetriNet,T::Type,ns::Int64)
f! = vectorfield(apex(pn))
- storage = LVector(NamedTuple{tuple(snames(apex(pn))...)}(zeros(T,ns)))
+ storage = ComponentArray(NamedTuple{tuple(snames(apex(pn))...)}(zeros(T,ns)))
vf(u, p, t) = begin f!(storage, u, p, t); return storage end
return vf
end
function dynamics(pn::OpenLabelledReactionNet,T::Type,ns::Int64)
f! = vectorfield(apex(pn))
- storage = LVector(NamedTuple{tuple(snames(apex(pn))...)}(zeros(T,ns)))
+ storage = ComponentArray(NamedTuple{tuple(snames(apex(pn))...)}(zeros(T,ns)))
rt = rates(apex(pn))
vf(u, p, t) = begin f!(storage, u, rt, t); return storage end
return vf
diff --git a/notebooks/Project.toml b/notebooks/Project.toml
index b9fed19..7977cb0 100644
--- a/notebooks/Project.toml
+++ b/notebooks/Project.toml
@@ -4,7 +4,6 @@ Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
Javis = "78b212ba-a7f9-42d4-b726-60726080707e"
JavisNB = "92afb270-2599-44f6-96a1-44c6efb1daf1"
-LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
diff --git a/notebooks/multi-city SIR.ipynb b/notebooks/multi-city SIR.ipynb
index f0ee2a4..19d0a5c 100644
--- a/notebooks/multi-city SIR.ipynb
+++ b/notebooks/multi-city SIR.ipynb
@@ -23,7 +23,7 @@
"\n",
"using AlgebraicDynamics, AlgebraicDynamics.DWDDynam\n",
"\n",
- "using LabelledArrays\n",
+ "using ComponentArrays\n",
"\n",
"using OrdinaryDiffEq\n",
"using Plots"
diff --git a/notebooks/springs/springs.ipynb b/notebooks/springs/springs.ipynb
index dc08597..497b465 100644
--- a/notebooks/springs/springs.ipynb
+++ b/notebooks/springs/springs.ipynb
@@ -10,8 +10,7 @@
"using Catlab, Catlab.WiringDiagrams, Catlab.Programs, Catlab.Graphics, Catlab.Graphics.Graphviz\n",
"using AlgebraicDynamics, AlgebraicDynamics.UWDDynam\n",
"\n",
- "using OrdinaryDiffEq, Plots\n",
- "using LabelledArrays"
+ "using OrdinaryDiffEq, Plots"
]
},
{
@@ -88,7 +87,322 @@
"outputs": [
{
"data": {
- "image/svg+xml": "\n\n"
+ "image/svg+xml": [
+ "\n",
+ "\n"
+ ]
},
"execution_count": 6,
"metadata": {},
@@ -181,7 +495,74 @@
"outputs": [
{
"data": {
- "image/svg+xml": "\n\n\n\n\n",
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
"text/plain": [
"Graph(\"G\", false, \"neato\", Statement[Node(\"n1\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:id => \"box1\", :label => \"spring\")), Node(\"n2\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:id => \"box2\", :label => \"gravity\")), Node(\"n3\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer1\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n4\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer2\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n5\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction1\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"mass\")), Node(\"n6\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction2\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"pos\")), Edge(NodeID[NodeID(\"n1\", \"\", \"\"), NodeID(\"n5\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n3\", \"\", \"\"), NodeID(\"n5\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n1\", \"\", \"\"), NodeID(\"n6\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n2\", \"\", \"\"), NodeID(\"n6\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n4\", \"\", \"\"), NodeID(\"n6\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}())], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\", :shape => \"ellipse\", :margin => \"0.05,0.025\", :width => \"0.5\", :height => \"0.5\"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\", :len => \"0.5\"))"
]
@@ -324,7 +705,79 @@
"outputs": [
{
"data": {
- "image/svg+xml": "\n\n\n\n\n",
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
"text/plain": [
"Graph(\"G\", false, \"neato\", Statement[Node(\"n1\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:id => \"box1\", :label => \"spring1\")), Node(\"n2\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:id => \"box2\", :label => \"spring2\")), Node(\"n3\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer1\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n4\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer2\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n5\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction1\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"mass\")), Node(\"n6\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction2\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"pos\")), Edge(NodeID[NodeID(\"n1\", \"\", \"\"), NodeID(\"n5\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n2\", \"\", \"\"), NodeID(\"n5\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n3\", \"\", \"\"), NodeID(\"n5\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n1\", \"\", \"\"), NodeID(\"n6\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n2\", \"\", \"\"), NodeID(\"n6\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n4\", \"\", \"\"), NodeID(\"n6\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}())], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\", :shape => \"ellipse\", :margin => \"0.05,0.025\", :width => \"0.5\", :height => \"0.5\"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\", :len => \"0.5\"))"
]
@@ -524,7 +977,115 @@
"outputs": [
{
"data": {
- "image/svg+xml": "\n\n\n\n\n",
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
"text/plain": [
"Graph(\"G\", false, \"neato\", Statement[Node(\"n1\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:id => \"box1\", :label => \"anchored_spring\")), Node(\"n2\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:id => \"box2\", :label => \"free_spring\")), Node(\"n3\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer1\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n4\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer2\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n5\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer3\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n6\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => \"0\", :id => \"outer4\", :label => \"\", :margin => \"0\", :shape => \"none\", :style => \"invis\", :width => \"0\")), Node(\"n7\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction1\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"m1\")), Node(\"n8\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction2\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"m2\")), Node(\"n9\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction3\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"p1\")), Node(\"n10\", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:comment => \"junction\", :fillcolor => \"black\", :height => \"0.075\", :id => \"junction4\", :label => \"\", :shape => \"circle\", :style => \"filled\", :width => \"0.075\", :xlabel => \"p2\")), Edge(NodeID[NodeID(\"n1\", \"\", \"\"), NodeID(\"n7\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n2\", \"\", \"\"), NodeID(\"n7\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n3\", \"\", \"\"), NodeID(\"n7\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n2\", \"\", \"\"), NodeID(\"n8\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n4\", \"\", \"\"), NodeID(\"n8\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n1\", \"\", \"\"), NodeID(\"n9\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n2\", \"\", \"\"), NodeID(\"n9\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n5\", \"\", \"\"), NodeID(\"n9\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n2\", \"\", \"\"), NodeID(\"n10\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}()), Edge(NodeID[NodeID(\"n6\", \"\", \"\"), NodeID(\"n10\", \"\", \"\")], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}())], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\", :shape => \"ellipse\", :margin => \"0.05,0.025\", :width => \"0.5\", :height => \"0.5\"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:fontname => \"Serif\", :len => \".75\"))"
]
diff --git a/test/Project.toml b/test/Project.toml
index 5a5668e..47cf6c6 100644
--- a/test/Project.toml
+++ b/test/Project.toml
@@ -1,9 +1,9 @@
[deps]
AlgebraicDynamics = "5fd6ff03-a254-427e-8840-ba658f502e32"
+AlgebraicPetri = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
Catlab = "134e5e36-593f-5add-ad60-77f754baafbe"
+ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
-LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
-AlgebraicPetri = "4f99eebe-17bf-4e98-b6a1-2c4f205a959b"
diff --git a/test/cpg_dynam.jl b/test/cpg_dynam.jl
index 88e472b..7cb27ea 100644
--- a/test/cpg_dynam.jl
+++ b/test/cpg_dynam.jl
@@ -3,7 +3,7 @@ using AlgebraicDynamics.DWDDynam
using AlgebraicDynamics.CPortGraphDynam: draw, barbell, gridpath, grid, meshpath
using Catlab
-using LabelledArrays
+using ComponentArrays
using Test
using PrettyTables
diff --git a/test/dwd_dynam.jl b/test/dwd_dynam.jl
index 1942f23..bbe735e 100644
--- a/test/dwd_dynam.jl
+++ b/test/dwd_dynam.jl
@@ -1,7 +1,7 @@
using AlgebraicDynamics.DWDDynam
using Catlab
-using LabelledArrays
+using ComponentArrays
using DelayDiffEq
using Test
diff --git a/test/ext/AlgebraicPetri.jl b/test/ext/AlgebraicPetri.jl
index 67ba60a..c23d643 100644
--- a/test/ext/AlgebraicPetri.jl
+++ b/test/ext/AlgebraicPetri.jl
@@ -3,7 +3,7 @@ using AlgebraicPetri
using Catlab
using Test
using AlgebraicDynamics.UWDDynam
-using LabelledArrays
+using ComponentArrays
@testset "AlgebraicPetri" begin
@@ -21,18 +21,19 @@ using LabelledArrays
@test nstates(rs) == 1
@test nports(rs) == 1
@test portmap(rs) == [1]
- u = LVector(foo=1.0)
- p = LVector(bar=2.0)
- @test eval_dynamics(rs, u, p, 0) == [2.0]
+ u = ComponentArray(foo=1.0)
+ p = ComponentArray(bar=2.0)
+ @test eval_dynamics(rs, u, p, 0) == ComponentArray(foo=2.0)
+
labelled_birth_react = Open(LabelledReactionNet{Float64}{Float64}([:foo => 1.0], ((:bar => 2.0), (:foo => (:foo, :foo)))))
rs = ContinuousResourceSharer{Float64}(labelled_birth_react)
@test nstates(rs) == 1
@test nports(rs) == 1
@test portmap(rs) == [1]
- u = LVector(NamedTuple(zip(snames(apex(labelled_birth_react)), Vector(subpart(apex(labelled_birth_react), :concentration)))))
- p = LVector(bar=2.0)
- @test eval_dynamics(rs, u, p, 0) == [2.0]
+ u = ComponentArray(NamedTuple(zip(snames(apex(labelled_birth_react)), Vector(subpart(apex(labelled_birth_react), :concentration)))))
+ p = ComponentArray(bar=2.0)
+ @test eval_dynamics(rs, u, p, 0) == ComponentArray(foo=2.0)
Brusselator = LabelledPetriNet([:A, :B, :D, :E, :X, :Y],
:t1 => (:A => (:X, :A)),
diff --git a/test/ext/DelayDiffEq.jl b/test/ext/DelayDiffEq.jl
index 72a6392..791413f 100644
--- a/test/ext/DelayDiffEq.jl
+++ b/test/ext/DelayDiffEq.jl
@@ -2,7 +2,7 @@ using AlgebraicDynamics
using Catlab
using DelayDiffEq
using Test
-
+using ComponentArrays
# DWDDynam Integration
######################
@@ -56,8 +56,8 @@ add_wires!(d_big, Pair[
u0 = [2.7]
x0 = [10.0]
τ = 10.0
- p = LVector(τ = τ)
-
+ p = ComponentArray(τ = τ)
+
@test eval_dynamics(delay, u0, x0, hist, p) == [0.0]
@test eval_dynamics(delay_copy, u0, x0, hist, p) == [0.0]
@@ -109,14 +109,14 @@ add_wires!(d_big, Pair[
mult_delay = DelayMachine{Float64}(1,1,1, df, delay ? delay_rf : rf)
add_delay = DelayMachine{Float64}(1,1,1, ef, delay ? delay_rf : rf)
- prob = DDEProblem(oapply(d, [mult_delay, add_delay]), u0, x0, hist, (0, 4.0), LVector(τ = 2.0))
+ prob = DDEProblem(oapply(d, [mult_delay, add_delay]), u0, x0, hist, (0, 4.0), ComponentArray(τ = 2.0))
sol1 = solve(prob, alg; dtmax = 0.1)
if delay
f = (u,h,p,t) -> [ (h(p,t - p.τ)[2] + x0[1]) * h(p,t - p.τ)[1], h(p, t - p.τ)[1] + h(p,t - p.τ)[2] ]
else
f = (u,h,p,t) -> [ (u[2] + x0[1]) * h(p,t - p.τ)[1], u[1] + h(p,t - p.τ)[2] ]
end
- prob = DDEProblem(f, u0, hist, (0, 4.0), LVector(τ = 2.0))
+ prob = DDEProblem(f, u0, hist, (0, 4.0), ComponentArray(τ = 2.0))
sol2 = solve(prob, alg; dtmax = 0.1)
@test last(sol1) == last(sol2)
end
@@ -324,8 +324,8 @@ const UWD = UndirectedWiringDiagram
1, 1, 1, dxdt_delay, (u,h,p,t) -> [[u[1], h(p, t - p.n)[1]]])
rm_model = oapply(c, [mosquito_delay_model, human_delay_model])
- params = LVector(a = 0.3, b = 0.55, c = 0.15,
- g = 0.1, n = 10, r = 1.0/200, m = 0.5)
+ params = ComponentArray(a = 0.3, b = 0.55, c = 0.15,
+ g = 0.1, n = 10, r = 1.0/200, m = 0.5)
u0_delay = [0.09, .01, 0.3]
tspan = (0.0, 365.0*5)