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

Support for continuous or hybrid Petri nets? #179

Open
sdwfrost opened this issue Oct 7, 2024 · 3 comments
Open

Support for continuous or hybrid Petri nets? #179

sdwfrost opened this issue Oct 7, 2024 · 3 comments

Comments

@sdwfrost
Copy link

sdwfrost commented Oct 7, 2024

Any plans or thoughts on implementing continuous or hybrid Petri nets? The ACSet data structure for continuous Petri nets would be the same (mostly) to the current implementation. For hybrid, would one want to have separate tables for continuous and discrete states, or just have an attribute added to the variables?

@jpfairbanks
Copy link
Member

Is that where the arrows have fractional multiplicities? You could encode that onto our SITO schema by using one input or output arrow and then having an attribute with type Rational, Real, or Float64 to store the multiplicity. We are currently using multiple arrows to encode the multiplicity, which only gives you Nats for the multiplicities.

@present SchPetriNet(FreeSchema) begin
  T::Ob
  S::Ob
  I::Ob
  O::Ob

  it::Hom(I, T)
  is::Hom(I, S)
  ot::Hom(O, T)
  os::Hom(O, S)
end

You could inherit from SchPetriNet like this:

@present SchMultNet <: SchPetriNet begin
  Mult::AttrType
  
  # multiplicity of input arcs
  im::Attr(I, Mult)
  # multiplicity of output arcs
  om::Attr(O, Mult)
end

You can't express the constraint that for a pair (s::S, t::T) you have at most 1 I or O element. That constraint requires more logical power than ACSets can provide. I think you would need to have your schemas be finite limit sketches to express that constraint. But your interpreter for MultNets could check the condition as a plain julia function that looks for repeated edges.

If you want to segregate your state variables into two types of variables, you can use slice categories. https://royalsocietypublishing.org/doi/10.1098/rsta.2021.0309 section 3 explains how to use slice categories to encode constraints on the variables of a petri net. We motivate it with host-vector models. But, you could use that technique to encode continuous vs discrete states.

@sdwfrost
Copy link
Author

sdwfrost commented Oct 7, 2024

What I really meant is the type of the state variable (continuous/real or discrete/integer), though the fractional multiplicity is useful in other contexts. Thanks for the pointer to slice categories - I'd have to think how to get the lowered representation to understand the difference in treatment of these.

@jpfairbanks
Copy link
Member

If you just want to store the state type on each variable and there are no constraints for what kinds of processes can connect what types of variables, then you can just add an attribute DType or Domain or something. If only need the slice categories if you want to put constraints on the kinds of processes that can interact with the kinds of states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants