Set ObjBound
AnsweredHello,
Just a question, can you update the ObjBound in a MIPSOL?
I was reading the documentation and came across
Var.setAttr(GRB.Attr.UB, 0.0)
My question is can I do something like this?
def lazy(model, where):
if where == GRB.Callback.MIPSOL:
new_obj = model.cbGet(GRB.Callback.MIPSOL_OBJST)
Var.setAttr(GRB.Callback.MIPSOL_OBJBND,new_obj)
0
-
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Jose,No, you cannot. The Var.setAttr() method sets the value of a variable attribute. The GRB.Callback.MIPSOL_OBJBND is not an attribute of a Var object. It is a piece of information that can be only queried inside a callback when a new incumbent solution is found, i.e., \(\texttt{where} = \texttt{MIPSOL}\).Best regards,Maliheh1
-
Hello Maliheh,
Thanks for your response. Basically, the only way to update the objective bound would be through a cut that cuts off that solution? A similar question if one wants to update the incumbent solution.
Best,
Jose Alexander
0 -
Hi Jose,Yes, you can use the Model.cbCut() and Model.cbLazy() methods to respectively add cutting planes and new lazy constraints to a MIP model (see the article What is the difference between user cuts and lazy constraints? for their difference).The Model.cbSetSolution() can be used to import a new heuristic solution to the model.Best regards,Maliheh0
Post is closed for comments.
Comments
4 comments