Cách sử dụng hàm Solver trong Excel, ứng dụng vào tính toán trong môn Quy hoạch tuyến tính
Trang 1Linear 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
Trang 23 In the Add-Ins available box, check the Analysis ToolPak and then OK
Trang 34.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
3
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 5x1 1 8x2 1 7x3 subject to
3x1 1 2x2 1 x3 660
x1 1 4x2 1 2x3 740
2x1 1 x2 1 3x3 853
x1 0, x2 0, x3 0 Here’s how we set up the problem
We use the cells A1:C1 for the values of the variables x1, x2, and x3 Solver will adjust the values of the
variables until the objective function reaches the optimal value We begin by entering x1 5 0 in A1, x2 5 0 in
B1, and x3 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
Trang 4To 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.
Place the cursor in the box under By changing cells: and then select cells A1:C1 (the cells containing the
variables)
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 #).
Trang 54.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
Now set the options for Solver, depending on your version.
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