The coefficient statistics are some of the first pieces of information you will encounter in the Gurobi log. These provide an overview of the ranges of the absolute values of the numeric values in the model. Here's an example:
Coefficient statistics:
Matrix range [1e-01, 2e+00]
Objective range [3e-01, 1e+01]
Bounds range [0e+00, 0e+00]
RHS range [4e+01, 5e+02]
- The matrix range refers to coefficients in the constraint matrix of the model, i.e. the coefficients of the variables in the constraints.
- The objective range refers to coefficients of variables in the objective function.
- The bounds range refers to the bounds (both lower and upper) defined for the variables.
- The RHS ("right hand side") range refers to the constant values in each constraint.
The message "Model contains large matrix coefficient range" indicates that the coefficients in the constraint matrix of the model vary significantly in magnitude, which can lead to numerical instability and can affect both the solution time and solution quality of the optimization problem and can be one reason for unsatisfying/unexpected results.
While it is in most cases impossible to be sure whether or not a model has numerical issues from the coefficient statistics alone, our general recommendation is the following:
- The matrix ranges (i.e., the differences between the biggest and the smallest values) should be no more than 9 orders of magnitude (i.e., 1e+09) and ideally no more than 6 (i.e., 1e+06).
- For objective coefficients, bounds, and RHSs, the biggest value should be no more than 1e+04.
- Ideally, good solutions should have an objective value below 1e+04.
Adhering to these guidelines may enhance your model's numerical stability and performance. You should also make sure to always check the solution quality once the optimization finishes.
One option is to reformulate the model to avoid large ranges and extreme values (both small and large). Our Guidelines for Numerical Issues makes some recommendations, including choosing appropriate units to express variables and constraints (e.g., kilometers instead of centimeters, etc.) and/or rescaling the constraints. For very small values that are not significant, especially in the coefficient matrix, you may be able to round them down to zero.
Further information
- See our Numerics Guidelines for an in-depth discussion.
- What does "Warning: max constraint violation exceeds tolerance" mean?
Comments
0 comments
Article is closed for comments.