problem when using cbSetSolution
回答済みHello,
I use Python to call Gurobi to solve MIP models.
I start an additional process to search for feasible solutions for the given model. I want to put the feasible solutions to normal solving of Gurobi once the additional process finds one new best solution, to help improve the Incumbent.
I use the model.cbSetSolution() function to put the solution to Gurobi, eg:
if where == GRB.Callback.MIPNODE:
update, vals = cbData.getNewSol()
if update:
model.cbSetSolution(cbData.modelVars, vals)
print(f'cbUseSolution: {model.cbUseSolution()}')
Moreover, if I give the solution at the earlier time of the solving, such as at 10s, it accepts the solution!
The log is like this:
-
Hi Peng Lin,
You are using the methods correctly, so the most probable explanation is an issue with the solution.
Maybe it is rejected because it is "slightly" infeasible due to some numerical issues?
Is the objective function in this model and your heuristics exactly the same? If not, the solution value for this model's objective function might be higher than the current incumbent and is therefore rejected?
It is hard to debug this issue on our side.Best regards,
Mario0
サインインしてコメントを残してください。
コメント
1件のコメント