1 | P a g e
Linear Programming
Syntax:
[x, fval, exitflag, output, lambda] = cplexlp (f, Aineq, bineq, Aeq, beq, lb, ub, x0,
options)
% Description
% Finds the minimum of a problem specified by
% min f'*x
% st. Aineq*x <= bineq
% Aeq*x = beq
Example 1:
MATLAB Code:
f=[-7;-5];
Aineq=[1 2;4 1];
bineq=[6 12]';
lb=[0 0]';
[x, fval, exitflag, output, lambda] = cplexlp (f, Aineq, bineq, [], [], lb, [], [], []);
Solution
x=[2.5714;1.7143];
fval=-26.5714
Example 2:
Minimize subject to
MATLAB Code:
f=[-5;-4;-6];
Aeq=[3 2 4; 3 2 0];
beq=[42;30];
lb=[0;0;0];
[x, fval, exitflag, output, lambda] = cplexlp (f, [], [], Aeq, beq, lb, [], [], []);
Solution
x=[0;15;3];
fval=-78;