Finding Optimal Food Choices for Health
Trying to eat healthy by determining the best amount of stir-fry and boba to purchase based on calorie, sugar, and calcium goals. Analyzing the cost, calories, sugar, and calcium content of each food item to make informed decisions. The goal is to maintain health while optimizing expenses and nutritional intake.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Warm-up: What to eat? We are trying healthy by finding the optimal amount of food to purchase. We can choose the amount of stir-fry (ounce) and boba (fluid ounces). Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Food Cost Calories Sugar Calcium Stir-fry (per oz) 1 100 3 20 Boba (per fl oz) 0.5 50 4 70 What is the cheapest way to stay healthy with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?
Announcements Assignments: P1: Search & Games Due Thu 2/6, 10 pm HW4 (written) Due Tue 2/11, 10 pm P2: Optimization Released later this week Due Thu 2/20, 10 pm Slip days
Announcements Midterm 1 Exam Mon 2/17, in class
AI: Representation and Problem Solving Linear Programming Instructors: Pat Virtue & Stephanie Rosenthal Slide credits: CMU AI, http://ai.berkeley.edu
Warm-up: What to eat? We are trying healthy by finding the optimal amount of food to purchase. We can choose the amount of stir-fry (ounce) and boba (fluid ounces). Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Food Cost Calories Sugar Calcium Stir-fry (per oz) 1 100 3 20 Boba (per fl oz) 0.5 50 4 70 What is the cheapest way to stay healthy with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?
Optimization Graphical Representation Problem Description Optimization Representation ??? min ? s.t. ?? ?
Warm-up: What to eat? We are trying healthy by finding the optimal amount of food to purchase. We can choose the amount of stir-fry (ounce) and boba (fluid ounces). Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Food Cost Calories Sugar Calcium Stir-fry (per oz) 1 100 3 20 Boba (per fl oz) 0.5 50 4 70 What is the cheapest way to stay healthy with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?
Constraint Satisfaction Problems Map coloring ??? ? s.t. ? ????????? ???????????
Constraint Satisfaction Problems Map coloring ??? ? s.t. ? ????????? ??????????? Notation Alert!
What to eat? We are trying healthy by finding the optimal amount of food to purchase. We can choose the amount of stir-fry (ounce) and boba (fluid ounces). Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Food Cost Calories Sugar Calcium Stir-fry (per oz) 1 100 3 20 Boba (per fl oz) 0.5 50 4 70 What is the cheapest way to stay healthy with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?
Optimization Formulation Diet Problem ??? ? s.t. ? ????????? ??????????? Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Cost Calories Calciu m Food Sugar Stir-fry (per oz) 1 100 3 20 Notation Alert! Boba (per fl oz) 0.5 50 4 70
Optimization Formulation Diet Problem min ? ????(?) Objective s.t. ? ????????? ??????????? Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Cost Calories Calciu m Food Sugar Stir-fry (per oz) 1 100 3 20 Notation Alert! Boba (per fl oz) 0.5 50 4 70
Optimization Formulation Diet Problem min ? s.t. ???????? ? ????????? ????? ? ????? calcium ? ????? ????(?) Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Cost Calories Food Sugar Calcium Stir-fry (per oz) 1 100 3 20 Boba (per fl oz) 0.5 50 4 70
Optimization Formulation Diet Problem min ?1, ?2 s.t. 100 ?1+ 50 ?2 2000 100 ?1+ 50 ?2 2500 3 ?1+ 4 ?2 100 20 ?1+ 70 ?2 700 1 ?1+ 0.5 ?2 Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Cost Calories Food Sugar Calcium Stir-fry (per oz) 1 100 3 20 Boba (per fl oz) 0.5 50 4 70 Notation Alert!
Optimization Formulation Diet Problem min ?1, ?2 s.t. ?1,1 ?1+ ?1,2 ?2 ?1 ?2,1 ?1+ ?2,2 ?2 ?2 ?3,1 ?1+ ?3,2 ?2 ?3 ?4,1 ?1+ ?4,2 ?2 ?4 ?1 ?1+ ?2 ?2 Cost 1 ? = 0.5 Limit 2000 2500 100 700 Calorie min Calorie max Sugar Calcium 100 100 3 20 50 50 4 70 ? = ? = Notation Alert!
Optimization Formulation Diet Problem ??? min ? s.t. ?1,1 ?1+ ?1,2 ?2 ?1 ?2,1 ?1+ ?2,2 ?2 ?2 ?3,1 ?1+ ?3,2 ?2 ?3 ?4,1 ?1+ ?4,2 ?2 ?4 Cost 1 ? = 0.5 Limit 2000 2500 100 700 Calorie min Calorie max Sugar Calcium 100 100 3 20 50 50 4 70 ? = ? = Notation Alert!
Optimization Formulation Diet Problem ??? min ? s.t. ?1,1 ?1 ?1,2 ?2 ?1 ?2,1 ?1+ ?2,2 ?2 ?2 ?3,1 ?1+ ?3,2 ?2 ?3 ?4,1 ?1 ?4,2 ?2 ?4 Cost 1 ? = 0.5 Limit 2000 2500 100 700 Calorie min Calorie max Sugar Calcium 100 100 3 20 50 50 4 70 ? = ? =
Optimization Formulation Diet Problem ??? min ? s.t. ?1,1 ?1+ ?1,2 ?2 ?1 ?2,1 ?1+ ?2,2 ?2 ?2 ?3,1 ?1+ ?3,2 ?2 ?3 ?4,1 ?1+ ?4,2 ?2 ?4 Cost 1 ? = 0.5 Limit 2000 2500 100 700 Calorie min Calorie max Sugar Calcium 100 100 3 20 50 50 4 70 ? = ? =
Optimization Formulation Diet Problem ??? min ? s.t. ?? ? Cost 1 ? = 0.5 Limit 2000 2500 100 700 Calorie min Calorie max Sugar Calcium 100 100 3 20 50 50 4 70 ? = ? = Notation Alert!
Piazza Poll 1 What has to increase to add more nutrition constraints? ??? min ? s.t. ?? ? Select all that apply A) length ? B) length ? C) height ? D) width ? E) length ?
Piazza Poll 1 What has to increase to add more nutrition constraints? ??? min ? s.t. ?? ? 2000 2500 100 700 100 100 3 20 50 50 4 70 ?1 ?2 1 ? = ? = ? = ? = 0.5
Piazza Poll 2 What has to increase to add more menu items? ??? min ? s.t. ?? ? Select all that apply A) length ? B) length ? C) height ? D) width ? E) length ?
Piazza Poll 2 What has to increase to add more nutrition constraints? ??? min ? s.t. ?? ? 2000 2500 100 700 100 100 3 20 50 50 4 70 ?1 ?2 1 ? = ? = ? = ? = 0.5
Question If ? ? ?, which of the following also equals ?? ??? min ? s.t. ?? ? Select all that apply A) length ? B) length ? C) length ? Notation Alert!
Linear Programming Linear objective with linear constraints ??? min ?. s.t. ?? ? As opposed to general optimization min ?. s.t. ??? 0, ? = 1 ? ?? ?0? ?? = ??, ? = 1 ?
Linear Programming Different formulations Inequality form General form Standard form ??? ??? + ? ??? min ?. s.t. ?? ? min. ? s.t. ?? ? ?? = ? min. ? s.t. A? = ? ? 0 Important to pay attention to form!
Linear Programming Different formulations Inequality form General form Standard form ??? ??? + ? ??? min ?. s.t. ?? ? min. ? s.t. ?? ? ?? = ? min. ? s.t. A? = ? ? 0 Can switch between formulations!
Optimization Graphical Representation Problem Description Optimization Representation ??? min ? s.t. ?? ?
Graphics Representation Geometry / Algebra I Quiz What shape does this inequality represent? ?1 ?1+ ?2 ?2 ?1
Graphics Representation Geometry / Algebra I Quiz What shape does this inequality represent? ?1 ?1+ ?2 ?2= ?1 ?1 ?1+ ?2 ?2 ?1 ?1,1 ?1+ ?1,2 ?2 ?1 ?2,1 ?1+ ?2,2 ?2 ?2 ?3,1 ?1+ ?3,2 ?2 ?3 ?4,1 ?1+ ?4,2 ?2 ?4
Piazza Poll 3 What is the relationship between the half plane: ?1 ?1+ ?2 ?2 ?1 and the vector: ? ?1,?2 ?2 Infeasible B Feasible A C D ?1
Piazza Poll 4 ? and initial point ?(0), Given the cost vector ?1,?2 Which unit vector step ?will cause ?(1)= ?(0)+ ? to have the lowest cost ???(1)? B A ? C D Notation Alert!
Cost Contours ? where will Given the cost vector ?1,?2 ??? = 0 ?
Cost Contours ? where will Given the cost vector ?1,?2 ??? = 0 ? ??? = 1 ? ??? = 2 ? ??? = -1 ? ??? = -2 ?
LP Graphical Representation Inequality form ??? min ?. s.t. ?? ?
LP Graphical Representation Inequality form, with no constraints ??? min ?.
LP Graphical Representation Inequality form, with no constraints ??? min ?. s.t. ?1?1+ ?2?2 ?
Piazza Poll 5 True or False: An minimizing LP with exactly one constraint, will always have a minimum objective at . ??? min ?. s.t. ?1?1+ ?2?2 ?
Optimization Graphical Representation Problem Description Optimization Representation ??? min ? s.t. ?? ?
Warm-up: What to eat? We are trying healthy by finding the optimal amount of food to purchase. We can choose the amount of stir-fry (ounce) and boba (fluid ounces). Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Food Cost Calories Sugar Calcium Stir-fry (per oz) 1 100 3 20 Boba (per fl oz) 0.5 50 4 70 What is the cheapest way to stay healthy with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?
Optimization Formulation Diet Problem ??? min ? s.t. ?? ? Cost 1 ? = 0.5 Limit 2000 2500 100 700 Calorie min Calorie max Sugar Calcium 100 100 3 20 50 50 4 70 ? = ? =
Solving an LP Solutions are at feasible intersections of constraint boundaries!!
Solving an LP Solutions are at feasible intersections of constraint boundaries!!