Title: Agricultural Economics
1AgEc 301 Agricultural Economics I
Slide Set 15 Chapter 9
Linear Programming Part 2
2Our Previous LP Example
We wish to maximize profit from the production of
two goods, X and Y, where X has a profit
contribution of 12 per unit and Y 9 per
unit. In equation form this is
3Our Previous LP Example
The constraints can be illustrated in table form
as follows
4Our Previous LP Example
- Re-writing the constraints in equation form gives
us
5Constraint on resource A
6Solution
- Note, the graphic solution occurs at the corner
where constraints on inputs B and C are binding. -
- Thus, we could rewrite these constraints as
equalities and solve for QX and QY.
7Solution
- 4QX 2QY 32
- Minus 2QX 2QY 20
- Equals 2QX 12
- Or QX 6
- And it follows that QY 4
8Algebraic Specification
- As you can probably guess, it doesnt take a very
complicated LP problem to be too large to try and
solve graphically. - Thus, we must also know how to set up and solve
these problems algebraically (and using computer
software).
9Slack Variables
- In order to solve an LP problem algebraically, we
must introduce the concept of slack variables. - Slack variables represent the unused portion of a
resource (excess capacity).
10Slack Variables
- When slack variables are used, we can rewrite the
constraints as equalities. For example, allowing
SA to represent the unused units of resource A,
our first constraint can be rewritten - 4QX 2QY SA 32
11Slack Variables
- SA then will take on whatever value needed to
convert the inequality to an equality. - If the constraint is binding then SA 0
12Slack Variables
- Rewriting our constraint set we obtain
- 4QX 2QY SA 32
- 1QX 1QY SB 10
- 3QY SC 21
13Slack Variables
- The addition of slack variables simplifies
algebraic analysis and also provide us with
important information for planning. - A value of zero indicates a binding constraint,
while a positive value indicates excess capacity.
14Algebraic Solution
- The complete specification is now
- Subject to
- 4QX 2QY SA 32
- 1QX 1QY SB 10
- 3QY SC 21
15Algebraic Solution
- The implied nonnegativity constraints should be
included for the complete specification - The slack variables are included in the
nonnegativity constraints - Why?
16Algebraic Solution
- The problem is to solve this system for values of
the Q and S variables (5 unknowns).
Unfortunately, we have only 3 constraint
equations, so we cannot solve this without
additional information.
17Algebraic Solution
- In order to solve this problem, we can exploit
the fact that LP solutions occur at corners of
the feasible region. - At each corner, the number of unknowns is exactly
equal to the number of known constraint
conditions.
18Algebraic Solution
- A solution can be obtained for each corner of the
feasible region.
19(No Transcript)
20Algebraic Solution
- At each corner, the constraints can be expressed
as a system of three equations with three
unknowns. For example at point N - SA 0
- QY 0, and
- 4QX 2QY SA 32
21Algebraic Solution
- So, this system can be solved as
- 4QX 2QY SA 32
- 4QX 2(0) (0) 32
- 4QX 32
- QX 8
22Algebraic Solution
- This procedure can be repeated at each of the
corner points, and the values for the Qs plugged
into the objective function to calculate profit
at each corner.
23Algebraic Solution
- This iterative process is followed in what is
called the simplex solution method. - We will not go through the simplex method here
(not by hand anyway). Solvers use the simplex
method to quickly solve LP problems.
24Solving the LP with Excel
- In order to solve LP problems in Excel, you need
to adopt a very consistent method for
constructing the problem. - Consistency avoids confusion in this case because
the solver requires you to do some of the work.
25Solving the LP with Excel
- Step 1. Write the objective function. Label
adjacent cells (in different columns) as the
prices or profit contributions. - Under these enter the numeric price or profit
contribution for each production alternative
26Solving the LP with Excel
For example
27Solving the LP with Excel
- Then, in similar fashion, set up two cells for
the quantities of X and Y to be produced. For
the time being set these equal to 1.
28Solving the LP with Excel
- In this example cells A4 and B4 are important,
all of our formulas will refer to these cells. - To finish Step 1, we must put the formula for the
objective function into the spreadsheet. - A2A4 B2B4
29Solving the LP with Excel
It will look like this
30Solving the LP with Excel
- Step 2. In the same manner as the objective
function, construct your constraint set. - It is helpful to write the problem out in
equation form before doing this.
31Solving the LP with Excel
- One additional thing is required in Step 2 for
setting the problem up for Excel. - You must add a cell that contains the total units
of that constraint used.
32Solving the LP with Excel
Here cell D6 contains the formula A6A4
B6B4
33Solving the LP with Excel
- Step 3. Next to the cells which calculate the
total of each resource used, enter the resource
constraints.
34Solving the LP with Excel
35Solving the LP with Excel
- Step 4. Now that we have all the pieces
assembled, we can use the Excel solver. - To do this, from the Tools menu, select solver.
36Solving the LP with Excel
- Set Target Cell will be E2
- Equal to will be Max
- By changing cells will be A4B4
- Each constraint will be entered as
- D6 lt E6
37Solving the LP with Excel
38Solving the LP with Excel
- Now, simply click Solve and the program will
automatically find the optimal solution for you. - Once the solution is found you can have Excel
print it to a new spreadsheet ply by selecting
answer and clicking OK
39Solving the LP with Excel
40Solving the LP with Excel