Download presentation
Presentation is loading. Please wait.
Published byCristobal Smuin Modified over 10 years ago
1
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Solving Linear Optimization Problems with Excel Solver for Microsoft Excel 2000
2
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) A Linear Optimization Problem a diet problem Julia wonders if she can keep the amount of fat in her diet down and still get all the protein (45 g), carbohydrate (256 g), and calories (1,980 kcal) that she needs every day by eating fast food only. For other nutrients, such as vitamins, iron, and calcium, she will depend on pills. She chooses her favorite fast foods: hamburger and french fries. The nutritive values per serving are given below. How many servings of hamburger and fries would Julia need to eat to satisfy her daily diet requirements? 396220Calories (kcal) 32 Carbohydrate (g) 315Protein (g) 1810Fat (g) FriesHamburger
3
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Formulate the Problem as a Linear Programming problem constraints that minimizes the total amount of fat subject to the following minimum diet requirements HB = the number of servings of hamburger FF = the number of servings of french fries 15 HB + 3 FF 45 Protein constraint Julia is looking for objective function 10 HB + 18 FF decision variables nonnegativity constraints 32 HB + 32 FF 256 Carbohydrate constraint 220 HB + 396 FF 1980 Calories constraint Of course HB 0 and FF 0
4
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver start with a blank sheet
5
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter labels Enter row labels in cells A2:A6
6
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter labels Enter column labels in cells B1:F1
7
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter labels Enter inequalities in cells E4:E6
8
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter labels NOTE: These labels are not essential for the use of Solver
9
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter constants Enter coefficients of objective function in cells B3:C3 Remember… 10 HB + 18 FF Fat
10
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter constants Enter coefficients of left side of constraints in cells B4:C6 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember…
11
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter constants Enter right sides of constraints in cells F4:F6 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember…
12
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells Highlight cells B1:C2
13
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells Click on Insert
14
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells Click on Name
15
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells Click on Create
16
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells
17
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells Make sure the Top row (containing the names HB and FF) box is checked
18
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells Click on OK
19
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver name decision variables cells Cell C2 is named FF and is currently blank Cell B2 is named HB and is currently blank
20
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3 Click on cell D3
21
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Type in = Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
22
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Click on cell B3 Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
23
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Type in * Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
24
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Click on cell B2 Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
25
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Type in + Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
26
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Click on cell C3 Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
27
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Type in * Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
28
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Click on cell C2 Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
29
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Press Enter Remember… 10 HB + 18 FF Fat NOTE: Objective function formula in cell D3
30
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formula for objective function Click on cell D3 to check formula Remember… 10 HB + 18 FF Fat NOTE: This step is not essential for the use of Solver
31
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Remember… 10 HB + 18 FF Fat NOTE: The formula is equivalent to =B3*$B$2+C3*$C$2. Blanks in cells HB and FF (cells B2 and C2) are considered zeros Preparing the Worksheet for Solver enter formula for objective function Current value of formula entered in cell D3 Formula entered in cell D3
32
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… NOTE: Formulas for the left sides of the constraints in cells D4:D6
33
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints + Click on cell D3 and grab the fill handle + on the lower right corner 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… NOTE: Formulas for the left sides of the constraints in cells D4:D6
34
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints + Drag the fill handle + down to cell D6 NOTE: The formula in cell D3 will be copied down to cell D6 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… NOTE: Formulas for the left sides of the constraints in cells D4:D6
35
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… NOTE: Formulas for the left sides of the constraints in cells D4:D6
36
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… Click on cell D4 to check formula NOTE: This step is not essential for the use of Solver
37
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… Current value of formula entered in cell D4 Formula entered in cell D4 (Protein) NOTE: The rows for column B and C were copied as relative references while HB and FF remained fixed
38
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… Preparing the Worksheet for Solver enter formulas for constraints Click on cell D5 to check formula NOTE: This step is not essential for the use of Solver
39
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… Current value of formula entered in cell D5 Formula entered in cell D5 (Carbohydrate)
40
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… Preparing the Worksheet for Solver enter formulas for constraints Click on cell D6 to check formula NOTE: This step is not essential for the use of Solver
41
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints 15 HB + 3 FF 45 Protein 32 HB + 32 FF 256 Carbohydrate 220 HB + 396 FF 1980 Calories Remember… Current value of formula entered in cell D6 Formula entered in cell D6 (Calories)
42
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Preparing the Worksheet for Solver enter formulas for constraints NOTE: These cells will be colored to indicate that they are essential for Solver Objective function formula in cell D3 Decision variable values in cells B2:C2
43
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver invoke Solver Click on Tools
44
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver invoke Solver Click on Solver
45
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver invoke Solver
46
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Click on cell D3 NOTE: The cell displayed in the Set Target Cell: box must contain the objective function formula (cell D3)
47
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Check the Min: circle
48
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Click on the By Changing Cells: box
49
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box NOTE: The By Changing Cells: box must display the decision variable cells (cells B2:C2) Highlight cells B2:C2
50
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box NOTE: The Subject to the Constraints: box must contain the constraints on the decision variables Click on Add
51
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Click on the Cell Reference: box
52
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Highlight cells D4:D6
53
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Click on to select constraint types
54
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Click on >=
55
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Click on the Constraint: box
56
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Highlight cells F4:F6
57
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver complete the Solver Parameters dialog box Click on OK NOTE: Different type constraints must be entered separately
58
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver set the Options Click on Options
59
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver set the Options Check the Assume Linear Model and the Assume Non-Negative boxes NOTE: The formula (in the Target Cell D3) is linear on the non-negative variables (HB in B2 and FF in C2)
60
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver set the Options Accept the remaining default options by clicking on OK
61
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver execute Solver Click on Solve
62
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver read solution NOTE: Solver uses a method known as SIMPLEX This solution contains Protein: 105 g Carbohydrate: 256 g Calories: 1980 kcal satisfying the constraints Solver finds a solution HB = 6.75 servings of Hamburger FF = 1.25 servings of French fries with minimum fat content of 90 g
63
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver obtain the Answer Report Click on Answer
64
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver end execution Click on OK
65
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver view the Answer Report Click on the Answer Report tab
66
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver read the Answer Report NOTE: Resize window for a complete view of the spreadsheet portion
67
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Using Solver read the Answer Report Solver finds a solution HB = 6.75 servings of Hamburger FF = 1.25 servings of French fries with minimum fat content of 90 g This solution contains Protein: 105 g Carbohydrate: 256 g Calories: 1980 kcal satisfying the constraints
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.