Output variable values of the warm-start solution
回答済みHello everyone,
for a warm start I set the start-value of some of my variables to a certain value. Gurobi will tell me the objective value that it was able to caclulate with these start values. But it does not output the values of the other variables that did not receive a start value.
Is it possible to return the variable values of the warm-start-solution?
I am using the Python API.
Thanks in advance for any 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?. -
You could use a callback function. Every time Gurobi finds a new incumbent solution, the MIPSOL callback is called. Whenever this happens, you can query the solution values with Model.cbGetSolution():
def my_cb(model, where):
if where == GRB.Callback.MIPSOL:
print(model.cbGetSolution(model._vars))
m._vars = m.getVars()
m.optimize(my_cb)Alternatively, you could set the SolFiles parameter. This will direct Gurobi to write every new incumbent solution to disk:
m.Params.SolFiles = 'foo'1 -
Thanks a lot!
0
投稿コメントは受け付けていません。
コメント
3件のコメント