Checking Solution and adding Cuts
回答済みHi
I need to implement two features for solving a MILP
1) At every Node A callback should be performed where the current solution is checked to fulfill constraints, from a set of constraints (lets say "M"), that are not yet passed to the solver. If a violated constraint is found, it should be added as a Cut.
2) I want to avoid that Gurobi solves the problem in the heuristic stage without aver entering the Branch and and Bound stage. Otherwise the feasibility of the solution with respect to the "M" is never checked.
I am working in pyhton. I'm quite confident that 1) can be realized with a callback and cbGetNodeRel(), and cbCut(). But evertime I try to experiment with these, the problem is solved in the heuristic stage. Gurobi just outputs
Found heuristic solution: ...
without ever entering a MIP node where feasibility would be checkable, and I see no apparent way to avoid this.
Thank you for your help!
-
正式なコメント
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 Markus,
It sounds like your inequalities should be added using the MIPSOL callback. This callback is called whenever a new MIP incumbent solution is found, which includes those found via heuristics before the branch-and-bound process even begins. Constraints added in this manner are known as lazy constraints.
If you additionally want to add a "user cut" at every node of the branch-and-bound tree using the node's relaxation solution, this can be done within the MIPNODE callback (I believe you are doing this already). Note that the cuts you are adding should be globally valid.
Thanks!
Eli
0 -
Thank you so much for your quick answer. I will try to implement it using the MIPSOL callback.
Have a nice day :D
0
投稿コメントは受け付けていません。
コメント
3件のコメント