Repository navigation
feat(models): more problems in the ModelingToolkit modeling (#308) - #451
Merged
Merged
Conversation
A bounded state (two path constraints), boundary conditions, a Lagrange cost. Passes the continuous comparison with OptimalControl and the smoke solve. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nts compared in order (#308) A state with tunable = true has a free initial value in Corleone: prepare starts it from the state guess of the problem, as it does for the controls. The initial guess is indexed in the order of the components of the OptimalControl model, so the equivalence test now compares the components in order, not as sets. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Four states with the last two free at the initial time, a force that depends on the time, a bounded control. Passes the continuous comparison with OptimalControl and the smoke solve. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A Mayer cost and boundary conditions on two of the three states. Passes the continuous comparison with OptimalControl and the smoke solve. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
States named x and v, a polynomial road, a Lagrange cost. Passes the continuous comparison with OptimalControl and the smoke solve. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ws on one expression (#308) The comparison evaluated the models at 0, 25, 50, 75 and 100 % of the interval: for bioreactor, whose light has a period of 10 on [0, 200], the light was 0 at every point, and a wrong light term passed. Two irregular fractions are added (0.137, 0.618); changing the light of the ModelingToolkit model now fails the dynamics check. The ModelingToolkit reader merges the one-sided rows on the same expression (l <= h, h <= u) into one two-sided row, as OptimalControl writes l <= h <= u: the box of the initial state of bioreactor. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A free initial state in a box, a state lower bound, a bounded control, and a light that depends on the time periodically (floor, ifelse). Passes the continuous comparison with OptimalControl and the smoke solve; the comparison fails when the light or a bound of the initial box is changed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merged
3 of 5 tasks
ocots
marked this pull request as ready for review
November 19, 2026 20:30
16 of 53 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #308. Applied conventions:
ct-conventions v0.14.0,ct-agents v0.5.0(the rules added in v0.13 and v0.14 do not concern the files of this pull request).Writes more of the problems of the collection in the ModelingToolkit modeling, one at a time: each problem is written, tested against the OptimalControl model (continuous comparison, API, smoke solve) and committed before the next one. The decision to write more problems this way is taken in #308 (the reasons for the earlier differences are in this comment).
Method
For each problem:
ext/ModelingToolkitModels/<problem>.jl, in the order of the components of the OptimalControl model (the initial guess is indexed by it), with no initial guess in the file ([Metadata] Shared initial guess in the metadata, read by every modeling #377);ModelingToolkit=:validto its:status(the other metadata are left as they are);Pkg.test(; test_args=["ModelingToolkit", "problem=<problem>"])(andcorefor the metadata);Order: first the problems we already have, then the problems of SciML's catalogue we do not have, which will be added to the OptimalControl and JuMP modelings too, later.
Problems
Fixed final time, no variable (the ones the comparison reads today):
beamdouble_oscillator(two states with a free initial value, a force that depends on the time)chain(a Mayer cost)electric_vehicle(states namedxandv)bioreactor(initial states free in a box, a light that depends on the time periodically;:validin OptimalControl and JuMP only)Free final time or a variable, left to a follow-up pull request, which applies the reduced-time convention tried on
mountain_carin #452:balanced_field,brachistochrone,dielectrophoretic_particle,ducted_fan,glider,moonlander,mountain_car,robot,rocket,space_shuttle,steering,insurance,cart_pendulum.Changes to the tests
tunable = truehas a free initial value in Corleone:preparestarts it from the state guess of the problem, as it does for the controls (state_start).bioreactor. The models were evaluated at 0, 25, 50, 75 and 100 % of the interval; the light ofbioreactorhas a period of 10 on [0, 200], so it was 0 at every point and a wrong light term passed. Two irregular fractions are added (0.137 and 0.618) totest/common/continuous.jl, whichsuite/comparison/test_modelingsuses too. Changing the light of the ModelingToolkit model now fails thedynamicscheck.l ≤ h,h ≤ u) into one two-sided row, as OptimalControl writesl ≤ h ≤ u(the box of the initial state ofbioreactor).Test plan
Pkg.test(; test_args=["ModelingToolkit"]): 418 passed on the nine problems (test_methods41,test_modelings170,test_problem198,test_smoke9);Pkg.test(; test_args=["comparison", "*modelings*"]): 312 passed;corepasses.boundary, a wrong light failsdynamics.test ModelingToolkit backend.🤖 Generated with Claude Code