Skip to content

feat: CasADiDynamicOptProblem #3602

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

Merged
merged 28 commits into from
May 9, 2025
Merged

feat: CasADiDynamicOptProblem #3602

merged 28 commits into from
May 9, 2025

Conversation

vyudu
Copy link
Member

@vyudu vyudu commented May 6, 2025

Requires CasADi.jl 1.0.2

@vyudu vyudu requested a review from ChrisRackauckas May 9, 2025 00:02
@vyudu vyudu closed this May 9, 2025
@vyudu vyudu reopened this May 9, 2025
@@ -28,17 +31,23 @@ const M = ModelingToolkit
jsol = solve(jprob, Ipopt.Optimizer, constructRK4, silent = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was changed to using the constructor? This would be natural as:

alg = JuMPCollocation(Ipopt.Optimizer, constructRK4())

and

alg = CasADiCollocation("ipopt", constructRK4())

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the syntax is like sol = solve(jprob, JuMPCollocation(Ipopt.Optimizer, constructRK4())?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@test ≈(jsol2.sol.u, osol2.u, rtol = 0.001)
iprob = InfiniteOptDynamicOptProblem(sys, u0map, tspan, parammap, dt = 0.01)
isol = solve(iprob, Ipopt.Optimizer,
derivative_method = InfiniteOpt.FiniteDifference(InfiniteOpt.Backward()),
silent = true) # 11.540 ms, 4.00 MiB
@test ≈(jsol2.sol.u, osol2.u, rtol = 0.001)
@test ≈(isol.sol.u, osol2.u, rtol = 0.001)
csol2 = solve(cprob, "ipopt", constructImplicitEuler, silent = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

silent isn't a common kwarg. verbose.

@ChrisRackauckas
Copy link
Member

I like it sans a few interface things, but let's merge so that the big PR is out of the way and do the little interface munging before it gets documented.

@ChrisRackauckas ChrisRackauckas merged commit c0a61ab into SciML:master May 9, 2025
66 of 90 checks passed
@vyudu vyudu deleted the casadi2 branch May 9, 2025 14:48
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

Successfully merging this pull request may close these issues.

2 participants