Graphics Programs Reference
In-Depth Information
X=SIMLP(f,A,b) solves the linear programming problem:
min f'x
subject to:
Ax <= b
x
So
f = [-143 -60];
A = [120 210; 110 30; 1 1; -1 0; 0 -1];
b = [15000; 4000; 75; 0; 0];
format short; simlp(f, A, b)
ans =
21.8750
53.1250
This is the same answer we obtained before. Note that we entered the
negative of the coefficient vector for the objective function
P
because
simlp
searches for a
minimum
rather than a maximum. Note also that the
nonnegativity constraints are accounted for in the last two rows of
A
and
b
.
Well, we could have done this problem by hand. But suppose that the
farmer is dealing with a third crop, say corn, and that the corresponding
data are
cost per acre
$150
.
75
yield per acre
125 bushels
profit per bushel
$1
.
56
.
If we denote the number of acres allotted to corn by
z
, then the objective
function becomes
P
=
(110)(1
.
30)
x
+
(30)(2
.
00)
y
+
(125)(1
.
56)
=
143
x
+
60
y
+
195
z
,
and the constraint inequalities are
120
x
+
210
y
+
150
.
75
z
≤
15
,
000
110
x
+
30
y
+
125
z
≤
4
,
000
x
+
y
+
z
≤
75
x
≥
0
,
y
≥
0
,
z
≥
0
.
The problem is solved with
simlp
as follows:
clearfAb;f=[-143 -60 -195];
A = [120 210 150.75; 110 30 125; 1 1 1;...
Search WWH ::
Custom Search