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

Why is the solution for binary variables 0.999999?

回答済み

コメント

2件のコメント

  • Simranjit Kaur
    • Gurobi Staff

    Hi Tianyu,

    As explained in the article Why does Gurobi sometimes return non-integral values for integer variables?, the solution value of a binary variable can deviate from 0 or 1. The tolerance for such deviation is defined by the IntFeasTol parameter (default value 1e-5).  

    If the problem with binary variables having a value like 0.999.. only occurs when you try to read them after optimization, you can simply round the values once the optimization process is done. Otherwise, you can try setting the IntegralityFocus parameter to 1, which will prompt Gurobi to take extra steps to remove the integrality violation while maintaining feasibility.

    Best regards,

    Simran

     

     

    1
  • Tianyu Mao
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you for your reply! I found your explanation very helpful.

    0

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