You are on page 1of 8

Implementation of Knapsack Problem in Diabetes Mellitus Prevention

Alfiyyah Hasanah
Hidayatul Mayyani
Farida Hanum

Abstract
Diabetes mellitus (DM) is a chronic metabolic disorder due to inability of pancreas for
producing enough insulin or the body can not use insulin effectively. According to the
International Diabetes Federation (IDF), in 2013, in the world, there were 382 million people
living with diabetes. The number will continue to increase until it is estimated to be around
592 million people in 2035. IDF explained that of 382 million people with diabetes in 2013,
175 million of them have not been diagnosed. So that, they are threatened to develop
progressively into many complications. Diet plays an important role for people with DM.
Someone who can not regulate their dietary habit have a possibility to increase their blood
sugar levels. Knapsack problem is a problem for selecting several objects from many objects
that will put in a storage to provides optimal profit by considering the limited capacity in
storage and the weight also profit of each object. The application of this algorithm is a form
of simplification of the technical control of real blood sugar in the body. This method is used
when it is assumed that the other components in food are not considered to be affecting
blood sugar levels. In addition, another assumption is the assumption that the RDA has been
fulfilled / fulfilled by only considering AKE.

Introduction
Diabetes mellitus (DM) is a chronic metabolic disorder due to the pancreas not producing
enough insulin or the body cannot use insulin produced effectively. Insulin is a hormone that
regulates blood sugar balance. As a result from that, glucose concentration in the blood
increasing or hyperglycemia (Ministry of Health 2014).
According to the International Diabetes Federation (IDF), in 2013, in the world, there were
382 million people living with diabetes. The number will continue to increase until it is
estimated to be around 592 million people in 2035. IDF explained that of 382 million people
with diabetes in 2013, 175 million of them have not been diagnosed, so that they are
threatened to develop progressively into complications. Complications due to diabetes can
be prevented or postponed by keeping blood sugar levels in the normal category so that
metabolism can be controlled properly. Blood sugar levels can be maintained by adopting a
healthy lifestyle (Juwita and Febrina 2018).
According to the Ministry of Health (2014), the biggest risk factor for diabetes in Indonesia is
an unbalanced diet. DM sufferers must pay attention to their dietary habit which include
schedule, amount, and type of food that consumed (Susanti and Bistara 2018). Diet plays an
important role for people with DM. Someone who can not regulate dietary habit will have a
possibility to increase their blood sugar levels. Therefore, in this scientific work, the author
interested to make the model of the problem to choose a proper meal for people with DM
so the food that consumed contributes the number of calories needed (90% -110% of the
number of calories needed per meal). In addition, the selection of these foods also can not
exceed the recommended amount of carbohydrates per meal (in this case the upper limit
that used is 60 grams of carbohydrates). In the field of operations research in mathematics,
this problem belongs to the knapsack problem.

Knapsack Problem
Knapsack problem is a problem for selecting several objects from many objects that will put
in a storage to provides optimal profit by considering the limited capacity in storage and the
weight also profit of each object.
n
L ( x ) =∑ c j x j →max
j =1

∑ a j x j ≤b ,
j=1

0 ≤ x j ≤ 1 , j=1 , … , n .

Dietary Consideration for People with DM


These are some aspects that must be considered to regulate the diet for people with
DM.
1. Nutrition adequacy rate (RDA) of each individual. According to Hardiansyah in
Halimah (2017), the RDA is the average daily nutritional intake that is sufficient to
meet the nutritional needs in certain age group, sex, and physiologist. One of the main
elements of the RDA is the energy (that measured with calory) that is needed by the
body because insufficient energy can cause protein, vitamins, and minerals can not
used effectively (Halimah 2017). According to Nurohmi and Amalia (2012), the level
of nutritional adequacy is said to be sufficient if the food consumed is able to meet
90% -110% of the total calories needed. Everyone's needs are different depending on
age, gender, and physical activity undertaken. Calorie requirements can also be seen
through body mass index (BMI) as follows.
Tabel 1 Klasifikasi Nilai IMT bagi Penderita Diabetes 1
BM I (kg m−2) Calorie requirement
¿ 18,5 2100 calories
18,5 – 22,9 2500 calories
¿ 23 1500 calories
1
Sumber: Lusiani dan Qoiriah (2014).
Body weight
Formula of BMI =¿ .
Height 2

2. Eating schedule and food selection in each of these schedules. Quoted from
Magdalena (2016), several studies have proven that eating schedules and food
selection in each of these schedules can help control blood sugar levels. The following
table is a standard meal schedule that can be used by DM patients (Waspadji in
Magdalena 2016).
Tabel 1 Jadwal Makan yang Dapat Digunakan oleh Pasien DM

Time Total calories


Breakfast 07.00 20%
Snacks 10.00 10%
Lunch 13.00 30%
Snacks 16.00 10%
Dinner 19.00 20%
Snack 21.00 10%

3. Regulation of glucose levels in the blood. According to The diet component that has
the biggest impact to increasing the blood sugar is carbohydrate. However, avoiding
total carbohydrate consumption for DM sufferers is not recommended for diet control.
Carbohydrates are an important component in a healthy diet. Carbohydrates are an
important source of other nutrients including water-soluble vitamins and minerals. In
addition, blood sugar is also the main fuel used by the brain and nervous system. The
National Academy of Sciences-Food and Nutrition Board recommends diets for
people with DM to be carried out by consuming carbohydrates in an amount that
meets 45-65% of the calories needed, which is around 130 grams of carbohydrates /
day for adults (Sheard et al. 2004).

Applying concept
Parameters
cj : calorie that contained in food j
carbo j : carbohydrate that contained in food j
maxcarbo : maximum amount of carbohydrates that can be consumed by the user

Index
j=1 ,… , n .

Decision variable

x j= 1 ,the food chosen eat with full p ortion ¿ 0< x j <1 , the food chosen ¿ eat partially ¿ the whole portion ¿ 0 ,the f
{ ¿

Objective Function
n
max C ( x)=∑ c j x j
j=1

Constraint
n

∑ carbo j x j ≤ maxcarbo ,
j=1

Hasil
Based on these three aspects of consideration, in this paper, dietary regulation
technology for people at risk of diabetes or diabetics is focused on choosing food in one meal
schedule so that the food consumed contributes the number of calories needed (90% -110%
of the number of calories that required per meal). In addition, the selection of these foods also
certainly pay attention to the amount of carbohydrates to be consumed. The total
carbohydrates can not exceed the recommended amount of carbohydrates per meal (in this
case the upper limit is used, 60 grams of carbohydrates).
In the field of operations research in mathematics, this problem belongs to the
knapsack problem. Based on Faisal's (2014) presentation, the knapsack problem is a problem
for selecting several objects from the many objects available so that a storage which gives
optimal profit is obtained by considering the limited capacity in storage and the weight and
profit of each object. This problem can be solved in several ways, one of which is the greedy
algorithm.
The main principle of the Greedy algorithm is "Take what you can get now!". This explains
that at each step in the greedy algorithm, the most optimal decision is taken for that step
without regard to the consequences in the next step. Thus, the solution obtained is called the
local optimum. To find the local optimum solution there are three steps namely, greedy by
profit prioritizing goods that have the biggest profit to enter first, greedy by weight which
prioritizes the goods with the smallest weight to be included, and greedy by density which
prioritizes the highest rasio between profit and weight (profit per weight) to be chosen.
In this case, the item in this model is the food that user wants. Each type of food has its own
carbohydrate and calorie level. The aspect that will be maximized is the calorie from each
food (profit / pi) by considering the amount of carbohydrate for each selected food (weight /
wi). After obtaining some food combination results from each algorithm step, it is necessary
to re-select the results so that the resulting food combination contributes the total calories
needed (not too much or less) that is, in the range of 90% -110% of AKE.
After the user enters personal data such as age, gender, weight, meal time, and some food that
user want to eat, the user data will be processed together with data about the RDA value,
especially AKE1 and the content of each food ingredient that can be obtained from the table
of ingredients composition list. food (DKBM) 2 which is in the attached page. The data is
processed with a greedy algorithm so that it produces an output of several suggested food
choices. Below the following illustration of this implementation.
Gambar 1 Ilustrasi Penggunaan Teknologi Pengaturan Diet bagi Orang Berisiko DM

Penerapan metode greedy dalam kasus ini dapat dilihat di tabel berikut.

Tabel 2 Penyelesaian Pemilihan Menu Makanan dengan Algoritme Greedy


Items *, ** Greedy by Final
solution
i wi pi pi/wi Profit weight density
1 40.60 178 4.38 0 45/812 0 45/812
2 27.90 123 4.41 1 0 0 0
3 79.62 439 5.51 0 0 0 0
4 30.65 240 7.83 36/613 1 1 1
5 3.20 82 25.62 1 0 1 0
6 27.10 201 7.42 1 1 523/542 1
Total bobot 60 60 60 60
Total keuntungan 420.09 450.86 515.95 450.86
* Keterangan:
1: Cooked white rice
2: Red sweet potato
3: Potato fritters
4: Vegetables in coconut milk
5: Fried tempe
6: Sauteed corn

** Setiap makanan tersebut disajikan dalam porsi 100 gram.

Dari ketiga hasil tersebut, dipilih hasil kombinasi menu makanan yang nilai kalorinya paling besar dan berada di
antara 405 hingga 495 kalori.
Through this algorithm, it is obtained that from the food choices desired by the user for lunch,
the recommended food output is cooked rice from ground rice with a proportion of 45/812
from 1 serving of 100 grams, 1 serving of vegetables in coconut milk 100 grams, and 1
serving of Sauteed corn 100 gram vegetables with the total energy donated from the
combination of these foods is around 450.86 calories, sufficient number of calories and is
recommended for the afternoon meal schedule. In addition, of course, the diet output for this
lunch does not exceed the maximum amount of carbohydrate that can be consumed.

Futur works/conclusion
The application of this concept is a very simplification model of the real process in our body.
Thus, this method is used when it is assumed that the other components in food are not
considered to be affecting blood sugar levels. In addition, another assumption is the
assumption that the RDA has been fulfilled / fulfilled by only considering AKE.
Even so, through the application of this greedy algorithm, is expected to contribute in the
development of dietary regulation technology, especially for people at risk or DM sufferers.
This is because DM and its complications can bring huge economic losses for sufferers, their
families, as well as the national health and economic system. In addition, PTM especially
DM also reduce the quality of human resources. Therefore, the application of operations
research in mathematics, especially the implementation of this greedy algorithm, can be a
small step to make the community aware of the importance of healthy lifestyles, assist the
implementation of healthy lifestyles, and support sustainable development goals, especially in
the field of good health and well being .

References
[Depkes RI] Departemen Kesehatan Republik Indonesia. 2008. Pedoman Pengendalian
Diabetes Melitus dan Penyakit Metabolik. Jakarta (ID): Depkes RI.
[Kemenkes RI] Kementrian Kesehatan Repulik Indonesia. 2014. Situasi dan Analisis
Diabetes. Jakarta (ID): Pusat Data dan Informasi.
[Kemenkes RI] Kementrian Kesehatan Repulik Indonesia. 2017. Buku Panduan Penilaian
Teknologi. Jakarta (ID): Komite Penilaian Teknologi Kesehatan.
Angka kecukupan gizi. 2014. http://himagizi.lk.ipb.ac.id/ [Diunduh 2019 Agu 21].
DKBM Indonesia. http://staffnew.uny.ac.id/ [Diunduh 2019 Agu 21].

Litvak, B. G., & Naivel’t, A. V. (1973). On the determination of the upper bound for the
knapsack problem with additional constraints. Cybernetics, 7(1), 200–
203. doi:10.1007/bf01070545 
Lusiani T, Qoiriah A. 2014. Sistem pakar untuk menentukan menu makanan sehat pada penderita
diabetes mellitus. Jurnal S@CIES. 5(1):9-23. doi: 10.31598/ sacies.v5i1.59.

You might also like