Skip to main content

Model not feasible while solution does exists

Answered

Comments

4 comments

  • Official comment
    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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • Gurobi Staff

    The default lower bound for variables is \(0\). You have to explicitly state that a variable is allowed to attain negative values.

    shot_x = m.addVar(lb=-gurobi.GRB.INFINITY, vtype=gurobi.GRB.CONTINUOUS, name='shot_x')
    shot_y = m.addVar(lb=-gurobi.GRB.INFINITY, vtype=gurobi.GRB.CONTINUOUS, name='shot_y')
    shot_z = m.addVar(lb=-gurobi.GRB.INFINITY, vtype=gurobi.GRB.CONTINUOUS, name='shot_z')

    Best regards, 
    Jaromił

    0
  • David Torres Sanchez
    • Gurobi Staff

    Hi,

    The default lower bound of variables is 0.0  Model.addVar().
    You can change this when you create the variables:

    shot_x = m.addVar(lb=-100, vtype=gurobi.GRB.CONTINUOUS, name='shot_x')

    Additionally, you don't need to add the \(\texttt{quicksum}\) expression as your \(\texttt{condition_*}\) are already LinExpr.

    Cheers, 
    David

    0
  • Huib Meulenbelt
    • Gurobi-versary
    • Investigator
    • Conversationalist

    Thank you Jaromil and David!

    0

Post is closed for comments.