Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16388

Meal plan algorithm closest to x calories with types

$
0
0

I have a problem where I need to generate a meal plan with:

  • x number of meals per day (eg. 5)
  • x number of meal types in the plan (eg. 2 breakfasts, 2 snacks and 1 lunch)
  • Number of calories in meal plan (eg. 2000)
  • There should be no duplicate meals

The given data is a list of dictionaries (over 100,000 units) structured this way:

{'title': 'Cannellini Bean and Asparagus Salad with Mushrooms', 'types': ['side dish', 'lunch', 'main course', 'salad', 'main dish', 'dinner'], 'calories': 482}

The output of the algorithm should be a list of x meals closest to the x calories, with their associated meal types.

I have no idea where to start with this problem, any algorithm type or implementation is welcome.


Viewing all articles
Browse latest Browse all 16388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>