AlgebraicJulia / ASKEM-demos

6 stars 1 forks source link

Stratification groups via data migration #22

Closed epatters closed 1 year ago

epatters commented 1 year ago

This may not get used for the demo, but I wanted to show how it works. I wasn't sure where to put the notebook, so feel free to move it somewhere else.

jpfairbanks commented 1 year ago

This is pretty cool @epatters, can you explain the arg1, arg2 syntax in the migration macro?

group_migration = @migration SchLabelledPetriNet SchLabeledSet begin
  S => S
  T => @product (s1::S; s2::S)
  (I, O) => @cases begin
    arg1 => @product (s1::S; s2::S)
    arg2 => @product (s1::S; s2::S)
  end
  (is, os) => begin
    arg1 => s1
    arg2 => s2
  end
  (it, ot) => begin
    arg1 => (s1 => s1; s2 => s2)
    arg2 => (s1 => s1; s2 => s2)
  end

  Name => Label
  sname => label
  tname => s1 ⋅ label # XXX: Should use both labels.
end;
  1. What is the arg1/arg2 thing?
  2. What would it take to fix the # XXX?
  3. We need to color the transitions based on the types in a typed petri net in order to do the stratification, can we calculate the typing with this too?
epatters commented 1 year ago
  1. Maybe I should have called them arc1 and arc2, but either way, these represent the two input arcs and two output arcs for each transition, which in this example are "infection-type transitions".
  2. This should be something like Symbol("$(label(s1))_$(label(s2))"). To support that, I need to implement https://github.com/AlgebraicJulia/Catlab.jl/issues/577. That's probably the most important outstanding feature for data migration. It shouldn't be too much work. I just need to figure out a coherent syntax for it and make time to actually implement it.
  3. I need to give that more thought, but there are several possible strategies, such as extending data migration to work with slices (it's mostly just limits and colimits) or transforming the acset transformations into acsets themselves and doing data migration into those.
olynch commented 1 year ago

This looks awesome! See @kris-brown, I knew we'd learn something cool by thinking about the general form of the problem you were trying to solve.

epatters commented 1 year ago

Sounds good, I leave that to whoever is managing this repo.