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

High instability of an MIP

回答済み

コメント

4件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff Gurobi Staff
    This post is more than three 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 why not try our AI Gurobot?.
  • Eli Towle
    • Gurobi Staff Gurobi Staff

    Hi Cedric,

    I suspect the issue is caused by this conditional statement:

    if E_VAR[e].getAttr(GRB.Attr.X)==1:

    For numerical reasons, Gurobi uses a tolerance to determine whether or not a variable is "close enough" to an integer to be considered an integer. In Gurobi 8.1, this tolerance by default is 1e-5. So, it may be possible that some of the selected edges actually take on a value slightly less than 1 at the optimal solution. Thus, it may work to instead check if the X attribute of the variable lies within this tolerance:

    if E_VAR[e].X > 1 - 1e-5:

    As to why you are experiencing differences between optimization runs, concurrent MIP optimization is not deterministic (see here).

    Lastly, a few notes about the code:

    • It isn't necessary to specify ES_VAR as an integer variable; ES_VAR is equal to the sum of binary variables, which is always an integer
    • You can query the X attribute of the Var object directly (e.g., E_VAR[e].X)
    • You might find the Model.addVars() method well-suited for adding multiple variables all at once

    I hope this helps. Thanks!

    Eli

    0
  • cedric chauve
    • Gurobi-versary
    • First Comment
    • First Question

    Thanks Eli

    Your hint on the tolerance was what I needed for my first point.

    I tried to run again my ILP not using the concurrent method, and even fixing the seed, but I still do not obtain the same answer at each run. The two parameters I did set specifically are 

    ILP_PDG.setParam(GRB.Param.Method,4)
    ILP_PDG.setParam(GRB.Param.Seed,1)

    I did read that this might be due to issue with Presolving, but when I set 

    ILP_PDG.setParam(GRB.Param.PreSolve,0)

    I obtain a segmentation fault.

    cedric chauve

    0
  • Eli Towle
    • Gurobi Staff Gurobi Staff

    Hi Cedric,

    Thanks for reporting this issue. This has been fixed in Gurobi 9.0, scheduled for release this fall.

    Eli

    0

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