-
Notifications
You must be signed in to change notification settings - Fork 14
Add configurable barrier update strategies for interior point methods #144
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
Conversation
modify package for initial creation
create and test control-limited DDP
Delete DS_store
…ng (#118) This pull request introduces a series of enhancements, new features, and updates to the CDDP-related solvers and their components within the cddp-cpp project. The changes aim to improve performance, robustness, and test coverage. Key changes include: Solver Enhancements: Updated solver options in various examples (e.g., cddp_quadrotor_figure_eight_example, ipopt_cartpole.cpp) for improved convergence and performance. Refined LogDDP initialization to better handle missing system/objective functions and provide clearer error messages. Improved LogDDP solve methods with proper trajectory and gap initialization. Standardized the solver type to LogDDP in the core CDDP solve function, replacing LogCDDP for consistency. Updated rollout logic and filter acceptance criteria for enhanced performance and code readability. Refactored dual scaling initialization in ipddp_core.cpp to ensure y_i is not too small and updated constraint violation calculation to include the rp_err variable. Updated CDDP core options, including a new relaxation delta parameter and revised filter violation acceptance values. New Features: Introduced a RelaxedLogBarrier class to implement the relaxed log-barrier function for inequality constraints, providing methods for evaluation, gradient, and Hessian computation. Testing & Examples: Added test_ipddp_quadrotor to tests/CMakeLists.txt for testing quadrotor functionality. Included a new test case for a quadrotor reaching a goal state following a circular trajectory using the CDDP solver. Updated CDDP options and constraints in the SolveLogCDDP test for better performance and accuracy. Updated result images (quadrotor_figure_eight_horizontal_safe_3d.png, quadrotor_figure_eight_horizontal_safe_states.png) in results/tests. Code Maintenance: Updated comments related to propagation, cost matrices, regularization, and solving optimal control problems. Removed obsolete code for creating plot directories and extracting trajectory data.
* Update default barrier update * Update multipler initialization
* [Critical] Fixed a critical numerical bug in msddp core * Improve ipddp * Update quadrotor example * Improve logddp by introducing ldlt operation * Fix mpipddp core
This commit updates various dynamics functions across the project to accept a time parameter, enhancing the accuracy of state propagation. Key changes include: - Removed the `ipddp_feasible_core.cpp` file as it is no longer needed. - Updated examples and tests to reflect the new function signatures, ensuring consistency in how dynamics are computed. - Adjusted the CMakeLists.txt to remove the obsolete source file reference. These changes improve the flexibility and precision of the dynamics calculations in the CDDP framework.
* Add rpo monte-carlo * Change initial condition of cddp_spacecraft_rpo * Add max thrust constrainnts * rename simulation * Update simulation setting * Update cmake * Update unicycle simulation parameter * [wip] ipopt space rpo * [wip] roe sim: Validate roe dynamics and create a script * Merge remote-tracking branch 'origin/master' into monte_carlo * Fix for master banch merge * Change access specifier from private to protected for member variables in objective.hpp to enhance class inheritance and accessibility. * temp save * [wip] temp save * Update nonlinear test class * Add nonlinear spacecraft navigation exapmle * Update linear and nonlinear examples * Add extra normalization test in nonlinear dynamics * Merge remote-tracking branch 'origin/master' into monte_carlo * Refactor spacecraft dynamics to include time parameter in discrete dynamics calculations This commit modifies the spacecraft dynamics model to accept a time parameter in the `getDiscreteDynamics` function, enhancing the accuracy of state updates. Key changes include: - Updated the `SpacecraftROE` class to remove the unused state dimension and the continuous dynamics autodiff function. - Adjusted the state and control Jacobians to utilize the current argument of latitude. - Modified tests to reflect the new function signatures and ensure consistency across the dynamics calculations. These improvements enhance the precision and flexibility of the spacecraft dynamics within the CDDP framework.
* Remove plots from test * Add continuous dynamics autodiff method to SpacecraftROE This commit introduces a new method, `getContinuousDynamicsAutodiff`, to the `SpacecraftROE` class for computing continuous-time dynamics in ROE coordinates using automatic differentiation. Additionally, the state and control Jacobians have been updated to utilize this new method, enhancing the accuracy of the dynamics calculations. The changes improve the overall flexibility and precision of the spacecraft dynamics model within the CDDP framework. * Fix bug in dynamics
* Enable SNOPT solver in CMake and add example for unicycle trajectory optimization using SNOPT. Update README to include SNOPT as an optional dependency. * Add benchmark resukts
* Complete architectural refactoring of CDDP library with modular solver design * Added 7 new solver implementations: ASDDP, CLDDP, IPDDP, LogDDP, MSIPDDP, ALDDP, DBASDDP * Introduced unified CDDPOptions and CDDPSolution API * Enhanced constraint handling with proper Jacobian/Hessian support * Implemented filter line-search methods for robust convergence * Added comprehensive test suite and benchmark examples * Performance: MSIPDDP achieves 45% faster solve times than IPOPT on quadrotor benchmark * Breaking change: New API requires solver type selection via solve(SolverType) method
* Update CDDP examples to use new modular solver API
* Add Forklift dynamics model implementation * Add Forklift dynamics model to CMake build * Add unit tests for Forklift dynamics model * Format constraint.hpp * Add StateConstraint class to constraint.hpp * Add forklift parking example with IPDDP solver
* Add cmake for acados * Add acados benchmarks * Update cmake for acados * Add acados c-gen script * Add acados c-gen * Enhance IPDDP Solver with workspace optimization and second-order correction - Introduced a pre-allocated workspace structure to improve performance during backward passes. - Added methods for second-order correction and inertia checking to enhance solver robustness. - Updated backward pass logic to utilize the new workspace and handle small problem cases efficiently. - Enabled second-order correction option in solver settings for improved solution accuracy. * Remove unused methods and options from IPDDP Solver to streamline codebase - Deleted the `correctInertia`, `computeSOC`, and `backwardPassSmall` methods to simplify the solver's implementation. - Removed the `use_second_order_correction` option from the solver settings, reflecting the removal of second-order correction functionality. - Updated the backward pass logic to apply standard DDP regularization without inertia correction. * Add generated code and resources for acados examples - Updated .gitignore to include generated C code and headers for car, quadrotor, and unicycle models. - Added integration guide and various output files for the examples. - Included PDF images for documentation and solver output files. * Implement workspace optimization in MSIPDDP Solver - Introduced a pre-allocated workspace structure to enhance performance during backward passes. - Initialized workspace matrices and vectors for both backward and forward passes. - Updated backward pass logic to utilize the new workspace for efficient matrix operations and cache LDLT factorizations. - Improved handling of constraint variables and Q expansions using pre-allocated resources. * Update segment length in quadrotor benchmark for MSIPDDP options - Changed the segment length from 10 to 2 to optimize performance in the MSIPDDP solver configuration. * Update segment length in unicycle benchmark for MSIPDDP options - Changed the segment length from 10 to 5 to optimize performance in the MSIPDDP solver configuration.
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…on (#139) Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* Add solver information and options printing functionality - Introduced new methods `printSolverInfo` and `printOptions` to enhance solver output. - Updated solver options to include `print_solver_header` and `print_solver_options`. - Modified existing solvers to conditionally print solver information and options based on user settings. - Added a new image asset for documentation purposes. * Update README.md
…ethods Implement three barrier parameter update strategies for IPDDP and MSIPDDP solvers: - ADAPTIVE: Current adaptive strategy based on KKT progress (default) - MONOTONIC: Fixed reduction factor for consistent barrier decrease - IPOPT: IPOPT-style update with error threshold criterion This enhancement provides users with flexibility to choose barrier update strategies suited to their specific optimization problems while maintaining backward compatibility with the default adaptive strategy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incorrect Debug Output for Barrier Strategy
The debug output for the IPOPT barrier strategy incorrectly displays the threshold kappa_epsilon * mu_. The value of mu_ used in the debug message is the updated value, not the original value that was used in the condition check (error_k <= kappa_epsilon * mu_), making the output misleading.
src/cddp_core/ipddp_solver.cpp#L1867-L1881
cddp-cpp/src/cddp_core/ipddp_solver.cpp
Lines 1867 to 1881 in f69f891
| if (error_k <= kappa_epsilon * mu_) | |
| { | |
| double new_mu_linear = barrier_opts.mu_update_factor * mu_; | |
| double new_mu_superlinear = std::pow(mu_, barrier_opts.mu_update_power); | |
| mu_ = std::max(options.tolerance / 10.0, | |
| std::min(new_mu_linear, new_mu_superlinear)); | |
| resetFilter(context); | |
| if (options.debug) | |
| { | |
| std::cout << "[IPDDP Barrier] IPOPT update: error = " | |
| << std::scientific << std::setprecision(2) << error_k | |
| << " ≤ " << kappa_epsilon << " * μ = " << kappa_epsilon * mu_ | |
| << " → μ = " << mu_ << std::endl; | |
| } |
src/cddp_core/msipddp_solver.cpp#L2281-L2295
cddp-cpp/src/cddp_core/msipddp_solver.cpp
Lines 2281 to 2295 in f69f891
| if (error_k <= kappa_epsilon * mu_) | |
| { | |
| double new_mu_linear = barrier_opts.mu_update_factor * mu_; | |
| double new_mu_superlinear = std::pow(mu_, barrier_opts.mu_update_power); | |
| mu_ = std::max(options.tolerance / 10.0, | |
| std::min(new_mu_linear, new_mu_superlinear)); | |
| resetFilter(context); | |
| if (options.debug) | |
| { | |
| std::cout << "[MSIPDDP Barrier] IPOPT update: error = " | |
| << std::scientific << std::setprecision(2) << error_k | |
| << " ≤ " << kappa_epsilon << " * μ = " << kappa_epsilon * mu_ | |
| << " → μ = " << mu_ << std::endl; | |
| } |
BugBot free trial expires on July 22, 2025
Learn more in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
Summary
Details
This PR introduces configurable barrier parameter update strategies for the interior point methods (IPDDP and MSIPDDP). Users can now choose between:
The implementation maintains backward compatibility by keeping ADAPTIVE as the default strategy.
Test plan