Skip to main content

Infeasible solution on Gurobi/Python Model (Scheduling Model Mixed Integer Programming)

Answered

Comments

3 comments

  • Jonasz Staszek
    Community Moderator Community Moderator
    Gurobi-versary
    Thought Leader
    First Question

    Hi Burcu,

    this article should be of help.

    I would also recommend that you do add some meaningful names to your constraints. This way, it will be easier to analyze the IIS.

    You should also try generating the IIS for the smallest instance for which the infeasibility occurs.

    Hope this helps.

    Best regards
    Jonasz

    0
  • Burcu Genc
    Gurobi-versary
    First Question
    First Comment

    Hello Jonasz, Thank you for your opinion.

    But, I did not understand exactly for adding some meaningful names to your constraints.And also, trying to generate the IIS for the smallest instance for which the infeasibility occurs.

    Could you please give an example?

     

    Kind Regards

    Burcu

    0
  • Jonasz Staszek
    Community Moderator Community Moderator
    Gurobi-versary
    Thought Leader
    First Question

    Hi Burcu,

    adding some meaningful names to your constraints.

    the documentation of the addConstrs() method mentions the 'name' parameter, which you can use to give your constraints a name. The same holds for the addConstr() method.

    Adding a name important if you wish to browse your model in the text form. Otherwise your constraints get generic names like R112 and it is very difficult to identify them.

    An example from your code would be (assuming you use Python 3.7 or newer):

    for k in jobs:
        for j in machines:
          model.addConstr(C[j,k] - due_date[k] <= T[j,k], name=f"constr_5_{k}_{j}")

    This way each of your constraints is clearly identifiable. This will be important later on.

    And also, trying to generate the IIS for the smallest instance for which the infeasibility occurs.

    I guess you tested your model on several datasets / instances.

    For some of them, the model implemented by your code could be feasible, for others not.

    After ensuring that all your constraints have a name, I would take the smallest dataset which causes infeasibility.

    Then I would compute the IIS by running

    # ... model generation above
    model.optimize()
    model.computeIIS()
    model.write("IIS.ilp")

    and study the resulting IIS.ilp file. This should give you an idea for the reasons of your infeasibility.

    I hope this makes things clearer. If you need further clarification, do not hesitate to contact us.

    Best regards
    Jonasz

    1

Please sign in to leave a comment.