Skip to main content

The wrong objective value

Answered

Comments

2 comments

  • Eli Towle
    Gurobi Staff Gurobi Staff

    Warnings in the log output suggest the model's numerics could be a factor:

    Coefficient statistics:
    Matrix range [0e+00, 0e+00]
    Objective range [2e+06, 4e+09]
    QObjective range [4e-03, 9e+02]
    Bounds range [2e+06, 2e+09]
    RHS range [0e+00, 0e+00]
    Warning: Model contains large objective coefficients
    Warning: Model contains large bounds
    Consider reformulating model or setting NumericFocus parameter
    to avoid numerical issues.

    Solvers like Gurobi use tolerances (e.g., FeasibilityTol and IntFeasTol) to determine if a solution can be considered feasible. It can happen that solutions violate constraints or bounds by very small amounts, but are still considered feasible because they lie within the given tolerances.

    Your model has objective coefficients as large as \(4 \cdot 10^9\). Such large coefficients can magnify tiny constraint violations to the extent that they have a tangible impact on the objective function value. As an example, say you have a non-negative variable that assumes a value of \( -5 \cdot 10^{-10} \) in the optimal solution. This is a negligible violation that normally is not a cause for concern. However, if this variable's objective coefficient is \( 4 \cdot 10^9 \), this tiny violation is magnified to \( -2 \).

    The best thing to do is scale your model to avoid such large objective coefficients and bounds. You could scale the entire objective function by a constant value like \( 10^{-6} \), and/or change the units represented by your variables. For example, instead of a variable representing number of dollars, it could represent thousands or even millions of dollars. You may find other ideas in the Guidelines for Numerical Issues.

    You could try playing around with parameters as well. NumericFocusObjScale, and perhaps IntegralityFocus are good parameters to start with. That said, I strongly recommend first focusing on reformulating the model.

    0
  • Hongmin Zhang
    Gurobi-versary
    First Comment
    First Question

    Thanks a lot for your suggestions!!! After adjusting the IntFeasTol parameter, I get the results I want. I have never imagined that I should increase IntFeasTol from 10e-9 to 10e-5. Many thanks to you, this problem confuses me for a long time.

    0

Please sign in to leave a comment.