Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@FreyJo
Copy link
Member

@FreyJo FreyJo commented Mar 14, 2025

This PR adds the option to scale the cost and constraints of QPs.
In particular, the following options have been added:

  • qpscaling_scale_constraints: String in ["NO_OBJECTIVE_SCALING", "OBJECTIVE_GERSHGORIN"]
    Default: "NO_OBJECTIVE_SCALING".
    - NO_OBJECTIVE_SCALING: no scaling of the objective
    - OBJECTIVE_GERSHGORIN: estimate max. abs. eigenvalue using Gershgorin circles as max_abs_eig, then sets the objective scaling factor as obj_factor = min(1.0, qpscaling_ub_max_abs_eig/max_abs_eig)

  • qpscaling_scale_constraints
    String in ["NO_CONSTRAINT_SCALING", "INF_NORM"]
    Default: "NO_CONSTRAINT_SCALING".
    - NO_CONSTRAINT_SCALING: no scaling of the constraints
    - INF_NORM: scales each constraint except simple bounds by factor 1.0 / max(inf_norm_coeff, inf_norm_constraint_bound), such that the inf-norm of the constraint coefficients and bounds is <= 1.0.
    Slack penalties are adjusted accordingly to get an equivalent solution.
    First, the cost is scaled, then the constraints.

Implementation details

Minimal computational overhead is associated with the new scaling, in case it is not used. The implementation avoids copying values from the different data structures if they are the same and aliases pointers instead.

Examples & Tests:

  • equivalence of primal and dual solutions is tested on different examples including slack variables and one-sided constraints
  • some tests were added, showcasing examples which cannot be solved without scaling the QP.

Limitations

  • Real-time iterations, i.e. RTI and AS-RTI variants with split preparation and feedback phase are not compatible with QP scaling yet. Work on this has been started at WIP: QP scaling for RTI FreyJo/acados#76 but is not a priority right now.
  • Computation of solution sensitivities is not compatible with QP scaling yet.
  • Scaling tolerances of the QP solver is not done. Right now, the QP solver tolerances need to be set small enough, for the NLP solver to converge. A follow-up work is described in QP solver tolerance strategies #1553

@FreyJo FreyJo marked this pull request as draft March 14, 2025 13:46
@FreyJo FreyJo changed the title add QP scaling add QP scaling for cost and constraints Jun 23, 2025
@FreyJo FreyJo marked this pull request as ready for review June 23, 2025 13:21
@FreyJo FreyJo requested review from david0oo and sandmaennchen and removed request for sandmaennchen June 23, 2025 13:22
@FreyJo FreyJo merged commit 8bba4ed into acados:main Jun 25, 2025
14 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