1 Minimizing Cost while Meeting Nutritional Requirements – An Example of Linear Programming Is it mathematically possible to create a healthy diet from.

Slides:



Advertisements
Similar presentations
Copyright © 2000, Denise Sakai Troxell. All rights reserved. (updated from © Joe Aieta and Denise Sakai Troxell – Summer 1999.) Solving Linear Optimization.
Advertisements

Table of Contents Solving Linear Inequalities Graphically It is assumed you already know how to solve linear inequalities algebraically. A inequality is.
Understanding optimum solution
LIAL HORNSBY SCHNEIDER
Linear Programming Problem
Linear Programming (graphical + simplex with duality) Based on Linear optimization in application by Sui lan Tang. Linear Programme (LP) for Optimization.
Chapter 5 Linear Inequalities and Linear Programming
5.2 Linear Programming in two dimensions: a geometric approach In this section, we will explore applications which utilize the graph of a system of linear.
Linear Inequalities and Linear Programming Chapter 5 Dr.Hayk Melikyan/ Department of Mathematics and CS/ Linear Programming in two dimensions:
Learning Objectives for Section 5.3
Chapter 5 Linear Inequalities and Linear Programming Section 3 Linear Programming in Two Dimensions: A Geometric Approach.
Linear Programming Pre-Calc Section 3.4 Running a profitable business requires a careful balancing of resources (for example, peoples’ time, materials,
Managerial Decision Modeling with Spreadsheets
Operations Management Dr. Ron Lembke
1 Optimization and Linear Programming: Calzones vs. Mini-Pizzas How can we optimize revenues in a pizza parlor by varying the production of one delicious.
QM B Linear Programming
Linear Inequalities in Two Variables
Solver & Optimization Problems n An optimization problem is a problem in which we wish to determine the best values for decision variables that will maximize.
6  Graphing Systems of Linear Inequalities in Two Variables  Linear Programming Problems  Graphical Solutions of Linear Programming Problems  The Simplex.
4.3.1 – Systems of Inequalities. Recall, we solved systems of equations What defined a system? How did you find the solutions to the system?
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
Non-Linear Simultaneous Equations
Linear Programming Models: Graphical and Computer Methods
Linear programming Lecture (4) and lecture (5). Recall An optimization problem is a decision problem in which we are choosing among several decisions.
START EXCEL BUILD OR RETRIEVE YOUR OPTIMIZATION MODEL SAVE YOUR WORKBOOK!! CHOOSE “Solver…” IN THE “Tools” MENU SPECIFY IN SOLVER DIALOG BOX: 1.CELL TO.
1 The Role of Sensitivity Analysis of the Optimal Solution Is the optimal solution sensitive to changes in input parameters? Possible reasons for asking.
Chapter 19 Linear Programming McGraw-Hill/Irwin
Copyright © Cengage Learning. All rights reserved.
Chapter 1 Equations, Inequalities, and Mathematical Models
Linear Programming: Basic Concepts
1 1 Slide Linear Programming (LP) Problem n A mathematical programming problem is one that seeks to maximize an objective function subject to constraints.
We can make Product1 and Product2. There are 3 resources; Resource1, Resource2, Resource3. Product1 needs one hour of Resource1, nothing of Resource2,
Graphing Linear Inequalities in Two Variables Chapter 4 – Section 1.
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Systems of Inequalities in Two Variables Sec. 7.5a.
Copyright © 2013, 2009, 2005 Pearson Education, Inc. 1 5 Systems and Matrices Copyright © 2013, 2009, 2005 Pearson Education, Inc.
Chapter 5 Review Advanced Algebra 1. System of Equations and Inequalities - System of Linear Equations in Two Variables - Solutions of Linear Inequalities.
Linear Inequalities and Linear Programming Chapter 5 Dr.Hayk Melikyan Department of Mathematics and CS
Section 3.7 Graphing Linear Inequalities. Objectives Determine whether an ordered pair is a solution of an inequality Graph a linear inequality in two.
Systems of Equations and Inequalities Systems of Linear Equations: Substitution and Elimination Matrices Determinants Systems of Non-linear Equations Systems.
 System of Equations › Solutions to a two equation system › Solutions to a three equation system › Solutions to a system of inequalities  Break Even.
3  Graphing Systems of Linear Inequalities in Two Variables  Linear Programming Problems  Graphical Solutions of Linear Programming Problems  Sensitivity.
Rev.S08 MAC 1140 Module 9 System of Equations and Inequalities I.
Graphing Linear Inequalities in Two Variables
McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Supplement 6 Linear Programming.
1 1 Slide © 2008 Thomson South-Western. All Rights Reserved Slides by JOHN LOUCKS St. Edward’s University.
Linear Programming: A Geometric Approach3 Graphing Systems of Linear Inequalities in Two Variables Linear Programming Problems Graphical Solution of Linear.
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Linear programming Lecture (4) and lecture (5). Recall An optimization problem is a decision problem in which we are choosing among several decisions.
Copyright © 2012 Pearson Education, Inc. Publishing as Addison Wesley CHAPTER 6: Systems of Equations and Matrices 6.1 Systems of Equations in Two Variables.
Solving Linear Optimization Problems Using the Solver Add-in.
Chapter 9: Systems of Equations and Inequalities; Matrices
Calzones vs. Mini-Pizzas – A Linear Programming Problem
Chapter 5 Linear Inequalities and Linear Programming
Table of Contents Chapter 5 (What-If Analysis for Linear Programming)
Excel Solver IE 469 Spring 2017.
Excel Solver IE 469 Spring 2018.
Wyndor Example; Enter data
Introduction to linear programming (LP): Minimization
Lial/Hungerford/Holcomb/Mullins: Mathematics with Applications 11e Finite Mathematics with Applications 11e Copyright ©2015 Pearson Education, Inc. All.
Do Now! Solve the system of equations Do all work on the notecard.
Excel Solver IE 469 Fall 2018.
Chapter 7: Systems of Equations and Inequalities; Matrices
Copyright © 2019 Pearson Education, Inc.
Solving Linear Optimization Problems Using the Solver Add-in
TBF Generall Mathematics - II Lecture – 8 : Linear Inequalities
Excel Solver IE 469 Spring 2019.
BUS-221 Quantitative Methods
Presentation transcript:

1 Minimizing Cost while Meeting Nutritional Requirements – An Example of Linear Programming Is it mathematically possible to create a healthy diet from your favorite foods while minimizing costs? Prepared for SSAC by *Yu-Ju Kuo – Indiana University of Pennsylvania* © The Washington Center for Improving the Quality of Undergraduate Education. All rights reserved. *2007* Supporting Quantitative concepts and skills Linear Equations Linear Inequalities Multivariable function: inclined plane Level lines (contours) Excel Solver SSAC2007.QP141.YJK1.1 Core Quantitative Concept Linear Programming

2 Slides 4-6 Give background information about linear programming – systems of linear inequalities, the feasible set, and the location of the solution to a linear programming model. Slides 7-8 Set up a simplified dietary model using two foods and two nutrition requirements. Slides 9-11 Overview Excel Solver and demonstrate its use by solving a simplified dietary problem. Slides 11 Poses “what-if questions” to explore the model of the simplified dietary problem. Slides 12 Gives the End of Module Assignment, in which you consider a more realistic dietary problem. Overview of Module The “Dietary Problem” is important in our daily lives. The key issue is whether you get enough nutrition from your choice of foods, while at the same time paying the minimum cost or consuming the minimum calories. In this activity, we will set up the Dietary Problem as a linear programming model, discuss how the solution appears on a graph, and then use Excel’s Solver feature to solve the problem.

3 We will assume that your favorite foods are broccoli and carrots We will further assume that you eat only these two favorite foods. Problem Our approach: We let x = servings of broccoli and y = servings of carrots. A linear programming model includes two parts, a linear objective function of x and y and a set of linear constraints on x and y. The set of pairs (x,y) that satisfy all constraints is called the feasible set. The objective function is the function which you would like to minimize or maximize over the feasible set. How many servings of broccoli and carrots should you eat each day to satisfy the nutrition requirements for protein and iron – keeping in mind that you also want to minimize the cost of your food? You will need numbers – the daily requirements for protein and iron; the amount of protein and iron per serving of broccoli and carrots; the cost per serving of broccoli and carrots. Definition: A linear function in two variables is defined as f(x,y)=ax+by+c, where a, b, and c are constants.

4 Background information-Feasible Set As background, we consider the values of x, y, that satisfy all of the following linear inequalities: What is an inequality? If x=1 and y=3, is ( x,y ) a solution to 2x  y ≤ 3 ? How do we find the solution set that satisfies 2x-y≤3 graphically? Definition: The solution set to an inequality ax+by≤ c, where a, b, and c are constants, is the collection of all ordered pairs ( x,y ) such that ax+by≤ c is true. How many pairs of ( x,y ) satisfy 2x  – y ≤ 3 ? Step 1: Graph the equality. Step 2: Pick a point on one side of the line. Plug it into the inequality and verify whether the inequality is true. Step 3: If the point makes the inequality true, then the whole half- side in which the point is located is the solution set to the inequality. Otherwise, the other side of the line is the solution set. Think carefully about Step 3 and explain why!! The half-plane that contains arrows is the solution set of 2x – y ≤ 3.

5 Background Information-Feasible Set Now, repeat the same process for the rest of inequalities and then find the overlap of all the solution sets. The solution This yellow area is the solution set of all five inequalities from the previous slide. This set is the feasible set. Next, we consider an expression 3x  y. What point in the yellow area would give the minimum value for 3x  y and what would be that minimum value be? Refer to the red box of Slide 3. What do we call this expression 3x  y ? What do we call the five inequalities? We are looking for the minimum of 3x  y over this yellow area; therefore, 3x  y is the objective function and the five inequalities from previous slide are our constraints. Now we can write this example into the standard form of a linear programming model (LP): Minimize 3x  y subject to (s.t.): 2x  y ≤ 3, x + y ≤ 10,.5x  y ≤  1, x≥0, and y ≥0 Definition: A solution of a minimization LP is a point in the feasible set that achieves the minimum of the objective function. Note: The dashed lines on the boundary of the feasible set are also part of the feasible set.

6 Background Information-Solution of Linear Programming Similar to the graph from the previous slide, the yellow region here is the feasible set from the five constraints. The set of parallel lines show contours of the objective function, z = 3 x  y. Carefully look at the above graph. The objective function is an inclined plane. Look at the contours on the plane: Which direction is z decreasing? Where in the feasible set does the lowest value of z occur? Note the color spectrum. Theorem: If the feasible set of a LP is not empty, then at least one corner point of the feasible set is a solution of the LP. If a LP has only one solution, where would it be? Is it possible to have more than one solution for a LP? Is it possible to have no solution for a LP? The feasible set Answers

7 Simplified Dietary Model Now, we can set up a LP to minimize the cost of our two foods subject to two nutrition requirements? To begin, we will start by introducing the data set. ID FoodsPrice/ServingServing SizeCaloriesProtein(g)Vit_C (IU)Calcium(mg)Iron(mg) 1 Frozen Broccoli Oz Pkg Carrots,Raw0.071/2 Cup Shredded Celery, Raw0.041 Stalk Frozen Corn0.181/2 Cup Leave the slide show mode, then double click the Excel icon to obtain the table. 8 8 grams of protein in one serving (10 oz) of frozen broccoli milligrams of Iron in one serving (1/2 cup) of raw carrots IU IU: international unit, a unit of measurement for the amount of a substance. Assumptions: 1. Eat only broccoli and carrots. 2. All nutrition in food consumed is completely absorbed 3. Protein requirement per day is at least 45 g per day. Iron requirement per day is no more than 24 mg per day. Define: x : # of servings of broccoli per day y : # of servings of carrots per day What is the cost for two servings of broccoli? 0.16 x y What is the cost for x servings of broccoli? What is the total cost of broccoli and carrots per day?

8 Simplified Dietary Model What is the objective function? Minimize 0.16 x y Now, let us consider the protein requirement : at least 45 grams per day. Since there are 8 grams of protein per serving and you consume x servings of broccoli per day, you absorb 8 x grams of protein from broccoli. Since you need at least 45 g of protein per day, that means the total amount of protein per day should be greater than or equal to 45 g, i.e., 8 x +0.6 y ≥45 How many grams of protein will come from carrots? Write the inequality associated with the iron requirement, no more than 24 mg per day. 2.3 x +0.3 y ≤ 24 The complete linear programming model will look as follows: Minimize 0.16 x y s.t. 8 x +0.6 y ≥ x +0.3 y ≤24, x,y, ≥0 Why should x and y be greater than or equal to 0? 0.16 is the price per serving for broccoli is the price per serving for carrots.

9 Step 1: a) In Column B, enter the ID of your choice of foods. b) Use Cells D50 and D51 for the variables (# of servings for broccoli and carrot). c) Use the LOOKUP command to find the names(C50:C51), prices(E50:E51), and nutrition (F50:I51) of the foods (using the ID entered in Column B). Excel Solver In this portion, we will introduce the Excel solver through the following steps: Step 1: Extract data for foods, such as names, price per serving, nutrition contents. Step 2: Build objective function and constraints. Step 3: Enter necessary information for the Solver. Step 4: Run the Solver and interpret the result. If you have not used Excel Solver or are not familiar with LOOKUP or SUMPRODUCT command, please click here for help.here Excel Preview = cell with a number in it = cell with a formula in it =LOOKUP(B51,$B$3:$B$42,$F$3:$F$42)

10 Excel Solver Step 2: a) Recall: Objective function = (Price per serving for broccoli )times( # of serving for broccoli)+ (Price per serving for carrots) times ( # of serving for carrots). b) Prices per servings are in E50 and E51, # of servings are in D50 and D51, thus the objective function is D50*E50+D51*E51. c) To extend the problem later on, we could also use SUMPRODUCT. d) Similarly, look at the left hand side of constraints and rewrite them using SUMPRODUCT and enter them into D62 and D63. Note: D59, D62, and D63 will be 0 after you enter the formula since the initial values for variables are zeros. The solutions will be returned to those cells after the solver is run. e) Insert appropriate inequality symbols for E62 and E63. Enter the right hand side of constraints into F62 and F63. Step 3: a) Click Tools and find solver, then you will see the following pop-up. b) Use “ADD” to add constraints. c) Click Solve to continue. Step 3: d) If the Solver found a solution, Click OK to continue. Carefully read this part of pop-up window before you continue. =SUMPRODUCT(D50:D51, E50:E51)

11 Excel Solver-What if questions. Step 3: e) Solution is as follows 1.Write your answer in a complete sentence in the context of the problem. 2.Explain why D63 is Choose Poached Eggs and Regular butter and run the solver (Step 3) again. a) Explain what happens in the result. b) What would be a better way to set up nutrition constraints for iron such that there is always a certain amount of iron consumed? 4.Choose Oatmeal Cookies and Chocolate Chip cookies. Use the original iron requirement (no more than 24 mg per day) and run the solver again. a) What does it say in the Solver Result pop-up? b) Use the background information for feasible set discussed earlier to graph the feasible set of two nutrition constraints. Explain what happens to the solver. SolutionMinimum cost

12 End of Module Assignment 1. Expand your Excel sheet so that it will work for any six choices of food and four nutrition requirements (Protein, Iron, Vitamin C, Calcium). a) It is recommended to set up nutrition constraints that are suitable for your individual case. b) Test your spreadsheet with your six choices of food. 2. A company produces two products, A and B. Both products use one raw material with the maximum daily availability 240 lb. The usage rates of the raw material are 2 lb per unit of A and 4 lb per unit of B. Each unit of A and B require 4 hours and 6 hours, respectively. The unit prices for A and B are $20 and $50, respectively. a) Write the linear programming model to maximize the revenue of these two products. b) Use Excel Solver to find the number of units for A and B to achieve the maximum revenue. Optional: In Excel Solver’s Step 1, combine IF and LOOKUP to build a formula such that Excel checks whether the food ID is entered before using LOOKUP to extract data.

13 Get Ready for Excel Solver = cell with a number in it = cell with a formula in it In this portion, we will introduce important commands for this module: LOOKUP, SUMPRODUCT. Step1: Open a new Excel worksheet and enter the information as below. Click on Tools and check whether Solver is on the list. If it is listed, skip the Step 0. If Solver is not listed, please follow Step 0 to add-in the solver. Step 0: a) Click Tools, then Add-in. b) Check the box next to Solver Add-in, then click OK. c) Click in a open worksheet and check again whether Solver is listed under Tools.

14 Get Ready for Excel Solver Step 3: Consider 9 servings of frozen broccoli and 5 servings of frozen corn, how much is the total cost? Mathematically, Total cost= (# of servings of broccoli) times(broccoli’s cost per serving)+(# of serving of corn) times (corn’s cost per serving). Thus, the total cost is the sum of the product of # of servings and cost per serving. Command format: SUMPRODUCT(array1, arrray2) Step 2: Now we would like to extract the names and the prices of foods. For example, Excel should look for the ID given in B10 from the ID list (B3:B7), then return the name of the food associated with the ID in B10 from the Name list (C3:C7). Enter the formulas for C10, C11, E10, and E11. Command Format: LOOKUP(lookup_value,lookup_vector,result_vector) Return =LOOKUP(B11, $B$3:$B$7, $D$3:$D$7) =SUMPRODCUT(D10:D11, E10:E11) Array 1 Array 2

15 Answers to Questions on Slide 6 If a LP has only one solution, where would it be? Is it possible to have more than one solution for a LP? Is it possible to have no solution for a LP? It would be at a corner point of the feasible set. Assume that none of constrains is parallel to the contours of the objective function. For a minimization LP, this corner point will be the last point where the decreasing contour lines intersect w/ the feasible set. On the other hand, for a maximization LP, the corner point will be the last point where the increasing contour lines intersect with the feasible set. Yes, it is possible. If one of the boundary lines of the feasible set coincides with one of the decreasing contours, there will be infinite solutions for a minimization LP. On the other hand, if one of the boundary lines of the feasible set coincides with one of the increasing contours, there will be infinite solutions for a maximization LP. Note that in the graph below, there are infinite solutions for the minimization LP, but there is a unique solution for the maximization LP. Yes, it is possible. When the feasible set is empty, there will be no solution. Study figure in Slide 5. Return