Skip to main content

Model not feasible while solution does exists

Answered

Comments

3 comments

  • Jaromił Najman
    • Gurobi Staff 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 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
    • Curious
    • Conversationalist

    Thank you Jaromil and David!

    0

Please sign in to leave a comment.