lp.m


lp.m


这个例子阐述并解决了以下简单的lp模型:%最大化% x + 2 狗万app足彩y + 3 z %服从% x + y <= 1 % y + z <= 1 %的模型。A =稀疏([110 0;0 1 1]);模型。Obj = [1 2 3];模型。modelsense =“Max”;模型。RHS = [1 1];模型。Sense = ['<' '<']; result = gurobi(model); disp(result.objval); disp(result.x); % Alterantive representation of A - as sparse triplet matrix i = [1; 1; 2; 2]; j = [1; 2; 2; 3]; x = [1; 1; 1; 1]; model.A = sparse(i, j, x, 2, 3); % Set some parameters params.method = 2; params.timelimit = 100; result = gurobi(model, params); disp(result.objval); disp(result.x) end