How to use the function "model.relax()"?
AnsweredUsing relax function of Gurobi can we derive the bound of original model? can it help me simplify the MIP model solving? how can i do this, please give me an example. Thank you!
-
Hi Ariel,
The first thing Gurobi will do is solving the relaxed model (meaning that all integer/binary constraints are ignored). Afterwards, it will use heuristics and branch and bound to find integer feasible solutions. It might be worth it looking into how a solver optimizes a MIP for you to understand better what is the relaxed model and its use.
I do not see how you could use model.relax to simplify your original model. The bounds of your model should also be easily available when solving the MIP directly.
0 -
Thanks Soares!
I got what the meaning of this, but when i use the "model.relax()" in my program, it seems to ignore almost all constraints as my constraints are seemly all related to binary variables:)
Are there any useful cases that I can learn and refer to?
0 -
Model.relax is useful in very specific cases, it is not common to be used, I can think of one case:
- There are some MIP models which might take too long to get to answer, requiring sophisticated user-defined-heuristics. In order to do this, you might want to optimize the relaxed model first and then use its value to either: set initial solution for the MIP, add constraints/cuts to model, set variable hints.
0 -
Thanks for your careful reply,Soares. I will find the way for optimizing my model based on your advice.
0
Please sign in to leave a comment.
Comments
4 comments