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
-
Official comment
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 why not try our AI Gurobot?. -
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
Post is closed for comments.
Comments
5 comments