Hello, this is @doctorbme. This post is very late because I’ve been very tied up with work these days. Today, I would like to talk about how AI can be used in meal planning. In this topic, I am planning to write several columns about it since I will try to cover various perspectives.

  1. Application and considerations of AI in meal planning of average people
  2. Application and considerations of AI in meal planning of patients
  3. Application and considerations of AI in extracting useful data from meal plans
  4. Companies and services that pursue AI application in meal planning

Before discussing these perspectives, I must first define the ‘optimization problem.’

What does it mean to present an optimal meal plan? What is the meaning of ‘optimization’ here? In fact, it is necessary to take a look at what optimization truly means.

Meal planning as an optimization problem

An optimization problem can be defined by a mathematical formula.

It is simply a task of finding x for the minimum or maximum value of a given function f(x). Of course, in order to find x, the domain must first be defined. Moreover, it must have restrictive conditions which can be expressed as other functions: h(x) or g(x).

Of the functions f, h, g,
seeking the value of x that satisfies h(x)=0 or g(x)≤0,
and also maximizes or minimizes f(x) at the same time

Response to a real-life (diet) problem

It's important to address this abstract problem with the actual field. Just like the topic of today, various factors must be considered in order to organize an appropriate meal plan for someone. Total calories, total amount and rate of carbohydrates/fats/proteins, amounts of electrolytes such as sodium/potassium, and other various substances such as vitamins, are all adjusted according to each person's body condition, muscle mass, and amount of exercise. For instance, if x represents daily meals, a function f can be defined that takes these meals as inputs.

In this case, assume a person has their own preferences for each food. Then, it would be easy to find a meal plan that relates to this preference or taste. In short, there is a philosophy that tries to reflect their tastes.

Then how should the restriction condition be set? It would be better to set the calories and nutrition that were mentioned before. They shouldn't be too much or too little.

For example, consider the following condition.
(I will assume that maximizing the objective function f that reflects preference is the important objective.)

This demonstrates that the meal plan should provide total calories between 2000~3000 kCal.

The above function is used to calculate the calories for a give meal x. How could we represent this as an optimization problem?

First, set up two conditions like those above, and then define new functions like those shown below

and define the following conditions.

In other words, the mathematical form of the preceding optimization problem, in fact, reflects the general situation.

Structure of input x

How can the preference function f(x) be defined? There may be some differences in definition among different studies, but let's assume we can establish this for every meal plan. For preference of some foods, user can directly input numbers in advance, or automatically determine preferences according to established meal plans.

For instance, it can be defined as the following:

In other words, according to the above definition, each component of the vector is given under the assumption that a person has 5 meals per day. Then, how can a breakfast meal plan be defined? (It is hierarchically defined.)

If it is defined in this way, breakfast could be defined as a coordination of each dish. Now, an attribute of these foods can be defined. There are many other methods, but one way it can be defined is as follows. (These aspects can become more complex as per how many options they consider.)

Eventually, foods will be coordinated as a way to enlarge preferences. At this point, it is necessary to consider amounts of carbohydrate input and amounts of sodium constraint, according to recommended dietary allowance and one's condition (considering limiting conditions). In order to deduce values accurately, characteristic of each food should be clearly defined. Preference f can be applied by simply adding the preference or finding the mean. Or, instead of preference, other attributes can be applied to f, meaning f can be defined in various ways.

Most simply, f – function of preference – is defined in the direction of simply adding preferences of various foods which are included in f. In other words, if it is defined as f=preference of chosen food 1 + preference of chosen food 2+ … There is one thing to be aware of. As foods are chosen, the sum of the preferences of food increases, which eventually increases f. Thus, if a valid limiting condition is not set-up, limitless foods can be chosen. So, if you think of another function, n(x), and you think of n(x) as a function of counting the number of elements of x, you can specify n(x) as a specific number, or a fixed range. For example, it is same as the following:

In this circumstance, it means to limit the sum of all number of foods within 3~5.

Then does it mean 5 is always chosen? Not always. If other restrictive conditions are added, this matter will become a type of knapsack problem. A knapsack problem is a way to maximize weight after filling up a limited space with an object of a certain volume. It is considered that the more the space is filled, the heavier it becomes. But not exactly. For example, think of an object that fills up a 5L space. At this point, there are three types of objects with (2L, 3kg), (3L, 4kg), and (4L, 8kg). If properties of these objects are observed, the volume would be completely filled with two chosen objects of 2L and 3L. But it would weigh 7kg less than choosing the last object of 4L. This kind of situation also occurs at this time.

Weight can be applied to each food additionally. We may eat one serving of stir-fried rice cake as a standard. But you may also eat other food after eating a small 0.5 serving of it. In other words, the meal plan we serve could be considered as a linear combination.

Eventually, if optimized values are found, it will be composed as the following equation. (It is a simple example.)

breakfast = (apple 50g, cereal 100g, milk 100g)
lunch = (rice 200g, seaweed soup 150g, …)
Snack= (none) …

To apply any area of machine learning or an artificial intelligence technique, an ontological view of the art that can first be used and that consists of the essential information must be found. This is often called knowledge-based AI. In terms of coordinating information, opinions of professionals in the field and knowledge or field knowledge are reflected.

In the next session, I will demonstrate how to organize complex problems based on this information, how to find an optimal meal plan, and the difference in composition of a meal when seeking an optimum meal plan.

For example, by using a genetic algorithm, there exists a way to search for the local optimum of each value, and there is also a way to derive new solutions through case-based reasoning and adaptation to new cases.


  1. In order to apply artificial intelligence to the problem of meal planning, it is first necessary to examine the aspects of optimization.
  2. In order to process meal plan information to utilize an algorithm in real life, field knowledge and stored structure are important.

[1] Khan AS, Hoffmann A. , Building a case-based diet recommendation system without a knowledge engineer, Artif Intell Med. 2003 Feb;27(2):155-79.
[2] Gaál B, Vassányi I, Kozmann G. , A novel artificial intelligence method for weekly dietary menu planning. , Methods Inf Med. 2005;44(5):655-64.
[3] Johan Aberg, Dealing with Malnutrition: A Meal Planning System for Elderly, AAAI Spring Symposium: Argumentation for Consumers of Healthcare, 2006

The first STEEM medical magazine written by professionals

  • Tag
  • 0
  • 0
  • View@Mediteam.us 1100
Next Article : [AI in meal planning] Methods and characteristics of finding…
Comments :: Steem 에서 댓글 달기
Next Article : [AI in meal planning] Methods and characteristics of finding…