Try our new documentation site (beta).
Filter Content By
Version
Text Search
${sidebar_list_label} - Back
Filter by Language
lpmethod.m
function lpmethod(filename) % Copyright 2021, Gurobi Optimization, LLC % % Solve a model with different values of the Method parameter; % show which value gives the shortest solve time. % Read model fprintf('Reading model %s\n', filename); model = gurobi_read(filename); bestTime = inf; bestMethod = -1; for i = 0:4 params.method = i; res = gurobi(model, params); if strcmp(res.status, '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
![](/wp-content/plugins/hd_documentations/content/images/documentation-ampl-guide.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-cloud.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-example-tour.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-quick-start.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-reference-manuals.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-remote-services.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-linux.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-mac-osx.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-windows.webp?x70725)