Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark mode
Gurobi Example Tour
Light LogoDark Logo
Gurobi
Back to top

lp.m#

functionlp()% Copyright 2025, Gurobi Optimization, LLC%% This example formulates and solves the following simple LP model:% maximize%       x + 2 y + 3 z% subject to%       x +   y        <= 1%             y +   z  <= 1%model.A=sparse([110;011]);model.obj=[123];model.modelsense='Max';model.rhs=[11];model.sense=['<''<'];result=gurobi(model);disp(result.objval);disp(result.x);% Alterantive representation of A - as sparse triplet matrixi=[1;1;2;2];j=[1;2;2;3];x=[1;1;1;1];model.A=sparse(i,j,x,2,3);% Set some parametersparams.method=2;params.timelimit=100;result=gurobi(model,params);disp(result.objval);disp(result.x)end

Help and Feedback


[8]
ページ先頭

©2009-2025 Movatter.jp