Skip to content

Catalyst V15 TODO version 2 #1202

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

Closed
7 tasks done
isaacsas opened this issue Mar 26, 2025 · 11 comments
Closed
7 tasks done

Catalyst V15 TODO version 2 #1202

isaacsas opened this issue Mar 26, 2025 · 11 comments

Comments

@isaacsas
Copy link
Member

isaacsas commented Mar 26, 2025

  • Test remake
  • Update conversion into NonlinearSystems as needed for conservation law support.
  • Check docs / final doc updates?
  • Migration guide / HISTORY.md updates.
  • PR Symbolics to add flexibility so we can restore old Latex display semantics?
  • Expand Hill/MM functions during conversion. (Maybe with a kwarg that is turned on?)
  • NonlinearSystem with conservation laws (i.e. initialization equations) don't update all unknown u0s in remake unless structural_simplify is used (and in that case it only works because the non-updated species become observables).

@TorkelE @vyudu, once Vincent finishes my last set of comments on the network analysis docs I'll give the docs a last skim and we can then release.

@vyudu
Copy link
Member

vyudu commented Mar 27, 2025

I will try to get #1142 done in the next week. I figure it might just make sense to merge it with just the Catalyst updates so it can be there for v15, and hold off a bit longer on the CatalystNetworkAnalysis stuff (since I need to find the bandwidth to push it to completion...hopefully in the next couple of months).

@isaacsas
Copy link
Member Author

Maybe just reference CatalystNetworkAnalysis on the main page about network analysis / explain it is in development, and list what functionality it provides that is well tested at this point? Then later you can update the docs to include it too?

@isaacsas
Copy link
Member Author

I'd also be fine if you want to just add the docs for it into Catalyst directly and skip trying to use multidocumenter. (i.e. making our docs depend on it is fine.)

@TorkelE
Copy link
Member

TorkelE commented Apr 1, 2025

These are the PRs that are ready and which are required for v15 release (in order of merging):
#1203
#1206
#1191

After that we only got (I think)

  • Final checks of docs, history, and tests.

The remaining stuff we might consider for v15, but which probably isn't needed, is:

@isaacsas
Copy link
Member Author

isaacsas commented Apr 1, 2025

#1121 just needs some correctness tests (and updating to master). Would be cool to have, but I don't recall anything breaking in it so it could wait for 15.1.

@TorkelE
Copy link
Member

TorkelE commented Apr 1, 2025

If we think we could get one in as well without too much delay that would definitely be a bonus

@ChrisRackauckas
Copy link
Member

What's left?

@isaacsas
Copy link
Member Author

isaacsas commented Apr 6, 2025

Figuring out how to make this work when structural_simplify isn’t called:

    using ModelingToolkit, NonlinearSolve
    @variables X1 X2 X3
    @parameters k1 k2 k3 k4 Γ[1:1] = missing [guess = ones(1)]
    eqs = [
        0 ~ -k1*X1 + k2*X2 - k3*X1*X2 + (1//2)*k4*((-X1 - X2 + Γ[1])^2),
        0 ~ k1*X1 - k2*X2 - k3*X1*X2 + (1//2)*k4*((-X1 - X2 + Γ[1])^2),
        0 ~ -X1 - X2 - X3 + Γ[1]
    ]
    initeqs = [Γ[1] ~ Initial(X1) + Initial(X3) + Initial(X2)]
    @named nlsys = NonlinearSystem(eqs, [X1, X2, X3], [k1, k2, k3, k4, Γ]; 
        initialization_eqs = initeqs)

    u0 = [:X1 => 1.0, :X2 => 2.0, :X3 => 3.0]
    ps = [:k1 => 0.1, :k2 => 0.2, :k3 => 0.3, :k4 => 0.4]
    
    # WITHOUT structural_simplify
    nlsys1 = complete(nlsys)
    nlprob1 = NonlinearProblem(nlsys1, u0, ps)

    # these pass
    @test nlprob1[:X1] == 1.0
    @test nlprob1[:X2] == 2.0
    @test nlprob1[:X3] == 3.0
    @test nlprob1.ps[][1] == 6.0
    integ1 = init(nlprob1, NewtonRaphson())
    @test integ1[:X1] == 1.0
    @test integ1[:X2] == 2.0
    @test integ1[:X3] == 3.0
    @test integ1.ps[][1] == 6.0

    nlprob1 = remake(nlprob1; u0 = [:X3 => nothing], p = [ => [4.0]])
    @test nlprob1[:X1] == 1.0   # pass
    @test nlprob1[:X2] == 2.0   # pass
    @test nlprob1[:X3] == 1.0   # fails as still 3.0
    @test nlprob1.ps[][1] == 4.0 # pass
    integ1 = init(nlprob1, NewtonRaphson())
    @test integ1[:X1] == 1.0  # pass
    @test integ1[:X2] == 2.0  # pass
    @test integ1[:X3] == 1.0  # fails
    @test integ1.ps[][1] == 4.0 # pass

    # WITH structural_simplify
    nlsys2 = structural_simplify(nlsys)
    nlprob2 = NonlinearProblem(nlsys2, u0, ps)

    # these pass
    @test nlprob2[:X1] == 1.0
    @test nlprob2[:X2] == 2.0
    @test nlprob2[:X3] == 3.0
    @test nlprob2.ps[][1] == 6.0
    integ2 = init(nlprob2, NewtonRaphson())
    @test integ2[:X1] == 1.0
    @test integ2[:X2] == 2.0
    @test integ2[:X3] == 3.0
    @test integ2.ps[][1] == 6.0

    nlprob2 = remake(nlprob2; u0 = [:X3 => nothing], p = [ => [4.0]])
    @test nlprob2[:X1] == 1.0   # pass
    @test nlprob2[:X2] == 2.0   # pass
    @test nlprob2[:X3] == 1.0   # pass
    @test nlprob2.ps[][1] == 4.0 # pass
    integ2 = init(nlprob2, NewtonRaphson())
    @test integ2[:X1] == 1.0  # pass
    @test integ2[:X2] == 2.0  # pass
    @test integ2[:X3] == 1.0  # pass
    @test integ2.ps[][1] == 4.0 # pass

@isaacsas
Copy link
Member Author

isaacsas commented Apr 6, 2025

And waiting on the DelayedParentScope fix.

@TorkelE
Copy link
Member

TorkelE commented Apr 7, 2025

There is also SciML/ModelingToolkit.jl#3529 which it would be good to have done as well.

@isaacsas
Copy link
Member Author

Close by #1232

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

4 participants