Skip to content
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

oapply_typed results in wrong wiring #155

Closed
sdwfrost opened this issue Jun 28, 2023 · 2 comments · Fixed by #158
Closed

oapply_typed results in wrong wiring #155

sdwfrost opened this issue Jun 28, 2023 · 2 comments · Fixed by #158
Labels
bug Something isn't working

Comments

@sdwfrost
Copy link

This simple SEIR example gives a wiring from I to R in the UWD (correct) but from E to R in the labelled Petri net.

using AlgebraicPetri,AlgebraicPetri.TypedPetri
using Catlab, Catlab.CategoricalAlgebra, Catlab.Programs
using Catlab.WiringDiagrams, Catlab.Graphics
using AlgebraicDynamics.UWDDynam


epi_transitions = LabelledPetriNet(
  [:Pop],
  :infection=>((:Pop, :Pop)=>(:Pop, :Pop)),
  :progression=>(:Pop=>:Pop),
  :recovery=>(:Pop=>:Pop)
)

seir_uwd = @relation () where (S::Pop, E::Pop, I::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)

@jpfairbanks found that changing the order to (S::Pop, I::Pop, E::Pop, R::Pop) in the @relation fixed this.

@epatters epatters added the bug Something isn't working label Jun 28, 2023
@sdwfrost
Copy link
Author

Thanks @epatters @mehalter! QQ: after I updated, Graph no longer works...has there been an API change?

@epatters
Copy link
Member

epatters commented Jul 12, 2023

Sure! This was a breaking change in the latest major release of AlgPetri for consistency with Catlab. Use to_graphviz instead.

(The reason for this change is that Graph is the name of the basic graph type exported by Catlab.Graphs.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants