SciML / Catalyst.jl

Chemical reaction network and systems biology interface for scientific machine learning (SciML). High performance, GPU-parallelized, and O(1) solvers in open source software.
https://docs.sciml.ai/Catalyst/stable/
Other
454 stars 74 forks source link

supporting connections for compositional modeling #774

Open isaacsas opened 7 months ago

isaacsas commented 7 months ago

It seems like the only thing we are missing for compositional modeling to work smoothly is a notion of connections between systems, which here would really just mean aliasing that sys1.x == sys2.x, and at some point eliminating one of the two variables in the composed ReactionSystem model. I wonder if we should just reuse the MTK connection object idea, with expand_connections handling generating a system that eliminates one variable. The only issue is checking for circular definitions, but I'd imagine maybe we can hook into some of the MTK simplification functionality to make such checks?

ChrisRackauckas commented 7 months ago

The only issue is checking for circular definitions, but I'd imagine maybe we can hook into some of the MTK simplification functionality to make such checks?

That's effectively the alias elimination pass.

Yeah this sounds good. A definition of connection is required though. Maybe it's that any matching species name is matched?

isaacsas commented 7 months ago

Isn’t the default usage of connect(sys1.a, sys2.b) that they are equal (unless there is metadata that they are flow variables or such)? I was thinking we just allow these as input equations, and then add an ability to eliminate them for composed ReactionSystem models (and auto-eliminate when flattening to convert to other system types).