Skip to main content

Constraint violation after changing cost-values in an existing code-base



  • Silke Horn
    Gurobi Staff Gurobi Staff

    This really does sound like a numerics issue, but without further information, I cannot say more. How are the coefficient statistics for your model?

    You could experiment with different values for NumericFocus, as well as ScaleFlag=2 and/or Aggregate=0, but the most reliable fix would be to improve the numerics. Have you seen our Numerics Guidelines? They may contain some explanation and valuable input for reformulating your model.

    A few more comments:

    1) Constraints are violated in the final solution (sometimes, not always). Even though the optimization finished and was *not* terminated due to a timeout.

    How the optimization was finished should not matter. No solution should violate the constraints (unless there are numerical issues).

    2) When I continue optimizing an obtained solution, the new solution (very often) contains the previously missing constraints.

    I don't understand this. What do you mean with "contains the previously missing constraints"?

    3) The issue of violated constraints becomes increasingly prominent, with increasing cost-values.

    This is to be expected since bigger numbers mean more numerical issues.

  • Michael Mell

    Hi Silke,

    thanks for the answer.

    I am not sure, what you mean by coefficient statistics. Is it this(?):

    Matrix range [1e+00, 2e+01]
    Objective range [3e-04, 1e+05]
    Bounds range [1e+00, 1e+00]
    RHS range [1e+00, 2e+01]

    Regarding this statistic: Could you point me to one or more resources on how to interpret this information?

    Regarding "2) When I continue optimizing an obtained solution, the new solution (very often) contains the previously missing constraints.":

    In our software, we have the ability to re-run the optimization based on the prior optimization result (I think this is called a warm-start?!). And when doing this, I sometimes observe, that after the initial optimization run, I have violations of some constraints, that are then "fixed" (meaning the constraints are then correctly applied/fulfilled) after continuing the optimization.

    Best and thanks for your reply,



Please sign in to leave a comment.