Skip to content

Conversation

@jack-champagne
Copy link
Member

@jack-champagne jack-champagne commented Jan 16, 2026

This pull request introduces a new linear constraint for time consistency, improves trajectory validation, and streamlines how time progression is enforced in trajectory optimization problems. The main changes are the addition of the TimeConsistencyConstraint for enforcing the relationship between time and timestep variables, automatic addition of time consistency constraints when appropriate, and removal of the old TimeIntegrator integrator in favor of the new constraint-based approach. There are also improvements to documentation and performance optimizations in the solver.

New time consistency constraint and integration:

  • Added TimeConsistencyConstraint as a new linear constraint to enforce t_{k+1} = t_k + Δt_k when both time and timestep variables are present in the trajectory. This replaces the previous TimeIntegrator integrator and is now the recommended way to ensure time progression consistency.
  • Automatically adds TimeConsistencyConstraint (and initial time constraint) to the trajectory if both :t and the timestep variable are present, via get_trajectory_constraints.
  • Integrated TimeConsistencyConstraint into the IPOPT solver so that the constraint is properly added to the optimization problem.

Validation and safety improvements:

  • In DirectTrajOptProblem, if a trajectory has a timestep variable but no bounds, a default lower bound of 0 is automatically added to prevent negative timesteps, with a user warning and recommendation for explicit bounds.

Codebase maintenance and documentation:

  • Removed the obsolete TimeIntegrator integrator and its related code, which has been superseded by the new constraint. [1] [2]
  • Added a comprehensive CONTEXT.md file documenting the package's architecture, abstractions, and common patterns for maintainers and contributors.
  • Minor improvements such as increasing the iteration count for symmetry constraint tests and adding multi-variable terminal objective documentation. [1] [2]
  • Documented and summarized performance optimizations in the IPOPT evaluator.

These changes improve the reliability and maintainability of time-related constraints in trajectory optimization workflows.

aarontrowbridge and others added 23 commits October 31, 2025 16:49
…d clarity

- Updated integrators to accept NamedTrajectory as a parameter, allowing for better access to trajectory dimensions and components.
- Modified test_integrator function to utilize NamedTrajectory for state dimension retrieval and KnotPoint creation.
- Adjusted jacobian_structure and hessian_structure functions across integrators to align with the new trajectory structure.
- Refined the BilinearIntegrator, DerivativeIntegrator, TimeDependentBilinearIntegrator, and TimeIntegrator to replace vector indices with symbolic names for components.
- Enhanced the IpoptEvaluator to create dynamics from integrators at evaluation time, improving modularity.
- Updated DirectTrajOptProblem to store integrators directly, removing the previous dynamics structure.
- Ensured all relevant tests are updated to reflect these changes, maintaining functionality and correctness.
… simplicity and consistency across the codebase
…ces once for improved performance and clarity
…nd performance; update test cases for consistency
- Refactor trajectory data extraction in `TrajectoryDynamics` to separate trajectory and global data.
- Update `NamedTrajectory` wrapping to utilize extracted trajectory data for improved performance.
- Introduce `NonlinearKnotPointConstraint` for applying nonlinear constraints at specific knot points in trajectories.
- Implement methods for evaluating constraints, Jacobians, and Hessians for `NonlinearKnotPointConstraint`.
- Add tests for `NonlinearKnotPointConstraint` covering single and multiple variable scenarios, including inequality and equality constraints.
- Ensure compatibility with existing trajectory dynamics and solvers by updating constraint evaluation methods.
- Updated KnotPointObjective to streamline constructor and improve documentation.
- Enhanced MinimumTimeObjective to clarify its purpose and improve gradient calculations.
- Refined QuadraticRegularizer to optimize gradient and Hessian computations, ensuring proper handling of trajectory components.
- Changed DirectTrajOptProblem to use AbstractObjective instead of Objective for better abstraction.
- Modified IpoptEvaluator to accommodate the new AbstractObjective interface and improve Hessian evaluations.
- Adjusted test utilities to include bounds for the timestep variable in the bilinear dynamics example.
…nt for trajectory constraints

- Implemented NonlinearGlobalKnotPointConstraint to handle constraints at individual knot points with global parameters.
- Added functionality for evaluating constraint values, Jacobians, and Hessians for both global and knot point constraints.
- Introduced constructors for both constraints to accommodate varying numbers of variables and parameters.
- Enhanced the existing NonlinearKnotPointConstraint with support for multiple variables, including separate and concatenated arguments.
- Included extensive documentation and examples for both constraint types.
- Added unit tests to verify the correctness of the new implementations and their integration with existing trajectory functionalities.
- Updated `BoundsConstraint`, `EqualityConstraint`, `SymmetryConstraint`, and `TotalConstraint` to use variable names instead of indices.
- Enhanced documentation for constraints, detailing fields and usage.
- Modified constructors to handle both scalar and vector values for bounds and equality constraints.
- Improved the application of constraints in the `IpoptSolverExt` and `constraints.jl` files to accommodate the new structure.
- Added tests for various constraints to ensure functionality and correctness.
…raints and integrators

- Removed unused Hessian functions and preallocated matrices in various objective types.
- Updated `hessian_structure` methods to return sparse matrices instead of tuples.
- Introduced a `CommonInterface` module to standardize evaluation and Jacobian/Hessian computations for integrators and constraints.
- Modified integrator and constraint evaluations in the Ipopt solver to utilize the new common interface.
- Enhanced the `TerminalObjective` constructor for better usability.
- Cleaned up the code for clarity and efficiency, ensuring consistent handling of Hessians across objectives.
… IpoptEvaluator for performance with pre-computed offsets and multi-threading; enhance trajectory cache updates; add validation for timestep bounds in DirectTrajOptProblem; implement efficient value filling for Jacobian and Hessian
…ptProblem to prevent negative values during optimization
@jack-champagne jack-champagne force-pushed the feature/multi-component-terminal-objective branch 2 times, most recently from 94294a7 to 0fbd761 Compare January 16, 2026 18:13
@jack-champagne jack-champagne merged commit 5c44067 into main Jan 16, 2026
7 of 9 checks passed
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.

3 participants