You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement this simple multigroup model using AlgebraicPetri, and (probably due to my lack of understanding), have run into issues.
Firstly, when I use typed_product, my recovery rate disappears. How do I keep it in my stratified model?
Secondly, how can I set/access the rates and concentrations in a combined model? As is, concentrations and rates throws an error, as the keys are tuples rather than symbols.
using AlgebraicPetri
using AlgebraicPetri.TypedPetri
using Catlab.Programs
using Catlab.Graphics
using Catlab.CategoricalAlgebra
using Catlab.WiringDiagrams
using GraphViz
using LabelledArrays
using OrdinaryDiffEq
using Plots
display_uwd(ex) =to_graphviz(ex, box_labels=:name, junction_labels=:variable, edge_attrs=Dict(:len=>".75"));
infectious_ontology =LabelledPetriNet(
[:Pop],
:infect=> ((:Pop, :Pop)=>(:Pop, :Pop)),
:disease=> (:Pop=>:Pop),
:strata=> (:Pop=>:Pop)
)
sir_relation =@relation () where {(S::Pop, I::Pop, R::Pop)} begininfect(S, I, I, I)
disease(I, R)
enddisplay_uwd(sir_relation)
sir_model =oapply_typed(infectious_ontology, sir_relation, [:infection, :recovery])
sir_model =add_params(sir_model,
Dict(:S=>0.99, :I=>0.01, :R=>0.0),
Dict(:infection=>0.5, :recovery=>0.25))
sir_pn =dom(sir_model)
sir_prob =ODEProblem(vectorfield(sir_pn), concentrations(sir_pn), (0.0, 40.0), rates(sir_pn))
sir_sol =solve(sir_prob, Rosenbrock32())
plot(sir_sol)
risk_relation =@relation () where {(H::Pop, L::Pop)} begininfect(H, H, H, H)
infect(L, L, L, L)
infect(H, L, H, L)
infect(L, H, L, H)
end
risk_model =oapply_typed(infectious_ontology, risk_relation, [:infect_hh, :infect_ll, :infect_hl, :infect_lh])
risk_model =add_params(risk_model,
Dict(:H=>500.0, :L=>500.0),
Dict(:infect_hh=>1.0, :infect_ll=>1.0, :infect_hl=>1.0, :infect_lh=>1.0))
sir_model =add_reflexives(sir_model, [[:strata], [:strata], [:strata]], infectious_ontology)
risk_model =add_reflexives(risk_model, [[:strata], [:strata]], infectious_ontology)
sir_risk =typed_product(sir_model, risk_model)
sir_risk_pn =dom(sir_risk)
sir_risk_pn
The text was updated successfully, but these errors were encountered:
It looks like the stratification API is new, I'm not 100% clear on what all the arguments for pairwise_id_typed_petri are doing. I'd also be interested to hear what @mehalter suggests is the best approach.
Hi @mehalter!
I'm trying to implement this simple multigroup model using AlgebraicPetri, and (probably due to my lack of understanding), have run into issues.
typed_product
, my recovery rate disappears. How do I keep it in my stratified model?concentrations
andrates
throws an error, as the keys are tuples rather than symbols.The text was updated successfully, but these errors were encountered: