Skip to content

Conversation

astomodynamics
Copy link
Owner

@astomodynamics astomodynamics commented Jul 23, 2025

Summary

  • Add optional int index parameter (default 0) to all virtual methods in base Constraint class
  • Update all derived constraint classes to implement the new interface
  • Maintain backward compatibility with default parameter values
  • Align Constraint API with existing Objective class pattern for time-varying constraints

Changes Made

  • Base Constraint class: Added int index = 0 parameter to virtual methods:

    • evaluate()
    • getStateJacobian()
    • getControlJacobian()
    • computeViolation()
    • getStateHessian()
    • getControlHessian()
    • getCrossHessian()
    • Updated utility methods getJacobians() and getHessians() to pass index parameter
  • All derived classes updated:

    • ControlBoxConstraint
    • StateBoxConstraint
    • LinearConstraint
    • ControlConstraint
    • StateConstraint
    • BallConstraint
    • PoleConstraint
    • SecondOrderConeConstraint
    • ThrustMagnitudeConstraint
    • MaxThrustMagnitudeConstraint

Test plan

  • Verify all constraint classes compile without errors
  • Run existing tests to ensure backward compatibility
  • Test that constraints can be called with and without index parameter
  • Verify no performance regression from default parameter addition

- Add optional int index parameter (default 0) to all virtual methods in base Constraint class
- Update all derived constraint classes to implement the new interface:
  * evaluate()
  * getStateJacobian()
  * getControlJacobian()
  * computeViolation()
  * getStateHessian()
  * getControlHessian()
  * getCrossHessian()
- Update utility methods getJacobians() and getHessians() to pass index parameter
- Maintain backward compatibility with default parameter values
- Align Constraint API with existing Objective class pattern for time-varying constraints
@astomodynamics astomodynamics merged commit a575fcf into master Aug 2, 2025
3 checks passed
@astomodynamics astomodynamics deleted the feature/constraint-api-index-parameter branch August 2, 2025 04:16
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.

1 participant