Dynamic-Calibration/utils/YALMIP-master/modules/global/adjustMaxTime.m

11 lines
334 B
Mathematica
Raw Normal View History

2019-12-18 11:25:45 +00:00
function p = adjustMaxTime(p,maxtime,elapsed)
% Allow the solver at-least 1 second
remaining = maxtime-elapsed;
budgetForSolver = max(1,ceil(remaining));
% TODO: Support more solvers
p.options.cplex.timelimit = budgetForSolver;
p.options.mosek.MSK_DPAR_MIO_MAX_TIME = budgetForSolver;
p.options.gurobi.TimeLimit = budgetForSolver;