2
$\begingroup$

I have an MILP model, in which I am handling all Big M constraints with add_if_then constraints (following this topic). I generate this model only once (to save time) and solve it iteratively with different coefficients of the objective function (I only update the objective function) - coded via docplex in Python.

After some iterations, the binary/integer variables get real values (the optimality gap is 5%). What would be the reason of this (other than having Big M constraints)? Unfortunately, I am unable to share the entire model with you. However, I can provide you with further information.

$\endgroup$

1 Answer 1

5
$\begingroup$

All solution values will be floating-point numbers - independent of the variable types. In an optimal or feasible solution, they will simply be close to an integer value, depending on the specified tolerance. Usually, there is a numeric tolerance for small violations regarding the bounds and right hand sides and another one that is only concerned about the integrality of the solution.

$\endgroup$
3
  • $\begingroup$ Oh, I see. I just set mdlS.parameters.mip.tolerances.integrality = 0. I will report if the problem still exists. $\endgroup$
    – mdslt
    Commented Apr 4, 2022 at 12:44
  • 2
    $\begingroup$ Setting the integrality tolerance to zero is not without risk. In a model with tricky numerics (which can easily happen in a "big M" formulation), an integrality tolerance of zero can lead to suboptimal solutions or even a false claim of infeasibility. $\endgroup$
    – prubin
    Commented Apr 4, 2022 at 15:51
  • 1
    $\begingroup$ @mdslt It's likely the binary/integer values you are seeing are very close to integers. If you are concerned about feasibility, then re-solving with the almost-integer variable values fixed to their rounded integer values would confirm whether you have actually obtained a feasible solution $\endgroup$
    – holger3000
    Commented Apr 4, 2022 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.