Skip to main content

problem with warnings

Answered

Comments

1 comment

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Please note that it is not possible to execute your code, because it uses multiple excel sheets. Moreover, the code is very long and it is not clear where the source of your issue lies. It is always best to generate a minimal reproducible example to get the best help possible.

    The warning

    Warning: zero or small (< 1e-13) coefficients in quadratic constraints, ignored

    means that you have coefficient with value lesser than \(10^{-13}\) in your model and that Gurobi is going to treat all such coefficient as \(0\). In general, it is strongly recommended that all meaningful coefficients are at least one order of magnitude greater than the FeasibilityTol value.

    The warnings

    Coefficient statistics:
      Matrix range     [4e-02, 4e+07]
      QMatrix range    [1e+00, 4e+15]
      QLMatrix range   [1e+00, 2e+03]
      Objective range  [1e+00, 1e+03]
      Bounds range     [3e-01, 1e+00]
      RHS range        [3e+03, 6e+03]
      QRHS range       [1e+02, 8e+09]
    Warning: Quadratic constraints contain large coefficient range
    Warning: Model contains large rhs on quadratic constraints
             Consider reformulating model or setting NumericFocus parameter
             to avoid numerical issues.

    mean that the range of coefficients in your linear and quadratic constraints is very large. Indeed, the ranges have differences of \(9\) and \(15\) orders of magnitude, which very likely leads to numerical issues within the optimization algorithm. You can try experimenting with the NumericFocus parameter to overcome these problems but the best way to deal with bad scaling and numerical issues is to re-scale the coefficients of your model. Please have a look at our Guidelines for Numerical Issues for more information.

    I want to set for as a constraint with low and upper bound but from my research i saw that is possible only if i put 2 constraints with different name. I did it but doesn't work.

    I don't fully understand your issue here. You can add 2 constraints with different names or just don't provide any names at all, e.g.,

    model.addConstr(x <= 1, name="x_ub")
    model.addConstr(x >= 0, name="x_lb")

    Alternatively, you can use the addRange method. Note that addRange accepts linear terms only. For quadratic terms, you have to add two constraints manually.

    Best regards, 
    Jaromił

    0

Please sign in to leave a comment.