Ultimate Meal Planner Team Meal Mechanics Sierra Cockerill

  • Slides: 17
Download presentation
Ultimate Meal Planner Team Meal Mechanics: Sierra Cockerill Weston Jones Gabriel Keith

Ultimate Meal Planner Team Meal Mechanics: Sierra Cockerill Weston Jones Gabriel Keith

Informal description Purpose of the application: Constraint satisfaction on a meal Process description: Given

Informal description Purpose of the application: Constraint satisfaction on a meal Process description: Given a desired amount of macronutrients (protein, fat, carbohydrates), return a “basket” of food items to comprise a meal that fits the constraints within a certain fitness score.

Formal description

Formal description

Example: Bodybuilder Meal Input: 75 g protein, 10 g fat, 52 g carbs Output:

Example: Bodybuilder Meal Input: 75 g protein, 10 g fat, 52 g carbs Output: Fish, smelt, rainbow, cooked, dry heat: {19. 21, 2. 64, 0. 0} Catsup: {0. 18, 0. 02, 4. 66} Luncheon sausage, pork and beef: {3. 54, 4. 81, 0. 36} Catsup, low sodium: {0. 18, 0. 02, 4. 66} Celtuce, raw: {0. 07, 0. 02, 0. 29} Carrots, cooked, boiled, drained, with salt: {0. 07, 0. 02, 0. 8} Roast beef, deli style, prepackaged, sliced: {1. 73, 0. 34, 0. 06} Fish, grouper, mixed species, cooked, dry heat: {21. 11, 1. 1, 0. 0} Crustaceans, lobster, northern, cooked, moist heat: {27. 55, 1. 25, 0. 0} Butterbur, canned: {0. 14, 0. 16, 0. 47} Candies, marshmallows: {0. 9, 0. 1, 40. 65} Coriander (cilantro) leaves, raw: {0. 09, 0. 02, 0. 15}

Test Data Pulled data from USDA database Parsed JSON objects into a Food. Item

Test Data Pulled data from USDA database Parsed JSON objects into a Food. Item data type

Algorithms Hill Climbing Genetic Exhaustive Search

Algorithms Hill Climbing Genetic Exhaustive Search

Metrics for Algorithm Comparison Computational time Fitness score Difference of least squares Time and

Metrics for Algorithm Comparison Computational time Fitness score Difference of least squares Time and Space Complexity

Hill Climbing Description Start with a basket with one random item While score <

Hill Climbing Description Start with a basket with one random item While score < maximum acceptable score: Get random new item that has not yet been “visited” Iterate through items already in the basket to decide what to do Three possibilities to best improve basket score: Keep new item and remove an item previously in the basket Keep new item and remove nothing Discard new item If all items in the store have been checked and score is still not acceptable, clear “visited” map and allow items to be reconsidered If no solution is found, clear entire basket and start with a new initial item

Hill Climbing Analysis Performance given a maximum acceptable score of 3. 0: Average time:

Hill Climbing Analysis Performance given a maximum acceptable score of 3. 0: Average time: 317455 nanoseconds Average score: 1. 96 Time Complexity: O(nm) n = number of items in the store m = number of items in the basket Worst case: every item in the store is compared to every item in the basket at the time of that iteration

Hill Climbing example

Hill Climbing example

Genetic

Genetic

Exhaustive Search Naïve implementation of an exhaustive search Creates the power set of every

Exhaustive Search Naïve implementation of an exhaustive search Creates the power set of every possible combination of food items in a Grocery. Store subset Creates all possible basket configurations (of a given size) Returns the basket with the best fitness score according to the requirements Input : Dietary Requirements, a Grocery. Store collection, Array of Combinations Typical Output : Cheese substitute, mozzarella: {12. 96, 13. 81, 26. 75} Celtuce, raw: {0. 07, 0. 02, 0. 29} … Game meat , bison, ground, raw: {15. 87, 13. 54, 0. 0}

Exhaustive Search Analysis Calculating the best basket of all possible combinations of 6 -item

Exhaustive Search Analysis Calculating the best basket of all possible combinations of 6 -item baskets Average time: 622830 Average score: 60. 775 Time Complexity: O(n 2 n + n) Combination Generation: O(n 2 n) Finding Best Result: O(+n)

Comparison Summary Hill Climbing: Average time: 317455 nanoseconds Average score: 1. 96 Genetic: Average

Comparison Summary Hill Climbing: Average time: 317455 nanoseconds Average score: 1. 96 Genetic: Average time: 622830 Average score: 60. 775 Exhaustive Search: Average time: Average score:

Question 1 Question: Hill climbing does not always return the BEST solution possible in

Question 1 Question: Hill climbing does not always return the BEST solution possible in the data set. What makes it a good algorithm for real-world constraint satisfaction problems? Answer: It can return a valid solution (even if not the BEST solution) in a small amount of time (if it is interrupted, if there is a time limit, etc).

Question 2 Question: To find all possible unique combinations of sets of integers based

Question 2 Question: To find all possible unique combinations of sets of integers based on a collection of unique numbers how many total unique combinations should there be? Answer: The powerset P(S) of a set S would demonstrate all possible combinations of the values in a set of numbers. If S has n elements in it then P(s) will have 2 n elements

Question 3 Question: Answer:

Question 3 Question: Answer: