Repository navigation
fix: give the path and boundary duals by label; unknown with :exa - #680
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
…lvers 0.7 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ocots
marked this pull request as ready for review
November 13, 2026 18:52
Closed
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.
First step of #672 (see the scope comment), plus the record of a change that #677 left out: the sign of the multipliers of a maximisation (below). #677 is merged, the base is
main.Conventions applied: ct-conventions v0.13.0, ct-agents v0.5.0.
Why
With CTModels 0.21.1 (#677), every solve printed the deprecation warning of
path_constraints_dual/boundary_constraints_dual(49 times in the test suite): a user of OptimalControl saw it on everysolve.What
build_OCP_solution(src/DOCP_data.jl)::adnlp: the path and boundary multipliers are given by label,duals=Dict(label => value), split withCTModels.Models.constraint_rows(path: the columns of the label, after the division by the time step as before; boundary: a number for one row, a vector otherwise). The values read withdual(sol, ocp, :label)are unchanged.:exa: its getter does not return these multipliers yet (Keep the :exa constraint handles by label and return the path/boundary multipliers by label CTParser.jl#414). Instead ofzeros, nothing is given: the labels are unknown anddualthrows aPreconditionError, whose message is the noteinfos[:missing_duals](CTParser#414, and the:adnlpmodeler as workaround). User-visible: recorded as a bug fix and a near-breaking note inBREAKING.md.Project.toml:CTModels = "0.21.1", the first version withduals=.Plots of an
:exasolution: the CTModels case layer reads the duals throughhas_dualonly, so the path constraints are drawn without their duals (checked in the test with the backend-agnosticCTModels.PlotCase.build_figure).Tests
test/ci/test_duals.jl, a problem with a path label of one row (active), one of two rows, two boundary labels and a control box::adnlp:@test_nowarnon the solve;dualfor each label equals the rows of the stacked duals;:exa:@test_nowarn; path and boundary labels unknown,PreconditionErrorcarrying the note; the box dual still known; the figure is built.Local results (with
--depwarn=yes)::exathe duals present and no exception), so the tests do catch the change;The sign of a maximisation, left out of #677
#677 said "no breaking changes", which was wrong for one case. CTSolvers 0.7 returns the multipliers of the equivalent minimisation, and CTDirect passes them on. Measured on one problem, written as
min ∫u²andmax -∫u²(:adnlp, Ipopt), CTSolvers 0.5.8 against 0.7.0:maxagainstminmaxagainstminminRecorded as near-breaking (maintainer's decision: the API is unchanged and CTSolvers documents the change): a note with a migration block in
BREAKING.md, a line in theCHANGELOG.mddependencies, and the compatibility footer updated. Not measured: the box duals (the box was inactive in the problem), and whether the convention matches what CTModels expects for the costate of amaxproblem.Out of scope
The
:exaduals by label (step 2, CTParser#414); the box duals (#639); the docs (#660).🤖 Generated with Claude Code