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:

-
正式なコメント
This post is more than two 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 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
投稿コメントは受け付けていません。
コメント
2件のコメント