-
-
Notifications
You must be signed in to change notification settings - Fork 38
Remove ModelingToolkit and Catalyst dependencies from SDE and Jump problem libraries #155
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
Conversation
…ompilation This PR rewrites the ModelingToolkit-dependent example problems to use direct ODE function definitions instead of symbolic computation, which significantly improves compilation speed and eliminates circular dependency issues. ## Changes Made - **Removed ModelingToolkit dependency**: Eliminated ModelingToolkit from dependencies in Project.toml - **Rewritten ODE problems**: Converted all symbolic ODE definitions to direct function definitions - **Maintained API compatibility**: All problem exports remain the same - **Preserved problem accuracy**: Same initial conditions, parameters, and mathematical formulations ## Problems Rewritten ### ode_simple_nonlinear_prob.jl - Van der Pol equations (prob_ode_vanderpol, prob_ode_vanderpol_stiff) - ROBER biochemical reactions (prob_ode_rober) - Rigid body equations (prob_ode_rigidbody) - Hires problem (prob_ode_hires) - Orego problem (prob_ode_orego) ### strange_attractors.jl - Thomas cyclically symmetric attractor (prob_ode_thomas) - Lorenz equations (prob_ode_lorenz) - Aizawa equations (prob_ode_aizawa) - Dadras equations (prob_ode_dadras) - Chen equations (prob_ode_chen) - Rössler equations (prob_ode_rossler) - Rabinovich-Fabrikant equations (prob_ode_rabinovich_fabrikant) - Sprott equations (prob_ode_sprott) - Hindmarsh-Rose equations (prob_ode_hindmarsh_rose) ## Benefits - **Faster compilation**: No symbolic computation overhead - **Eliminated circular dependencies**: No more ModelingToolkit → DiffEqCallbacks → ODEProblemLibrary → ModelingToolkit cycle - **Reduced dependency footprint**: Fewer dependencies to install and manage - **Better test reliability**: No more precompilation failures due to circular dependencies ## Testing - All tests pass (Aqua.jl quality assurance) - All rewritten problems maintain correct dimensions, initial conditions, and parameters - ODE functions are callable and produce finite derivatives - Maintains backward compatibility with existing code 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…ation Fix documentation inconsistencies in Van der Pol problems that still referred to the old ModelingToolkit symbolic syntax after the conversion to direct function implementations. Changes: - Update initial condition documentation from `u_0=[x => sqrt(3), y => 0]` to `u_0=[sqrt(3), 0]` (where `u[1] = x`, `u[2] = y`) - Apply fix to both prob_ode_vanderpol and prob_ode_vanderpol_stiff - Add clarification of variable ordering: u[1] = x, u[2] = y This ensures the documentation accurately reflects the new array-based initial condition format while clearly documenting the variable ordering convention used in the direct function implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…oblem libraries ## Summary - Convert SDEProblemLibrary to remove ModelingToolkit dependency - Convert JumpProblemLibrary to remove Catalyst dependency - Replace symbolic systems with direct function implementations - Maintain mathematical equivalence and backwards compatibility ## Changes Made ### SDEProblemLibrary - Removed Catalyst dependency from Project.toml and imports - Converted `prob_sde_oscilreact` from Catalyst @reaction_network to direct drift/diffusion functions - Implemented hill function helper for regulatory dynamics - Preserved all original parameter values and initial conditions ### JumpProblemLibrary - Removed Catalyst dependency from Project.toml and imports - Converted all @reaction_network definitions to direct jump rate functions - Implemented proper mass action kinetics with binomial coefficients for higher order reactions - Created state change vectors (nu matrices) for each reaction network - Updated JumpProblemNetwork structure to store jump functions and state changes - Converted complex networks including: - DNA repressor model (6 reactions) - Birth-death process (2 reactions) - Nonlinear reactions with 3rd order kinetics (5 reactions) - Oscillatory system with hill functions (12 reactions) - Multistate model (18 reactions, 9 species) - Twenty gene network (programmatic construction) - DNA dimer repressor (8 reactions) - Diffusion network (parameterized for arbitrary lattice sizes) ## Testing - Verified all SDE problems work with StochasticDiffEq.jl - Verified all Jump problems compute correct reaction rates - Confirmed hill function implementations are mathematically equivalent - Ensured backwards compatibility with existing ODE problems 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Added these packages to test the converted SDE and Jump problems work correctly without ModelingToolkit/Catalyst dependencies.
@isaacsas are you okay with converting JumpProblemLibrary away from Catalyst? Is there anything needed in here, like the generation of the connection graphs? I might split the SDE part from this PR since that's simpler |
You’ll lose automatic creation of the appropriate jump type and generation of all the various dependency graphs. I don’t see that MassActionJumps are now being created anywhere? Is this just for leaping? |
We will lose the automatic creation, but I'm wondering if for JumpProcess tests it can make sense to hardcode it. I'll make it use MassActionJumps, but no this would be for both jump forms. It would just have to hardcode more things instead of using catalyst to do it. At least for SDEs it makes sense to drop some dependencies and make the test precompiles much faster, but I am not sure about with jump processes, but it's easy enough to generate that it's good to get that as at least as a closed PR as a source of data, so just asking if you think the dependency and test time improvements outweigh no longer having these generate via Catalyst to all forms. |
We can continue this discussion in #157 |
This PR has been split into two focused PRs for easier review:
Both PRs have been updated to remove the solver package dependencies (StochasticDiffEq and JumpProcesses) from the top-level Project.toml as these should not be dependencies of the problem library itself. Closing this PR in favor of the split versions. |
Summary
This PR removes ModelingToolkit and Catalyst.jl dependencies from SDEProblemLibrary and JumpProblemLibrary by converting all symbolic systems to direct function implementations while maintaining mathematical equivalence and backwards compatibility.
Key Changes
SDEProblemLibrary
prob_sde_oscilreact
from Catalyst @reaction_network to direct drift/diffusion functionsJumpProblemLibrary
Converted Jump Problems:
Mathematical Equivalence
All conversions preserve the mathematical meaning of the original Catalyst networks:
A + B → C
becomesk * A * B
2A → B
becomesk * A * (A-1) / 2
Testing
Benefits
Backwards Compatibility
🤖 Generated with Claude Code