lpmethod.m


lpmethod.m


功能LPMethod(文件名)%Copyright 2021,Gurobi优化,LLC %%狗万app足彩求解具有不同值的方法参数的模型;%显示哪个值给出最短的解决时间。%读取模型fprintf('读取模型%s \ n',文件名);model = gurobi_read(文件名);besttime = inf;BESTMETHOD = -1;对于i = 0:4 params.method = i;res = gurobi(模型,params);如果strcmp(res.status,'最佳')bestmethod = i;besttime = res.runtime; params.TimeLimit = bestTime; end end % Report which method was fastest if bestMethod == -1 fprintf('Unable to solve this model\n'); else fprintf('Solved in %g seconds with Method %d\n', bestTime, bestMethod); end