Skip to main content

My model is infeasible. Can someone please help me?

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.
  • Gwyneth Butera
    • Gurobi Staff

    Hi Jordi - Did you try to compute an IIS as discussed in the Knowledge Base article How do I determine why my model is infeasible?

    0
  • Jordi Kortekaas
    • Gurobi-versary
    • Curious
    • First Comment

    yes, but still it is not very clear to me what is wrong the ISS: 

    \ Model CVRP_copy
    \ LP format - for model browsing. Use MPS format to capture full model detail.
    Minimize
     
    Subject To
     R7: C12 + C13 + C24 + C25 + C36 + C37 + C48 + C49 + C60 + C61 + C72 + C73
       = 1
     R42: C12 + C24 + C36 + C48 + C60 + C72 = 1
     R43: C13 + C25 + C37 + C49 + C61 + C73 = 1
    Bounds
    Binaries
     C12 C13 C24 C25 C36 C37 C48 C49 C60 C61 C72 C73
    End
    AC

    0
  • Marika Karbstein
    • Gurobi Staff

    You probably need to define N and V as

        N = [i for i in range(1,n)] # set of clients
        V = [i for i in range(n)] # set of clients plus the depot (depot is 0)
    This would lead to a feasible model. But I think a constraint is missing that the same vehicle is used when arriving at client i and when leaving client i.
    And finally, I think
    # Each vehicle must leave the depot
      mdl.addConstrs(quicksum(x[i, 0, k] for i in V if i != 0) == 1 for k in range(num_vehicles))

    needs to be 

    # Each vehicle must leave the depot
    mdl.addConstrs(quicksum(x[0, i, k] for i in V if i != 0) == 1 for k in range(num_vehicles))
    Then it also fits your evaluation of the solution.
    0

Post is closed for comments.