Force Gurobi to ignore timelimit until one feasible solution is found
回答済みDear Community,
is there any possibility to set a time limit that is only considered, if a feasible solution is found. Otherwise, I want to continue the process until the first feasible solution is provided.
I am thankful for any help.
1
-
正式なコメント
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?. -
This can already be done by using callbacks. The callback examples on our website demonstrate how to implement a custom termination strategy: https://www.gurobi.com/resource/functional-code-examples/
1 -
As an alternative solution to Silke's suggestion of callbacks, you can also try something like the following Python sample:
timeLimit = 20
try:
m = read('b1c1s1.mps.gz')
oldSolutionLimit = m.Params.SolutionLimit
m.Params.SolutionLimit = 1
m.optimize()
m.Params.TimeLimit = timeLimit - m.getAttr(GRB.Attr.Runtime)
m.Params.SolutionLimit = oldSolutionLimit - m.Params.SolutionLimit
m.optimize()
except (GurobiError, AttributeError, Exception) as e:
print('Caught: ' + e.message)2
投稿コメントは受け付けていません。
コメント
3件のコメント