Accessing Fractional Solution at Root Node after adding Cuts
回答済みHi all,
I am wondering if there is a way to capture the state of the Gurobi process just before it leaves the root node. Specifically, I would like to access the fractional solution at the root node, but after all the cuts have been added by Gurobi.
I attempted to achieve this using a callback function, checking whether the process is still at the root node:
def solve(optimization_data):
def callback_function(model, where):
if where == GRB.Callback.MIPNODE:
node_count = model.cbGet(GRB.Callback.MIPNODE_NODCNT)
node_limit = model.Params.NodeLimit
if node_count >= node_limit:
print(f"Node limit reached ({node_count} >= {node_limit}).")
However, with this approach, I can only determine if the root node has already been left.
Is there any possibility to access this?
Best regards, Florian
-
Hi Florian,
I don't think so as the decision to branch and move to another node is made after cuts are added. Perhaps as a workaround (depending on what you want to do) you could set the NodeLimit to 0, then the optimization will cease, then you do something with the last fractional solution recorded (by you), then change the NodeLimit value to something else, then call optimize() again to resume.
- Riley
0
サインインしてコメントを残してください。
コメント
1件のコメント