lpmethod.m


函数lpmethod(filename) % Copyright 2023, Gurobi 狗万app足彩Optimization, LLC % %求解具有不同Method参数值的模型;%显示哪个值给出最短的求解时间。%读取模型fprintf('读取模型%s\n', filename);Model = gurobi_read(filename);bestTime = inf;bestMethod = -1;对于I = 0:4参数。方法= i;Res = gurobi(model, params);如果比较字符串(res。状态,'OPTIMAL') 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