Skip to content

Add terminal constraint support to IPDDP#174

Open
astomodynamics wants to merge 5 commits intomasterfrom
feature/ipddp-terminal-constraints
Open

Add terminal constraint support to IPDDP#174
astomodynamics wants to merge 5 commits intomasterfrom
feature/ipddp-terminal-constraints

Conversation

@astomodynamics
Copy link
Copy Markdown
Owner

Summary

Add terminal constraint support to the IPDDP solver and factor duplicated CDDP/interior-point utility logic into shared helpers.

Changes

  • extend IPDDP to handle terminal equality and terminal inequality constraints in its single-shooting interior-point formulation
  • expose the terminal constraint types through the public aggregate header and update terminal constraint overrides to match the indexed constraint interface
  • add IPDDP options and solver bookkeeping needed for terminal constraint residuals, filter metrics, barrier merit evaluation, and step-size control
  • extract shared line-search, warm-start trajectory repair, constraint bookkeeping, filter maintenance, iteration printing, and max-violation logic into cddp_context_utils and interior_point_utils
  • add regression coverage for stale warm-start trajectory dimensions and terminal-inequality-only IPDDP solves

Test Plan

  • cmake --build build --target test_cddp_core
  • ctest --test-dir build -R "CDDPCoreTest\\.SolveReinitializesStaleTrajectoryDimensions" --output-on-failure

Related Issues

  • None referenced in this branch.

How to Test

  • configure a CDDP problem with solve("IPDDP")
  • add a TerminalEqualityConstraint or TerminalInequalityConstraint via addTerminalConstraint(...)
  • verify the returned solution status is acceptable and the terminal state satisfies the configured bound or equality residual
  • run cmake --build build --target test_cddp_core test_ipddp_solver
  • run ctest --test-dir build -R "CDDPCoreTest\\.SolveReinitializesStaleTrajectoryDimensions|IPDDPTest\\.SolveWithTerminalInequalityOnly" --output-on-failure

Screenshots/Videos

  • None.

Additional Notes

  • The branch also includes the shared helper extraction commit that removes duplicated CDDP and interior-point utility logic introduced during the terminal-constraint work.

Move duplicated line-search, constraint bookkeeping, and filter logic into dedicated utility files used by the core and interior-point solvers.

Add a regression test covering stale warm-start trajectory dimensions so solve() rebuilds incompatible state and control trajectories before use.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c9242f2d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the CDDP interior-point solver stack by adding terminal constraint support to IPDDP (terminal equalities + terminal inequalities) and refactors duplicated CDDP/interior-point utilities into shared helper modules.

Changes:

  • Add terminal equality/inequality constraint handling to IPDDPSolver, including new bookkeeping for residuals, filter metrics, merit evaluation, and step-size control.
  • Extract shared CDDP context utilities (line-search alphas, warm-start trajectory shaping, constraint add/remove) and shared interior-point filter/printing helpers.
  • Add regression tests for stale warm-start trajectory dimensions and terminal-inequality-only IPDDP solves, plus tighten an existing IPDDP regression assertion.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/cddp_core/ipddp_solver.cpp Major solver changes: terminal constraint support + refactor to shared interior-point helpers
include/cddp-cpp/cddp_core/ipddp_solver.hpp New solver state for terminal constraints, filter metrics, and forward-pass failure handling
include/cddp-cpp/cddp_core/options.hpp Expands IPDDP options surface (new knobs for filter/barrier/warmstart, etc.)
include/cddp-cpp/cddp_core/terminal_constraint.hpp Updates terminal constraint overrides to match indexed constraint interface
src/cddp_core/msipddp_solver.cpp Refactor to shared interior-point utils (filter, printing, max-violation)
src/cddp_core/interior_point_utils.hpp/.cpp New shared interior-point helper implementations
src/cddp_core/cddp_core.cpp Refactor duplicated logic to cddp_context_utils helpers
src/cddp_core/cddp_context_utils.hpp/.cpp New shared helpers for line-search alphas, trajectory shaping, and constraint bookkeeping
tests/cddp_core/test_ipddp_solver.cpp Adds terminal-inequality-only regression test + strengthens an existing SolveCar check
tests/cddp_core/test_cddp_core.cpp Adds regression test ensuring stale trajectory dimensions are repaired on solve
include/cddp-cpp/cddp.hpp Exposes terminal constraints via aggregate public header
CMakeLists.txt Adds new helper .cpp files to the core library sources

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Avoid dereferencing empty linearized dynamics arrays in the
zero-horizon rollout helper.

This keeps IPDDP initialization and helper paths safe when no
linearized stages are present.
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