Multiple stopping criteria from matlab
AnsweredHi,
I'm using Gurobi from MATLAB and I wonder if it possible to set multiple stopping criteria somehow, similar to what is described in this post, but for MATLAB?
https://support.gurobi.com/hc/en-us/articles/360013419411-How-do-I-set-multiple-termination-criteria-for-a-model-
I think I use the "old" interface. The call looks like this:
res = gurobi(prob,gparams);
It seems that it was possible to continue on a solution in the other post, is that possible somehow with this api as well?
What I would like to do is to always run the optimization for e.g. 150 s, and then, if the MIPGAP is not good enough, continue until it does, and then stop at perhaps 5000 s.
-
Hi Johan,The function in Matlab API to optimize a model is gurobi(model, params). Calling this function for the second time will not resume the optimization run from the point at which the run is terminated/interrupted. However, you can provide the solution found in the previous run as a MIP start for the second run.For the use-case you described, you can implement something like below:
model = gurobi_read(filename);
params.TimeLimit = 150;
result = gurobi(model, params);
if result.mipgap > desired_MIPGap
params.TimeLimit = 5000;
model.start = result.x;
result = gurobi(model, params);
endBest regards,Maliheh0 -
Hi Maliheh,
Thank you, that makes a lot of sense, I will try this!
Best,
Johan
0
Please sign in to leave a comment.
Comments
2 comments