Skip to content

feat: unify box constraint source of truth and clarify dual dimension functions#300

Merged
ocots merged 5 commits intomainfrom
duals
Apr 19, 2026
Merged

feat: unify box constraint source of truth and clarify dual dimension functions#300
ocots merged 5 commits intomainfrom
duals

Conversation

@ocots
Copy link
Copy Markdown
Member

@ocots ocots commented Apr 18, 2026

Summary

This PR unifies the box constraint source of truth and clarifies dual dimension functions.

Commit 1: Unify box constraint source of truth with aliases (Option D)

  • Remove original_dict from ConstraintsModel and original_constraints() accessor
  • Add aliases::Vector{Vector{Symbol}} as 5th element in box constraint tuples
  • Extend _dedup_box_constraints! to produce aliases (all labels per component)
  • Update constraint(model, label) to resolve via aliases, return effective bounds
  • Update dual(sol, model, label) to resolve via aliases, slice per-component
  • Enforce strict dimension validation in _interpolate_from_data
  • Adapt tests to new dedup+intersection semantics and per-component dual convention

Commit 2: Rename dim_constraints_box(sol) to dim_dual_constraints_box(sol)

  • Rename functions to clarify they return dual dimension, not constraint dimension
  • Use multiple dispatch for _dual_dimension (::Nothing → 0, ::Function → length at t0)
  • Update display to check both duals and model constraints before showing
  • Add exports for new functions in OCP.jl
  • Update tests to use new function names

Tests

All 3582 tests passing.

- Remove original_dict from ConstraintsModel and original_constraints() accessor
- Add aliases::Vector{Vector{Symbol}} as 5th element in box constraint tuples
- Extend _dedup_box_constraints! to produce aliases (all labels per component)
- Update constraint(model, label) to resolve via aliases, return effective bounds
- Update dual(sol, model, label) to resolve via aliases, slice per-component
- Enforce strict dimension validation in _interpolate_from_data
- Adapt tests to new dedup+intersection semantics and per-component dual convention
- All 3582 tests passing
ocots added 3 commits April 18, 2026 22:27
…_box(sol)

- Rename functions to clarify they return dual dimension, not constraint dimension
- Use multiple dispatch for _dual_dimension (::Nothing -> 0, ::Function -> length at t0)
- Update display to check both duals and model constraints before showing
- Add exports for new functions in OCP.jl
- Update tests to use new function names
- All 89 tests passing
@ocots ocots changed the title feat: unify box constraint source of truth with aliases (Option D) feat: unify box constraint source of truth and clarify dual dimension functions Apr 18, 2026
- Add box constraint aliases section to CHANGELOG
- Add dual dimension function clarification to CHANGELOG
- Document breaking change: dim_*_constraints_box(sol) renamed to dim_dual_*_constraints_box(sol)
- Add migration guide in BREAKING.md
- Note that Model functions remain unchanged
@ocots ocots added run breakage Used to trigger breakage tests. run ci Trigger CI run documentation Trigger documentation labels Apr 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

Breakage test results
Date: 2026-04-18 21:11:09

Name Latest Stable
CTDirect compat: v0.9.14 compat: v0.9.14
CTFlows compat: v0.9.14 compat: v0.9.14
CTSolvers compat: v0.9.14 compat: v0.9.14
OptimalControl compat: v0.9.14 compat: v0.9.14

@ocots ocots merged commit 81d5e69 into main Apr 19, 2026
64 checks passed
@ocots ocots deleted the duals branch April 19, 2026 12:02
@ocots ocots mentioned this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run breakage Used to trigger breakage tests. run ci Trigger CI run documentation Trigger documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant