<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Summary of a Citywide Meal Planning Service for Kids Based on Logic Programming?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Rocco de Felice</string-name>
          <email>rocco.defelice@studenti.unipr.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Stefania Monica</string-name>
          <email>stefania.monica@unimore.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Federico Bergenti</string-name>
          <email>federico.bergenti@unipr.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dipartimento di Scienze Matematiche, Fisiche e Informatiche Universita degli Studi di Parma</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Dipartimento di Scienze e Metodi dell'Ingegneria Universita degli Studi di Modena e Reggio Emilia</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper describes an implemented service, and associated mobile app, that has been used for the last ve school years to support e ective meal planning for kids in Parma, Italy. The service suggests a daily choice of one, two, or three dinner proposals based on what children are expected to eat at the canteens of nurseries, kindergartens, and primary schools. In addition, the service provides proposals for the lunches of non-school days to cover weekends and school holidays. Lunch and dinner proposals are generated by means of a dedicated meal planning service that uses logic programming to solve constraint satisfaction problems associated with meal planning problems. The adopted constraints ensure that the proposals for lunches and dinners are nutritionally balanced throughout the week and that seasonal proposals are preferred to promote the consumption of seasonal vegetables and fruits.</p>
      </abstract>
      <kwd-group>
        <kwd>NUBI Parma</kwd>
        <kwd>Meal planning for kids</kwd>
        <kwd>Constraint satisfac- tion problems</kwd>
        <kwd>Logic programming</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Food is so important in our society that the right to food is accepted in
international laws as a legally binding human right that must be guaranteed to
all individuals. The right to food is derived from the International Covenant
on Economic, Social and Cultural Rights (ICESCR) [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], which was adopted by
the United Nations General Assembly on December 16th, 1966. Basically, the
right to food ensures that all individuals can feed themselves in dignity, that
they have the means to access food, and that available food adequately meets
all dietary needs. The right to food protects the right of all individuals to be
free from hunger, food insecurity, and malnutrition. However, many individuals
still su er from various forms of malnutrition despite the age of well-being that
we experience today in developed countries.
? Copyright c 2021 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).
      </p>
      <p>Malnutrition can be broadly de ned as a pathological state that results from
inadequate nutrition. Actually, inadequate nutrition can be classi ed into
undernutrition (lack of nutrients), overnutrition (surplus of nutrients), and de ciency
of nutrients (e.g., vitamins or minerals). Therefore, malnutrition does not only
occur when the quantity of food is insu cient, but, more generally, when the
nutritional needs are not met in terms of both the quantity and the quality of
food. In the long term, malnutrition can lead to the onset of severe diseases that
negatively impact on the quality of life or that can even reduce life expectancy.
Moreover, when malnutrition is spread among a signi cant portion of the
population of a country, it can severely reduce the overall perceived quality of the
healthcare system of the country.</p>
      <p>Nutritionists are working hard to stem malnutrition by proposing various
tools designed to instill in individuals, from childhood, a correct diet associated
with a healthy lifestyle. One of the several tools proposed to stem malnutrition
is meal planning. Meal planning is the task of organizing and scheduling the
meals that will be consumed by an individual within a day, a week, or a month.
Normally, it is restricted to main meals, i.e., lunches and dinners, but it can also
take into account all other meals, which include breakfast and various snacks.
One of the most relevant characteristics of an e ective meal planning is the
ability to nutritionally balance the considered meals, and therefore, to respect
the desired distribution of the macronutrients, i.e., carbohydrates, proteins, and
lipids, that must be provided through a healthy and balanced diet. In addition,
an e ective meal planning can also reduce food waste by portioning meals in
advance and by controlling the weights of portions. Currently, several software
tools are available to help individuals build their meal plans, for themselves
and for their families. Such tools are normally implemented as mobile apps that
access backend meal planning services. These apps are normally very easy to use,
and they sometimes provide recipes and manage shopping lists. Notably, some
of the available software tools for meal planning are designed for users that need
special meal plans for cultural or health-related reasons.</p>
      <p>This paper brie y describes a meal planning service, and the associated
mobile app, that is currently in use to support e ective meal planning for kids in
Parma, Italy. The mobile app is called NUBI Parma, from NUtrizione BImbi
(childhood nutrition in Italian), and it is the rst mobile app delivered by the
NUBI project. The NUBI project is a joint e ort of the Arti cial Intelligence
Laboratory of the University of Parma, of the Department of Food and Drug of
the University of Parma, and of Madegus (www.madegus.com), a spin-o
company of the University of Parma. The project was conceived to support families
in following e ective meal plans through dedicated mobile apps and educational
services. Currently, the project is running two meal planning services in two
neighboring cities in Italy, namely Parma and Reggio Emilia.</p>
      <p>NUBI Parma o ers to the families living in Parma the opportunity to choose
among one, two, or three dinner proposals based on what children are expected
to eat at the canteens of nurseries, kindergartens, and primary schools of the
municipality of Parma. Also, NUBI Parma provides proposals for non-school day
(a)
(b)
lunches to ensure that lunches and dinners are balanced throughout the week
and during school holidays. All the proposals suggested by NUBI Parma are
seasonal, which ensures that seasonal vegetables and fruits are properly accounted
in meals. Often, proposals are matched with recipes to guarantee that dishes are
properly cooked at home. NUBI Parma has been constantly used for the last ve
school years and, in the 2018{2019 school year, the backend meal planning
service received 136;034 requests for weekly menus by 5;645 mobile devices. Fig. 1
shows screenshots of NUBI Parma running on an Android smartphone.</p>
      <p>The second mobile app delivered by the NUBI project is NUBI Reggio Emilia.
NUBI Reggio Emilia is similar to NUBI Parma, but it is intended for the primary
schools of Reggio Emilia. NUBI Reggio Emilia has been used for the last three
school years to provide dinner proposals in three languages (Italian, English, and
Mandarin) to the kids of seventeen schools, including kids that needs to follow,
for cultural or health-related reasons, one of the ve available special diets.</p>
      <p>This paper is organized as follows. Section 2 contains a brief discussion of
the meal planning service used by NUBI Parma, to summarize its goals and to
concisely present its design. Also, Section 2 discusses how the meal planning
service uses constraint satisfaction problems to solve meal planning problems,
and it brie y overviews the logic program that actually solves obtained constraint
satisfaction problems. Finally, Section 3 concludes the paper with an outlook on
planned developments of NUBI Parma and its meal planning service.
2</p>
    </sec>
    <sec id="sec-2">
      <title>The NUBI Parma Meal Planning Service</title>
      <p>
        NUBI Parma is a mobile app that provides access to the NUBI Parma meal
planning service, which is a dedicated meal planning service designed to provide
healthy and balanced proposals for dinners and non-school day lunches. In
particular, the meal planning service uses the menus of the canteens of supported
institutes, i.e., the nurseries, the kindergartens, and the primary schools of the
municipality of Parma, to ensure that the proposed dinners and non-school day
lunches are properly balanced. The meal planning service provides proposals
based on the recommended food consumption frequencies available in the
guidelines of the World Health Organization [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] and of Regione Emilia-Romagna [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
In addition, the meal planning service takes into account the guidelines for school
nutrition adopted by Ministero della Salute [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and by Ministero dell'Istruzione,
dell'Universita e della Ricerca [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Moreover, the meal planning service considers
other reliable guidelines (e.g., [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]) designed to promote healthy and balanced
diets. Finally, the meal planning service takes also into account the locality and
the seasonality of dishes, as suggested by mentioned guidelines, to promote the
consumption of local and seasonal vegetables and fruits. The adoption of
mentioned guidelines ensures that the meal planning service promotes healthy and
balanced eating behaviors intended to combat overweight, childhood obesity, and
other related pathologies.
2.1
      </p>
      <sec id="sec-2-1">
        <title>Input and output data</title>
        <p>The NUBI Parma meal planning service is an o ine meal planner that suggests
one proposal for every non-school day lunch of the year and one, two, or three
proposals for every dinner of the year. It starts from the planned menus of the
canteens of supported institutes, and it lls the meals table of the database that
is consulted whenever a user accesses the service using NUBI Parma.</p>
        <p>The principal input sources to the meal planner are the menus of the
canteens of supported institutes. Such menus are fed to the planner as three
CommaSeparated Values (CSV ) les, one for each type of institute, i.e., nurseries,
kindergartens, and primary schools, and the planner uses such les to produce a CSV
le that can be immediately used to ll the meals table of the database. Note
that, currently, institutes do not provide their menus as CSV les and, therefore,
the needed CSV les are produced manually every year by extracting relevant
information from the menus of the canteens available on the Web.</p>
        <p>The entries in the input CSV les are numeric identi ers that refer to the
rows of the dishes table of the database, which currently contains 310 dishes
used for dinners and for lunches, at canteens and for non-school days. Each dish
in the dishes table is described by 37 columns, the most relevant of which are:
{ 2 columns to store the numeric identi er and the name of the dish;
{ 10 columns that associate each dish with at least 1 of 10 classes, e.g., for
breakfast, side dish, and vegetable;
{ 7 columns that list the major sources of proteins in each dish, e.g., white
meat, sh, and legumes;
{ 5 columns that list the major sources of carbohydrates in each dish, e.g.,
pasta, rice, and tubers; and
{ 2 columns that describe the characteristics of each dish when the dish is
classi ed as vegetable.</p>
        <p>Note that each dish is associated with a category and with a subcategory on the
basis of the values in the dishes table. Also note that few dishes are classi ed in
the dishes table as single or semi-single. A portion of a single dish (e.g., pizza) is
su cient for a full meal, while a portion of a semi-single dish (e.g., gnocchi alla
romana) is su cient for a full meal only when a portion of bread is also given.</p>
        <p>Most of the dishes in the dishes table are associated with their respective
recipes in the recipes table of the database. The recipe of a dish enumerates the
ingredients of the dish, with their quantities for kids and adults, and it describes
the preparation procedure. Note that the availability of recipes is one of the
major reasons why users routinely consult NUBI Parma, and the number of
recipes in the database is constantly increasing to respond to users' demands.</p>
        <p>The output of the meal planner is used to ll the meals table of the database.
The meals table has a row for each day of the year and for each type of institute.
For each row, the table contains the menu o ered by the canteen of the institute,
or a proposal for a non-school day lunch, and one, two, or three dinner proposals.
Dinner proposals are compiled using the dishes available in the dishes table,
which contains a superset of the dishes o ered at canteens. Dinner proposals
are compiled taking into account the constraints suggested by the guidelines
mentioned at the beginning of this section.
2.2</p>
      </sec>
      <sec id="sec-2-2">
        <title>Constraints from nutritional guidelines</title>
        <p>The nutritional guidelines mentioned at the beginning of this section were used to
identify a set of constraints that the NUBI Parma meal planner enforces when
compiling proposals for dinners and non-school day lunches. Such constraints
were divided into three groups. Note that most of the considered constraints are
related to the nutritional tradition of the area where the app is used.</p>
        <p>The rst group of constraints concerns the three types of meals that must
appear in a menu according to the considered guidelines. Such types of meals are
typical of the Italian tradition, and they are used to compile the proposals for
dinners and for non-school day lunches. The three types of meals that the meal
planner currently manages are summarized in Fig. 2. Note that the considered
guidelines impose the following restrictions on single and semi-single dishes:
{ Dishes that contain carbohydrates and proteins cannot be used when a
semisingle dish is proposed; and
{ Dishes that contain carbohydrates, proteins, and bread cannot be used when
a single dish is proposed.</p>
        <p>In addition to the constraints that describe the three types of meals, and how
they can be combined, the considered guidelines impose a second group of
constraints intended to determine how the three types of meals should be used in a
menu. Among such constraints, the most relevant restriction requires that, when
three alternative dinner proposals are suggested, two proposals must be regular
meals and one proposal must be a single or a semi-single meal. If a single or a
semi-single meal cannot be suggested for the shortage of available dishes, three
regular meals must be suggested.</p>
        <p>Finally, the third group of constraints is imposed by the considered guidelines
to restrict the ways in which the various types of dishes can be combined to
assemble a weekly menu. Such constraints are expressed in terms of consumption
frequencies, as follows:
{ Maximum consumption frequency in a week, which is the maximum number
of repetitions of a type of dish in a week;
{ Maximum consumption frequency in a day, which is the maximum number
of repetitions of a type of dish in a day; and
{ Maximum consumption frequency in a meal, which is the maximum number
of repetitions of a type of dish in a meal.</p>
        <p>The most relevant maximum consumption frequencies, as implemented by the
NUBI Parma meal planner, are shown in Table 1.
Even if the dishes table of the database contains 310 dishes, it is often the case
that the needed proposals for dinners and non-school day lunches cannot be
delivered because the dishes in the dishes table are not su cient to satisfy the
constraints on maximum consumption frequencies shown in Table 1. A detailed
analysis of the cases in which constraints are too stringent suggested that a few
constraints could be relaxed to ensure that the requirements of reference
guidelines were met and that the meal planner could actually deliver all needed
proposals. Therefore, the current implementation of the NUBI Parma meal planner
is allowed to relax the following constraints by increasing the allowed maximum
consumption frequencies:
{ Maximum consumption frequency in a week of dishes in the subcategory sh
can be increased from 3 to 4; and
{ Maximum consumption frequency in a week of dishes in the subcategory
legumes can be increased from 4 to 5.</p>
        <p>Basically, the current solution to the shortage of dishes in the dishes table of
the database is to try to compile menus using all constraints, resorting to relax
mentioned constraints only when full menus cannot be completed. Note that,
even if mentioned constraints are relaxed, the generated menus do not violate
the stringent requirements of the considered guidelines. Also, note that the need
of relaxing constraints can be alleviated by adding new dishes to the dishes
table. Unfortunately, the dishes in the dishes table are local and seasonal, and
the adequate enlargement of the dishes table is de nitely not trivial.
2.4</p>
      </sec>
      <sec id="sec-2-3">
        <title>Notes on the implementation of the meal planner</title>
        <p>The detailed description of the algorithm used by the NUBI Parma meal planner,
and of its current implementation as a logic program, is out of the scope of this
paper. The remaining of this section contains a brief description of the
coarsegrained architecture of the meal planner and of the most relevant characteristics
of its current implementation.</p>
        <p>The brief description of the constraints imposed by the adopted nutritional
guidelines mentioned at the beginning of this section suggests that meal planning
problems can be easily rewritten into related Constraint Satisfaction Problems
(CSPs) over nite domains. Actually, the process of solving a meal planning
problem consists of using the set of available dishes to assemble proposals for
dinners and non-school day lunches ensuring that constraints from nutritional
guidelines are satis ed or properly relaxed. Therefore, the construction of a CSP
to solve a given meal planning problem regards identifying a suitable set of
variables, a suitable set of domains, and a suitable set of constraints. The NUBI
Parma meal planner associates a variable with each dish in a proposal for a
dinner or for a non-school day lunch according to the scheme summarized in
Fig. 2. Each variable must be associated with the numeric identi er of one of
the dishes available in the dishes table of the database. Therefore, all variables
share one domain, which is the set of the numeric identi ers of available dishes
in the dishes table. Finally, the constraints that the meal planner must satisfy to
solve a meal planning problem are described in su cient detail in the considered
nutritional guidelines, as discussed earlier in this section.</p>
        <p>The current implementation of the NUBI Parma meal planner uses the
approach outlined above to express a given meal planning problem in terms of
suitable CSP. A solution to the CSP represents the menu for a year, which is
generated, written to a CSV le, and nally stored in the meals table of database.
Note that the meal planner splits the construction of the menu by considering the
three types of institutes, i.e., nurseries, kindergartens, and primary schools,
independently. Moreover, the meal planner splits the year into four periods, which
are related to school terms, and it splits each period in weeks. The menus of
the weeks in each period are generated independently to ensure that seasonal
dishes are properly suggested and that proposals for dinners and non-school day
lunches are healthy and balanced throughout each week.</p>
        <p>
          The meal planner is currently implemented as an o ine logic program,
written in SWI-Prolog [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ], that reads input data from the three CSV les mentioned
at the beginning of this section to output a CSV le ready to be loaded in the
meals table of the database. The meal planner uses the forward checking
algorithm (e.g., [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]) to search for the rst solution to the considered CSP, and it
immediately returns the solution as a satisfactory menu. In particular, the
current implementation of the meal planner is based on the implementation of the
forward checking algorithm suggested in [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], and it uses the Minimum Remaining
Values (MRV ) heuristic to dynamically choose which variable to assign next. If
no solutions can be found, the meal planner relaxes the two relaxable constraints
mentioned previously, and it tries to solve the new meal planning problem.
        </p>
        <p>Note that the current implementation of the meal planner does not use
Constraint Logic Programming (CLP ) because preliminary experiments suggested
that no constraints can actually bene t from the use of CLP. Considered
constraints are mostly expressed in tabular form, and they are often related to the
cardinalities of the sets of variables assigned to related dishes during the search.
The use of the tabular form severely limits the expected bene ts from current
tools for CLP because most of the available tools for CLP are based on algebraic
structures and their operations. In addition, the need for set constraints that
is inherent to the use of consumption frequencies to express constraints further
reduces the viable options for applicable CLP tools.</p>
        <p>Finally, note that a brute force approach to the search for the solution to
considered CSPs is not feasible because the number of dishes available in the
dishes table of the database generates a large search space. On the contrary, the
current implementation of the meal planner can produce a monthly menu for
one type of institute in less than 100 ms using an ordinary laptop.
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Conclusion</title>
      <p>NUBI Parma has been in constant use by more than 18;193 mobile devices since
the end of 2016, receiving more than 558;451 requests for weekly menus. It is
now a consolidated tool for the families of the municipality of Parma, and some
institutes explicitly instruct families to use the app to consult the menus of
canteens and to have suggestions for dinners and non-school day lunches. As
such, NUBI Parma and its meal planning service can be considered a relevant
application in the landscape of logic programming, at least for the scale of the
user base and for its intended casual use.</p>
      <p>The short-term development plans for NUBI Parma are based on suggestions
received from users. Several users suggested to include the possibility of selecting
special diets so that the proposals for dinners and non-school day lunches could
be tailored to follow one of the available special diets. Among the plethora of
possibilities, users suggested to include in NUBI Parma the same ve special
diets that are currently supported by NUBI Reggio Emilia, namely, gluten-free,
lactose-free, pork-free, nut-free, and vegetarian (no meat and no sh). The
mentioned diets are not tailored to the special needs of single users, but they simply
introduce new constraints in the yearly planning of meals.</p>
      <p>The long-term development plans for NUBI Parma are based on the
possibility of quickly planning the meals for a single user so that the service could be
extended to provide personalized menus to take into account the preferences and
the habits of single users. Such an extension, together with others that are easy
to immagine, could give the possibility to stem malnutrition by proposing a tool
capable of transparently instilling in each individual, from childhood, a healthy
and balanced diet. Actually, an envisaged scienti c experiment is intended to
measure several nutrition-related values in the population of the municipality of
Parma to possibly identify the bene cial e ects of the daily use of NUBI Parma
for a su ciently long period of time.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>R. M. Haralick</surname>
            ,
            <given-names>G. L.</given-names>
          </string-name>
          <string-name>
            <surname>Elliot</surname>
          </string-name>
          <article-title>: Increasing tree search e ciency for constraint satisfaction problems</article-title>
          .
          <source>Arti cial Intelligence</source>
          ,
          <volume>14</volume>
          :
          <fpage>263</fpage>
          {
          <fpage>313</fpage>
          ,
          <year>1980</year>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>K. D. McManus</surname>
          </string-name>
          :
          <article-title>Phytonutrients: Paint your plate with the colors of the rainbow</article-title>
          . Available at https://www.health.harvard.edu
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <article-title>Ministero dell'Istruzione, dell'Universita e della Ricerca: Linee guida per l'educazione alimentare 2015</article-title>
          . Available at https://www.istruzione.it
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. Ministero della Salute:
          <article-title>Linee di indirizzo nazionale per la ristorazione scolastica</article-title>
          . Available at https://www.salute.gov.it
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Regione</surname>
          </string-name>
          Emilia-Romagna:
          <article-title>Linee guida della Regione Emilia-Romagna per l'o erta di alimenti e bevande salutari nelle scuole e strumenti per la sua valutazione e controllo</article-title>
          . Available at https://www.alimenti-salute.it
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>S.</given-names>
            <surname>Russel</surname>
          </string-name>
          , P. Norvig:
          <article-title>Arti cial Intelligence: A Modern Approach</article-title>
          . Prentice Hall,
          <year>2010</year>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. United Nations General Assembly:
          <article-title>International covenant on economic, social and cultural rights</article-title>
          . Available at https://www.un.org
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>J.</given-names>
            <surname>Wielemaker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Schrijvers</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Triska</surname>
          </string-name>
          ,
          <string-name>
            <surname>T.</surname>
          </string-name>
          <article-title>Lager: SWI-Prolog</article-title>
          .
          <source>Theory and Practice of Logic Programming</source>
          ,
          <volume>12</volume>
          (
          <issue>1</issue>
          {2):
          <volume>67</volume>
          {
          <fpage>96</fpage>
          ,
          <year>2012</year>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9. World Health Organization:
          <article-title>Food and nutrition policy for schools: A tool for the development of school nutrition programmes in the WHO European Region</article-title>
          . Available at https://www.euro.who.int
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>