メインコンテンツへスキップ

Tolerance and bineary variables

回答済み

コメント

4件のコメント

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Do you mean -2.84e-14?  Or are you saying your non-negative variables have solution values like -284000000000000?

    0
  • Ying Xue
    First Comment
    Gurobi-versary
    First Question

    Sorry, i mean -2.84e-14

    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Ying,

    You can try and reduce it the issue using IntegralityFocus - this is particularly relevant if you have big M constraints, and you should also try and find the tightest M values possible, even if this means a different M value for each big M constraint.  You could also try using indicator constraints instead of Big M constraints.  See this discussion on Stack Overflow.

    Ultimately though, these tiny "errors" are a consequence of floating point arithmetic, and solvers must use tolerances when making calculations and deciding feasibility, so there may be no way to avoid it.  One possible action you could try, if you are using gurobipy, is to call Model.fixed() after solving, then solve the fixed model.  Presolve may then eliminate any small values which should be 0 due to the big M constraints, however it may be that the solution then becomes infeasible - try it and see.

    - Riley

    1
  • Gwyneth Butera
    Gurobi Staff Gurobi Staff

    Also, please see Why does Gurobi sometimes return non-integral values for integer variables? for more information.

    0

サインインしてコメントを残してください。