Вы находитесь на странице: 1из 8

Let us solve the following problem (Example 3 in Section 4.

3 of the text) graphically:


Maximize p = 0.12x + 0.10y
subject to the constraints
x + y <= 25
x
>= 10
-x + 2y >= 0
x >= 0, y >= 0
The first step is to graph the feasible region using the techniques of Section 4.2 (See the Excel Tutorial).
1. Solve the associated equations for y (or for x if it is not possible to solve for y):
y = 25 - x
A
x = 10
B
y = 0.5x
C
2. Now complete the following table and graph the associated lines (as in the tutorial for Section 4.1)
X

Y
0
30
10
10
0
30

3. To obtain the corner points, it would be nice to get Excel to solve the associated systems of two equations.
One of the corner points is the intersection of lines A and C
Here is the augmented matrix of the system of equations:
Lines
A
C

1
-1

1
2

25
0

To get the solution, highlight a pair of empty cells, type =MMULT(MINVERSE(B38:C39),D38:D39),


and hit Contrl+Shift+Enter

4. OK Let us now do all the corner points at once:


Lines
A
C
A

Corner Point
1
-1
1

1
2
1

25
0
25

Value of P = 0.12x + 0.1

B
B
C

1
1
-1

0
0
2

10
10
0

To see how to use solver to find the solution of any linear programming problem without graphing, see the
"Using Solver" spreadsheet.

l for Section 4.1)

ystems of two equations.

8:C39),D38:D39),

Value of P = 0.12x + 0.10y

Using Solver to Solve Linear Programming Problems


Let us once again solve the problem
Maximize p = 0.12x + 0.10y
subject to the constraints
x + y <= 25
x
>= 10
-x + 2y >= 0
x >= 0, y >= 0
But this time, using "Solver"
Accessing Solver
If "Solver" does not appear in the "Tools" menu, you need to add it as using the "Add-Ins"
option, also on the Tools menu. Follow Tools -> Add-Ins to select Solver as an active Add-In.
Setting up the Problem
Solver works by starting with a "guess" for x and y (which can be anything) and then using
numerical methods to find values of x and y that give the optimal value for the objective.
We set up the problems as follows, starting with the initial guess for x and y and the
objective function p.
x
833.333333

p
0

100

Objective function

Initial Guess (use any values .. they will change)


Next, enter the left-hand sides and right-hand sides of the inequalities using the values of x and y
(Click on each cell to see the formula.)
Left-Hand Side
833.333333
833.333333
-833.333333
833.333333
0

<=
>=
>=
>=
>=

Right-Hand Side
25
10
0
0
0

Solving with Solver


1. Click on the value of the objective function (cell D25).
2. Bring up the Solver window (Tools -> Solver)
3. It should say "Set target cell $D$25 equal to Max". (If not, change the cell reference
and/or make sure "Max" has been selected.
4. "By changing cells" refers to the cells containing the values of x and y: $B$25 and $C$25.
Highlight both, so that the field should say $B$25:$C$25
5. Now add the inequalities one-at-a-time by pressing the "Add" button.
Every time you press"Add", enter the Left-hand-side cell as the "Cell Reference"
and the right-hand-side as the "Constraint", and be sure to check that the correct
inequality (<=, =, or >=) is selected.

6. Press "Solve".

sing the "Add-Ins"


as an active Add-In.

ng) and then using


for the objective.
nd y and the

sing the values of x and y

change the cell reference

es of x and y: $B$25 and $C$25.

s the "Cell Reference"


o check that the correct

Вам также может понравиться