Tải bản đầy đủ (.pdf) (5 trang)

Sử dụng hàm Solver trong Excel

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.5 MB, 5 trang )

Linear Programming Using Excel
Subject: Linear Programming using Excel
Application: Microsoft Excel 2007
Task: Solving a Linear Program Using Excel
Install the Solver Add-In
1. In the Microsoft Office button, go to excel options to click Add-ins
2. In the Add-Ins box, select Solver Add-In and click Go
Install the Solver Add-In (continue)
3. In the Add-Ins available box, check the Analysis ToolPak and then OK
4.2 Exercises 307
To initiate the program, select
PRGM
<SMPLX>
ENTER
, and you will see the screens

Enter the first pivot column, column 1 and
ENTER
, to obtain the screens

The ratios 240 and 150 indicate the second row is the pivot row. Press
ENTER
and enter 2.
Press
ENTER
to obtain the next tableau.
A B C D
1
2
3
4


5
6
Using Excel
Using Solver
Excel has a program, Solver, that does the computations for a linear programming problem. We use the follow-
ing example to illustrate how it is used.
Maximize z 5 5x
1
1 8x
2
1 7x
3
subject to
3x
1
1 2x
2
1 x
3
Յ 660
x
1
1 4x
2
1 2x
3
Յ 740
2x
1
1 x

2
1 3x
3
Յ 853
x
1
Ն 0, x
2
Ն 0, x
3
Ն 0
Here’s how we set up the problem.
We use the cells A1:C1 for the values of the variables x
1
, x
2
, and x
3
. Solver will adjust the values of the
variables until the objective function reaches the optimal value. We begin by entering x
1
5 0 in A1, x
2
5 0 in
B1, and x
3
5 0 in C1. Next we enter the formulas for the left side of the constraints, the nonnegative conditions
and the objective function in column D, and the number on the right side in column E.
Unless otherwise noted, all content on this page is © Cengage Learning.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has

deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
308 Chapter 4 Linear Programming: The Simplex Method
To start up Solver, click on the Data tab. Move to the Analysis group and click on Solver.
• PlacethecursorintheboxnexttoSet Target Cell, or Set Objective, depending on your version of Excel.
• SelectcellD7, since this is the location of the formula for the objective function.
• Checkthebuttontomaximize, since this is a maximization problem.
Excel 2007 Excel 2010

Place the cursor in the box under By changing cells: and then select cells A1:C1 (the cells containing the
variables).
Excel 2007 Excel 2010

You are now ready to enter the constraints.
Move the cursor to the box under Subject to the Constraints: and click on the button shown as Add to
obtain
Make sure the cursor is in the box under Cell Reference: and select cell D1; then move the cursor to the box
under Constraint: and select the cell E1.
Click the Add button. Repeat the preceding step using cells D2 and E2, then D3 and E3. Click Ok.
You have entered the constraints. Note that the constraints have the symbol ,5 between Cell Reference:
and Constraint: (this represents #).
Excel 2007 Excel 2010

Unless otherwise noted, all content on this page is © Cengage Learning.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
4.2 Exercises 309
Click on the Add button to enter the nonnegative conditions. Again place the cursor in the Cell Reference:
box and select cell D4. Then select E4 for the Constraint: box. Since this is a nonnegative condition, we need
the $ symbol; get it by selecting .5. Then click Add.
In the same way, enter the nonnegative constraints using D5, E5 and D6, E6. You will then have the screen

Excel 2007 Excel 2010

Now set the options for Solver, depending on your version.
Excel 2007 Excel 2010
Click into the Options box, and make sure Make sure the Simplex LP method is selected in the
that the Assume Linear Model checkbox is dialog box.
checked, as in the following figure.
Leave all other options as is, and click Ok.

Click on the Solve button to obtain the solution.
The maximum value of z 5 2386 at (116, 63, 186).
Unless otherwise noted, all content on this page is © Cengage Learning.
Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

×