gurobi.QConstr Not Yet Added
AnsweredHello members,
While modeling my workforce scheduling problem, I have encountered "gurobi.QConstr Not Yet Added" with one of my constraints used in the model. I have many constraints in my model where other constraints are saying
gurobi.Constr *Awaiting Model Update
Could anyone explain why is this happening so? If it is a case-specific, then I would reply to you back with my specific problem I trying to solve
-
Hi Parijat,
You encounter this error due to Gurobi's lazy update approach. You can find more information in the documentation of the UpdateMode. To avoid this error, you have to execute the Model.update() function before using any added constraints and/or variables.
Best regards,
Jaromił0 -
Thanks for your response, Can you please show a small piece of an example of how to use the Model.update()
function.
0 -
An example would be
import gurobipy as gp
from gurobipy import GRB
# Create a new model
m = gp.Model("test")
# Create variables
x = m.addVar(name="x")
y = m.addVar(name="y")
m.addConstr(x*y <= 2)
m.update()0 -
thank you Juromil Najman
0
Please sign in to leave a comment.
Comments
4 comments