-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem wiring a simple SEIR model #7
Comments
It looks like you specified it right. I'm digging in now. |
I do not know why this fixed it, but this code makes the correct answer. using AlgebraicPetri,AlgebraicPetri.TypedPetri
using Catlab, Catlab.CategoricalAlgebra, Catlab.Programs
using Catlab.WiringDiagrams, Catlab.Graphics
using AlgebraicDynamics.UWDDynam
using Catlab.Graphics.Graphviz
epi_transitions = LabelledPetriNet(
[:Pop],
:infection=>((:Pop, :Pop)=>(:Pop, :Pop)),
:progression=>(:Pop=>:Pop),
:recovery=>(:Pop=>:Pop)
)
seir_uwd = @relation () where (S::Pop, I::Pop, E::Pop, R::Pop) begin
infection(S, I, E, I)
progression(E, I)
recovery(I, R)
end
to_graphviz(seir_uwd, box_labels=:name, junction_labels=:variable)
seir_acst = oapply_typed(epi_transitions, seir_uwd, [:β, :δ, :γ])
seir_lpn = dom(seir_acst)
Graph(seir_lpn) The change was to reorder the arguments in the UWD. seir_uwd = @relation () where **(S::Pop, I::Pop, E::Pop, R::Pop)** begin
infection(S, I, E, I)
progression(E, I)
recovery(I, R)
end The fact that this fixed it, makes me suspicious that there is a deeper bug. |
Your fix lists the symbols in the order they appear in the rules. This sounds like a bug/undocumented feature! |
Yeah, this looks like a bug. It shouldn't matter how you order the outer ports in the UWD. |
I was trying to look into this further, but the following code for drawing the UWD doesn't display labels - is this a config thing on my side? using Catlab, Catlab.CategoricalAlgebra, Catlab.Programs
using Catlab.WiringDiagrams, Catlab.Graphics
seir_uwd = @relation (S, I, E, R) begin
infection(S, I, E, I)
progression(E, I)
recovery(I, R)
end
to_graphviz(seir_uwd) |
You want to_graphviz(seir_uwd, box_labels=:name) or to_graphviz(seir_uwd, box_labels=:name, junction_labels=:variable) depending on whether you also want junction labels. |
Thanks @epatters! The UWD displays correctly (I wired to R), so it's this bit of the code where things get rewired: seir_acst = oapply_typed(epi_transitions, seir_uwd, [:β, :δ, :γ])
seir_lpn = dom(seir_acst)
Graph(seir_lpn) |
For some reason, the following code for an SEIR model wires E to R, rather than I to R. Can anyone spot where I'm going wrong?
The text was updated successfully, but these errors were encountered: