### Similar presentations

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

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

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

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

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

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

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…

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…

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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)

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

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)

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

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)

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

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

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

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

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

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

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

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)

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

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