1 / 54

Warm-up: What to eat?

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.

rey
Download Presentation

Warm-up: What to eat?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 What is the cheapest way to stay “healthy” with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?

  2. Announcements Assignments: P2 • Due Thu 10/3, 10 pm P3 • Will be released later today • Due Thu 10/17, 10 pm HW5 (written) • Released Tue 10/1 • Due Tue 10/8, 10 pm Sat 10/5, 10 pm

  3. AI: Representation and Problem Solving Optimization & Linear Programming Instructors: Fei Fang & Pat Virtue Slide credits: CMU AI, http://ai.berkeley.edu

  4. Learning Objectives Formulate a problem as a Linear Program (LP) Convert a LP into a required form, e.g., inequality form Plot the graphical representation of a linear optimization problem with two variables and find the optimal solution Understand the relationship between optimal solution of an LP and the intersections of constraints Describe and implement a LP solver based on vertex enumeration Describe the high-level idea of Simplex algorithm Next Lecture

  5. Recap What have we learned so far? What do they have in common? This lecture: Continuous space General formulation

  6. Focus of Today: (Linear) Optimization Problem Problem Description Graphical Representation Linear Programming Linear Program Formulation s.t. Notation Alert!

  7. Diet Problem: 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 What is the cheapest way to stay “healthy” with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?

  8. Problem Formulation Can we formulate it as a Constraint Satisfaction Problem? Variable: Domain: Constraint: What are the issues with this CSP formulation? Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg What is the cheapest way to stay “healthy” with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?

  9. Problem Formulation Optimization problem: Finding the best solution from all feasible solutions From CSP to Optimization Problem Variable Domain Constraint Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Objective s.t. Notation Alert!

  10. Problem Formulation Formulate Diet Problem as an optimization problem s.t. Variable: Objective: Constraints: Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg

  11. Problem Formulation Formulate Diet Problem as an optimization problem s.t.𝑖𝑛 𝑟𝑒𝑞𝑢𝑖𝑟𝑒𝑑 𝑟𝑎𝑛𝑔𝑒 Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg . : ounces for stir-fry, : ounces for boba What is the expression of

  12. Problem Formulation Formulate Diet Problem as an optimization problem s.t. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg

  13. Piazza Poll 1 Is , a feasible solution of the following optimization problem? s.t. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg

  14. Linear Programming Linear program in Inequality Form • Linear Programming: • Technique for the optimization of a linear objective function subject to linear equality and linear inequality constraints Example Linear program s.t. s.t.

  15. Recap of Linear Algebra , What is ? ? What does mean? (Note: It is fine if you directly write )

  16. Recap of Linear Algebra What is ? , What is ?

  17. Problem Formulation s.t. Convert it into the following inequality form, what should , , and be? s.t.

  18. Problem Formulation s.t. Convert it into the following inequality form, what should , , and be? s.t.

  19. Piazza Poll 2 What has to increase to add more nutrition constraints? s.t. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg …(More Constraints) Select all that apply length length height width length

  20. Piazza Poll 2 What has to increase to add more nutrition constraints? s.t. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Sugar g

  21. Question What has to increase to add more menu items? s.t. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg Select all that apply length length height width length

  22. Question What has to increase to add more menu items? s.t. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg

  23. Question If , which of the following also equals ? s.t. Select all that apply length length length

  24. Linear Programming Different forms Inequality form General form Standard form s.t. s.t. s.t. A Important to pay attention to form! Can switch between formulations! Note: Different books have different definitions. We will refer to the forms in this slide (also consistent with B&V book).

  25. Focus of Today: (Linear) Optimization Problem Problem Description Graphical Representation Linear Programming Linear Program Formulation s.t.

  26. Shape of Linear Equality Geometry / Algebra Question What is the equality present this line?

  27. Shape of Linear Inequality Geometry / Algebra Question What shape does this inequality represent?

  28. Shape of Linear Inequality Geometry / Algebra Question What shape does these inequalities jointly represent?

  29. Piazza Poll 3 What is the relationship between the half plane: and the vector: Infeasible B Feasible A C D

  30. Lowering Cost Given the cost vector and initial point , Which unit vector step will cause to have the lowest cost ? B A C D

  31. Cost Contours Given the cost vector where will = 0 ?

  32. Cost Contours Given the cost vector where will = 0 ? = 1 ? = 2 ? = -1 ? = -2 ?

  33. Optimizing Cost Given the cost vector , which point in the red polyhedron below can minimize ? = 2 = 1 = 0 = -1

  34. LP Graphical Representation Inequality form s.t. Objective Function Feasible Region

  35. Piazza Poll 4 True or False: An minimizing LP with exactly one constraint, will always have a minimum objective of . s.t.

  36. Focus of Today: (Linear) Optimization Problem Problem Description Graphical Representation Linear Programming Linear Program Formulation s.t.

  37. 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 What is the cheapest way to stay “healthy” with this menu? How much stir-fry (ounce) and boba (fluid ounces) should we buy?

  38. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg s.t. What is the feasible region? What is the optimal solution?

  39. Healthy Squad Goals Calories 2500 Sugar 100 g Calcium 700 mg s.t. What is the feasible region? What is the optimal solution?

  40. Healthy Squad Goals Calories Sugar 100 g s.t. What is the feasible region? What is the optimal solution?

  41. Healthy Squad Goals Calories Sugar 100 g s.t. What is the feasible region? What is the optimal solution?

  42. Healthy Squad Goals 2000 Calories 2500 Sugar 100 g Calcium 700 mg s.t. What is the feasible region? What is the optimal solution?

  43. Solving an LP If LP is feasible and bounded, at least one solution is at feasible intersections of constraint boundaries! • Algorithms • Vertex enumeration: Find all vertices of feasible region (feasible intersections), check objective value

  44. Solving an LP But, how do we find the intersections? Calorie min s.t. Calorie max Sugar Calcium A point is the intersection of two lines Pick two lines: two rows in matrix time equals the corresponding rows in Intersection Not any pair of rows can lead to an intersection

  45. Solving an LP If LP is feasible and bounded, at least one solution is at feasible intersections of constraint boundaries! • Algorithms • Vertex enumeration: Find all vertices of feasible region (feasible intersections), check objective value • Simplex: Start with an arbitrary vertex. Iteratively move to a best neighboring vertex until no better neighbor found Simplex is most similar to which Local Search algorithm? Hill Climbing!

  46. Solving an LP If LP is feasible and bounded, at least one solution is at feasible intersections of constraint boundaries! • Algorithms • Vertex enumeration: Find all vertices of feasible region (feasible intersections), check objective value • Simplex: Start with an arbitrary vertex. Iteratively move to a best neighboring vertex until no better neighbor found

  47. Solving an LP But, how do we find a neighboring intersection? Calorie min s.t. Calorie max Sugar Calcium Intersection determined by: two rows in matrix time equals the corresponding rows in Intersection A neighboring intersection only have one different row Neighboring intersection Neighboring intersection

  48. Focus of Today: (Linear) Optimization Problem Problem Description Graphical Representation Linear Programming Linear Program Formulation s.t.

  49. “Marty, you’re not thinking fourth-dimensionally”

  50. Shapes in higher dimensions How do these linear shapes extend to 3-D, N-D? 2-D 3-D N-D

More Related