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

Lazy constrainst doesn't work

回答済み

コメント

3件のコメント

  • 正式なコメント
    Simranjit Kaur
    • 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

    The problem could be these conditional statements:

    if (z[i] == 1)
    if (z[i].get(GRB_DoubleAttr_X) == 1)

    Gurobi uses an integer feasibility tolerance (default 1e-5) to determine if a variable's value is integral. Thus, it's possible for binary variables to assume values like \( 0.999999 \neq 1 \). See the article Why does Gurobi sometimes return non-integral values for integer variables? for more information.

    Can you try relaxing these statements? E.g.:

    if (z[i] > 1 - 1e-5)
    if (z[i].get(GRB_DoubleAttr_X) > 1 - 1e-5)
    1
  • Gustavo Albuquerque
    • Gurobi-versary
    • First Question
    • First Comment

    Thanks Eli, it was these two conditionals. I fixed and it's working now. Thank you for the help.

    0

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