-
Notifications
You must be signed in to change notification settings - Fork 302
add QP scaling for cost and constraints #1463
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rm and max eigenvalue
sandmaennchen
approved these changes
Jun 23, 2025
examples/acados_python/hock_schittkowsky/hs074_constraint_scaling.py
Outdated
Show resolved
Hide resolved
examples/acados_python/linear_mass_model/test_qpscaling_slacked.py
Outdated
Show resolved
Hide resolved
examples/acados_python/linear_mass_model/test_qpscaling_slacked.py
Outdated
Show resolved
Hide resolved
david0oo
approved these changes
Jun 25, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 asmax_abs_eig, then sets the objective scaling factor asobj_factor = min(1.0, qpscaling_ub_max_abs_eig/max_abs_eig)qpscaling_scale_constraintsString 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 factor1.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:
Limitations