Graphics Programs Reference
In-Depth Information
-1 0 0; 0 -1 0; 0 0 -1];
b = [15000; 4000; 75; 0; 0; 0];
simlp(f, A, b)
ans =
0.0000
56.5789
18.4211
So the farmer should ditch the wheat and plant 56.5789 acres of barley and
18.4211 acres of corn.
There is no practical limit on the number of variables and constraints that
MATLAB can handle — certainly none that the relatively unsophisticated
user will encounter. Indeed, in many true applications of the technique of
linear programming, one needs to deal withmany variables and constraints.
The solution of such a problem by hand is not feasible, and software such as
MATLAB is crucial to success. For example, in the farming problem with
which we have been working, one could have more than two or three crops.
(Think agribusiness instead of family farmer.) And one could have
constraints that arise from other things besides expenses, storage, and
acreage limitations, for example:
Availability of seed. This might lead to constraint inequalities such as
x j k .
Personal preferences. Thus the farmer's spouse might have a preference
for one variety or group of varieties over another, and insist on a
corresponding planting, thus leading to constraint inequalities such as
x i x j or x 1 + x 2 x 3 .
Government subsidies. It may take a moment's reflection on the
reader's part, but this could lead to inequalities such as x j k .
Below is a sequence of commands that solves exactly such a problem. You
should be able to recognize the objective expression and the constraints from
the data that are entered. But as an aid, you might answer the following
questions:
How many crops are under consideration?
What are the corresponding expenses? How much money is available
for expenses?
What are the yields in each case? What is the storage capacity?
How many acres are available?
Search WWH ::




Custom Search