Download presentation
Presentation is loading. Please wait.
Published byAgus Iskandar Modified over 5 years ago
1
Solving Linear Optimization Problems Using the Solver Add-in
2
Start with a problem to be formulated
The 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 (nutritionists would disapprove, but this example ought to be simple). She chooses her favorite fast foods: hamburger and French fries. The nutritive values per serving are given below. Hamburger Fries Fat (g) Protein (g) Carbohydrate (g) Calories (kcal) How many servings of hamburger and fries would Julia need to eat to satisfy her daily diet requirements?
3
Formulate the Model as a Linear Programming Problem
Julia is looking for HB = the number of servings of Hamburger decision variables FF = the number of servings of French Fries that minimizes the total amount of fat objective function 10 HB FF subject to the following minimum diet requirements constraints 15 HB FF >= Protein constraint 32 HB FF >= Carbohydrate constraint 220 HB FF >= Calories constraint nonnegativity constraints Of course HB >= 0 and FF >= 0
4
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants Enter labels in cells A2:A6
5
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants NOTE: The labels in A4:A6 name the 3 constraints in this problem Enter labels in cells B1:E1
6
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants Enter coefficients of objective function in cells B3:C3 10 HB FF NOTE: The labels in cells B1:C1 name the 2 variables in this problem
7
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants Enter coefficients of left side of Protein constraint in cells B4:C4 15 HB FF
8
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants Enter coefficients of left side of Carbohydrate constraint in cells B5:C5 32 HB FF
9
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants Enter coefficients of left side of Calories constraint in cells B6:C6 220 HB FF
10
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants Enter right sides of constraint in cells E4:E6 15 HB FF >= 45 32 HB FF >= 256 220 HB FF >= 1980
11
Preparing the Worksheet for Solver
start with blank sheet & enter labels and constants
12
name the cells for the two decision variables
Preparing the Worksheet for Solver name the cells for the two decision variables Highlight the four cells B1:C2
13
name the cells for the two decision variables
Preparing the Worksheet for Solver name the cells for the two decision variables Starting from the main menu bar click on Insert
14
name the cells for the two decision variables
Preparing the Worksheet for Solver name the cells for the two decision variables Click on Name
15
name the cells for the two decision variables
Preparing the Worksheet for Solver name the cells for the two decision variables Click on Create
16
name the cells for the two decision variables
Preparing the Worksheet for Solver name the cells for the two decision variables Make sure the Top row box is checked
17
name the cells for the two decision variables
Preparing the Worksheet for Solver name the cells for the two decision variables Click OK
18
name the cells for the two decision variables
Preparing the Worksheet for Solver name the cells for the two decision variables Cell B2 has the name HB and is currently blank Cell C2 has the name FF and is currently blank
19
enter the formula for the objective function
Preparing the Worksheet for Solver enter the formula for the objective function Click on cell D3
20
enter the formula for the objective function
Preparing the Worksheet for Solver enter the formula for the objective function Click on cell B3 Type =
21
enter the formula for the objective function
Preparing the Worksheet for Solver enter the formula for the objective function Click on cell B2 Type *
22
enter the formula for the objective function
Preparing the Worksheet for Solver enter the formula for the objective function Click on cell C3 Type +
23
enter the formula for the objective function
Preparing the Worksheet for Solver enter the formula for the objective function Click on cell C2 Type *
24
enter the formula for the objective function
Preparing the Worksheet for Solver enter the formula for the objective function formula entered in D3 objective function (Fat content) HB FF current value for the formula entered in D NOTE: Blanks in HB and FF (cells B2 and C2) are considered zeros NOTE: The formula B3*HB+C3*FF could have been typed in cell D3 directly Enter
25
copying down the formulas for totals
Preparing the Worksheet for Solver copying down the formulas for totals Click on cell D3 and grab the fill handle + in the lower right corner
26
copying down the formulas for totals
Preparing the Worksheet for Solver copying down the formulas for totals Copy the formula in D3 down to cell D6
27
copying down the formulas for totals
Preparing the Worksheet for Solver copying down the formulas for totals formula copied in D4 Protein constraint LHS HB FF current value for the formula entered in D4 Click on cell D4 to check your formula
28
copying down the formulas for totals
Preparing the Worksheet for Solver copying down the formulas for totals formula copied in D5 Carbohydrate constraint LHS 32 HB FF current value for the formula entered in D5 Click on cell D5 to check your formula
29
copying down the formulas for totals
Preparing the Worksheet for Solver copying down the formulas for totals formula copied in D6 Calories constraint LHS 220 HB FF current value for the formula entered in D6 Click on cell D6 to check your formula
30
Preparing the Worksheet for Solver
copying down the formulas for totals NOTE: In the formula, the rows for column B and C have been copied as relative references and the references to the decision variables HB (cell B2) and FF (cell C2), are fixed
31
invoking Solver Add-In from the Tools menu
Using Solver invoking Solver Add-In from the Tools menu Starting from the main menu bar click on Tools
32
invoking Solver Add-In from the Tools menu
Using Solver invoking Solver Add-In from the Tools menu Click on Solver
33
invoking Solver Add-In from the Tools menu
Using Solver invoking Solver Add-In from the Tools menu NOTE: From this point on, only the spreadsheet portion of the Excel window will be displayed
34
select the value of the objective function as the Target Cell
Using Solver select the value of the objective function as the Target Cell Click on the Set Target Cell: box
35
select the value of the objective function as the Target Cell
Using Solver select the value of the objective function as the Target Cell Click on cell D3 which contains the function we want to optimize
36
indicate if the Target Cell is to be minimized/maximized
Using Solver indicate if the Target Cell is to be minimized/maximized Check the Min radio button to indicate that we want to minimize the value in the Target Cell
37
the Changing Cells are the decision variables
Using Solver the Changing Cells are the decision variables Click on the By Changing Cells: box
38
the Changing Cells are the decision variables
Using Solver the Changing Cells are the decision variables Highlight cells B2:C2 containing the decision variables
39
Using Solver add Constraints
Click on the Subject to the Constraints: box
40
Using Solver add Constraints Click on Add
41
select the constraints’ left-hand-sides
Using Solver select the constraints’ left-hand-sides Click on the Cell Reference: box
42
select the constraints’ left-hand-sides
Using Solver select the constraints’ left-hand-sides Highlight cells D4:D6
43
select the constraints’ left-hand-sides
Using Solver select the constraints’ left-hand-sides
44
select the constraints’ types
Using Solver select the constraints’ types Click on
45
select the constraints’ types
Using Solver select the constraints’ types Click on >=
46
select the constraints’ right-hand-sides
Using Solver select the constraints’ right-hand-sides Click on the Constraint: box
47
select the constraints’ right-hand-sides
Using Solver select the constraints’ right-hand-sides Highlight cells E4:E6
48
select the constraints’ right-hand-sides
Using Solver select the constraints’ right-hand-sides NOTE: Since the three constraints in the Diet Problem are of type >= they can be added all at once. Click on OK
49
Using Solver setting the Options Click on Options
50
Using Solver setting the Options
Check Assume Linear Model and Assume Non-Negative boxes (do not modify the other Options for this problem)
51
Using Solver setting the Options Click OK
52
Using Solver executing Solver Click on Solve
53
obtaining solutions from the worksheet
Using Solver obtaining solutions from the worksheet Solver finds a solution HB = servings of Hamburger FF = servings of French fries with minimum fat content of 90 g This solution contains Protein: g Carbohydrate: g Calories: kcal satisfying the constraints Solver uses a method known as SIMPLEX
54
obtaining an Answer Report
Using Solver obtaining an Answer Report Click on Answer in the Reports box
55
obtaining an Answer Report
Using Solver obtaining an Answer Report Click on OK
56
viewing the Answer Report
Using Solver viewing the Answer Report Click on Answer Report 1 tab
57
viewing the Answer Report
Using Solver viewing the Answer Report NOTE: From this point on, only the spreadsheet portion of the Excel window will be displayed
58
viewing the Answer Report
Using Solver viewing the Answer Report with minimum fat content of 90 g Solution HB = servings of Hamburger FF = servings of French fries and with Protein: g Carbohydrate: g Calories: kcal satisfying the constraints Final steps in any solution involve an interpretation of these computer-generated results
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.