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

Tolerance and bineary variables

回答済み

コメント

5件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Riley Clement
    • Gurobi Staff

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

    0
  • Ying Xue
    • Gurobi-versary
    • First Comment
    • First Question

    Sorry, i mean -2.84e-14

    0
  • Riley Clement
    • 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

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

    0

投稿コメントは受け付けていません。