Automatic scaling of constraint coefficients and RHS #780
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.
Description
This PR creates an option to automatically scale the coefficient matrix and RHS of a problem to be within user-defined bounds. It achieves this by multiplying or dividing constraints (i.e. scaling rows), and using proxy variables to scale parts of columns.
Large GenX problems can become numerically unstable if their constraints have large ranges of coefficients, the coefficients are very large or small, or the RHS is very large or small. There are many ways to address this, but one is to scale the rows and columns so that all the coefficients in the problem are within a desired range.
Some more details are given here: https://www.gurobi.com/documentation/current/refman/advanced_user_scaling.html
This PR implements those methods. The results are not affected in my testing, other than becoming more stable. Run times increase for small problems, due to the overhead of the method, and decrease in larger problems.
For example, I recently had a model with the following issues:
After scaling, it had this matrix:
The results were the same in both instances.
Some additional notes:
What type of PR is this? (check all applicable)
Related Tickets & Documents
Checklist
How this can be tested
I recommend trying it with all the single-stage examples. They worked on my machine and gave the same result.
Post-approval checklist for GenX core developers
After the PR is approved