Skip to main content

Gurobi says the model is infeasible, yet I can come up with a solution by hand (Python)

Answered

Comments

4 comments

  • Official comment
    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.
  • Chung-Kyun Han
    • Gurobi Staff

    Thank you for reaching us.

    The default lower bound of a variable is zero (please refer to our manual about Model.addVar()).
    If you add variables like as follows, you will get the optimal solution you want.

    a = m.addVar(lb=-GRB.INFINITY, name="a", vtype=GRB.INTEGER)
    b = m.addVar(lb=-GRB.INFINITY, name="b", vtype=GRB.INTEGER)
    c = m.addVar(lb=-GRB.INFINITY, name="c", vtype=GRB.INTEGER)

    Whenever you have any questions, feel free to contact us.

     

    Best regards,
    Chung-Kyun Han

    0
  • yechan pyeong
    • Gurobi-versary
    • First Question
    • First Comment

    Thank you very much!

    0
  • Riley Clement
    • Gurobi Staff

    Hi Yechan,

    You should also take a look at our article How do I determine why my model is infeasible?

    With this knowledge, you will run

    m.computeIIS()
    m.write("model.ilp")

    and inspect the file that is written.

    - Riley

    0

Post is closed for comments.