I love McDonald's. But junk food, bad for your health, I see more stories like that than before.
So if you really keep eating McDonald's, Is it bad for your health? If you live alone at McDonald's, really, Will there be malnutrition or excess calories?
This article is only for McDonald's ** A diet that provides all the nutrients you need for the day ** What kind of menu should you choose when you do What nutritional problems will result? Using Python's linear programming library called PuLP This is a summary of the research results.
That is, ** McDonald's alone ** ** To build a menu as a complete nutritional diet ** ** What and how much should I eat? ** ** ** And how many calories will it be at that time? ** About 0.001% of people in the world once wonder Give a solution to a problem you have thought of.
Also, as a nutritional representative player, ** Pentagonal shape with milk nutrients ** Famous for being Corn flakes (I love this too) I will also add a consideration when adding it to the menu.
"You can take only McDonald's to an uninhabited island." I am convinced that it is a very useful study when told.
First of all, McDonald's menu For nutritional information It is published on the following official website.
https://www.mcdonalds.co.jp/products/nutrition_balance_check/
Select a menu on this site and Your gender, age, and physical activity level By entering, for the nutrients needed for the day, How much do you meet? It is possible to confirm.
In this research, that is, this ** While filling 100% of all nutrients for one day ** ** Adjust the salt content so that it is below the standard value, ** ** And reduce calories as much as possible, ** We will aim for the optimum solution for menu selection.
Although it seems to be a difficult problem at first glance, It's actually a simple ** linear programming problem **, It can be solved in one shot with Python's PuLP library.
The most important point is that there are many data and variables, so It's super annoying to get the problem into code. A variable called "teriyaki-ba-ga" If you wrote a lot of expressions like "Vitamin C> 100" Even dreams are "Tatara" There is no doubt that it will be filled up. Also for adding menus such as moon viewing burger It becomes difficult to respond.
Keeping this in mind, we will proceed with the research with the following setup.
① What is the linear programming problem? ② Check the basic usage of PuLP ③ Obtain data from McDonald's official website and Allow processing with Python ④ Nutrients required for one day = As a complete nutritional diet problem Implement the code. (Make it well and universally) ⑤ Play by watching the results while changing some conditions ⑥ Play with a limit of once per menu ⑦ Add corn flakes to the menu and play further
- | calorie | Nutrition 1 | Nutrition 2 | Nutrition 3 |
---|---|---|---|---|
Teriyaki | 20 | 25 | 10 | 15 |
potato | 12 | 11 | 10 | 18 |
Cola | 15 | 13 | 16 | 25 |
Required nutrition | ★ Minimize here | 300 | 200 | 100 |
■ Problem: When you have a nutrition table like the one above While satisfying the required amount of nutrients 1 to 3, Like minimizing calories How to order teriyaki, potatoes and cola?
⇒Answer: Teriyaki x8, potato x1, cola x7 At 298 calories
In this way, in the problem of finding the optimum solution of something, Objective function (calories) and constraints (nutrients to be satisfied) In a linear (one-dimensional polynomial without square) inequality A problem that can be expressed is called a ** linear programming problem **.
Python has a library called PuLP, which Just describe this issue in code The optimum solution can be found in one shot.
Let's see how to use PuLP. All the following code is also tried to be executed on Colaboratory.
How to install PuLP
Install PuLP
pip install pulp
Below is the code that solves the previous example. Let's see the most basic usage.
The most basic usage of PuLP
import pulp
# !pip install pulp
#Reference 1: https://www.y-shinno.com/pulp-intro/
#Problem definition
#Specify either minimize or maximize
problem = pulp.LpProblem(name="Mac", sense=pulp.LpMinimize)
#problem = pulp.LpProblem(name="Mac", sense=pulp.LpMaximize)
#Variable definition (* Variables can be specified in Japanese for python)
#In order to express the number of things, it is defined as an integer of 0 or more.
Teriyaki= pulp.LpVariable(name = "Teriyaki", lowBound = 0, cat="Integer")
potato= pulp.LpVariable(name = "potato", lowBound = 0, cat="Integer")
Cola= pulp.LpVariable(name = "Cola", lowBound = 0, cat="Integer")
#Objective function (function that should be minimized or maximized)
problem += 20 *Teriyaki+ 12 *potato+ 15 *Cola
#Constraint definition
#As a way of writing, be sure to put an equal sign,<=.==,>=Write in such a way!
problem += 25 *Teriyaki+ 11 *potato+ 13 *Cola>= 300
problem += 10 *Teriyaki+ 10 *potato+ 16 *Cola>= 200
problem += 15 *Teriyaki+ 18 *potato+ 25 *Cola>= 100
#Solve the problem
status = problem.solve()
print(pulp.LpStatus[status])
#All types of status are as follows.
#"Optimal" means that the optimum solution was obtained.
# {-3: 'Undefined',
# -2: 'Unbounded',
# -1: 'Infeasible',
# 0: 'Not Solved',
# 1: 'Optimal'}
#Result display
print("Result")
print("Teriyaki:", Teriyaki.value())
print("potato:", potato.value())
print("Cola:", Cola.value())
Output result
Optimal
Result
Teriyaki: 8.0
potato: 1.0
Cola: 7.0
The first point of ingenuity is ** The variable name is "Japanese" **. ** In Python3, variable names other than ASCII code can be used **, By keeping it in Japanese from the beginning, The product name of the McDonald's menu It can be treated as a variable name as it is. On the contrary, if you do not do this, the teriyaki will be "teriyaki" ... Like, give English names to all menus, Moreover, you have to manage the mapping. At this point the sun goes down.
However, if you just change the variables to Japanese, you can formulate the formula for each nutrient.
Entering everything is still extremely difficult.
All when other menus are added, etc.
problem + = 10 * Teriyaki + 10 * Potato + 16 * Coke> = 200
It will also be ** dangerous to update the formula of ** (lack of vocabulary)
Therefore, as follows Make it possible to handle menu names and nutrient values in list format. The code is quite different, but the results and meanings are exactly the same. ** There is no problem with the moon-viewing burger season **.
A little general way to write PuLP
import pulp
# !pip install pulp
#Reference 2: http://www.nct9.ne.jp/m_hiroi/light/pulp01.html
#Problem definition(
#Specify either minimize or maximize
problem = pulp.LpProblem(name="Mac", sense=pulp.LpMinimize)
#problem = pulp.LpProblem(name="Mac", sense=pulp.LpMaximize)
#Data definition
target_menu_list =["Teriyaki","potato","Cola"]
kcal =[20,12,15]
eiyou1 =[25,11,13]
eiyou2 =[10,10,16]
eiyou3 =[15,18,25]
#Variable definition
#Write the variable definition in list comprehension notation, and dynamically define the variable name as the data in the list.
xs = [pulp.LpVariable('{}'.format(x), cat='Integer', lowBound=0) for x in target_menu_list]
#Write objective functions and constraints in matrix multiplication type
#Objective function (function that should be minimized or maximized)
problem += pulp.lpDot(kcal, xs)
#Constraint definition
problem += pulp.lpDot(eiyou1, xs) >= 300
problem += pulp.lpDot(eiyou2, xs) >= 200
problem += pulp.lpDot(eiyou3, xs) >= 100
#Solve the problem
status = problem.solve()
print(pulp.LpStatus[status])
#Result display
print("Result")
print("Teriyaki:", Teriyaki.value())
print("potato:", potato.value())
print("Cola:", Cola.value())
The point is that the formula is defined by ** matrix multiplication type **, and ** Variable names such as teriyaki are dynamically named ** points.
In other words
target_menu_list = ["Teriyaki", "Potato", "Coke"]
⇒
target_menu_list = ["Teriyaki", "Potato", "Coke", "Tsukimi Burger"]
If you update the list of menu names like
Used as a variable name in '{}'. format (x)
,
The reason is that a variable called Tsukimi Burger
is dynamically generated.
If you don't do these things There is no problem playing with a few lines of data, It cannot handle hundreds of lines of actual McDonald's data.
Even though there is a library called PuLP ** Examination of a complete nutrition McDonald's diet, which was the dream of all humankind ** The reason why it has not been done so far is ** If you make it normally, the code will be dangerous **, Must be the reason. It must be so (emphasized by iterative method)
From the McDonald's official website mentioned above, You can see the nutritional value list of all the latest menus. There are four types: burger, side, drink, and barista. No need to scrape Simply copy and paste 4 times and save in CSV format.
The saved CSV data has the following code. It can be read in dictionary format with Python.
Reading McDonald's data
import csv
McDonaldsDict = {}
with open('/content/drive/My Drive/MACD/McDonald's Nutritional Value List 20201009_R.csv') as f:
reader = csv.DictReader(f)
# OrderedDict([('Product name', 'Fillet 'o Shrimp'), ('Weight g', '174'),... is included in each line
#* For juices, etc., the nutritional value is "-Has been replaced with 0
for row in reader:
# 'Fillet 'o Shrimp' : OrderedDict([('Product name', 'Fillet 'o Shrimp'), ('Weight g', '174')Processed into a dictionary format
McDonaldsDict[row["Product name"]] = row
Later, select and take out only the target products, To make it easier to say Use the "product name" as a key in the dictionary format. (* A double dictionary in which the dictionary format is further dictionary type)
Also, regarding the nutrients required for one day Let's define as follows with reference to the data. The target is ~~ Leisure people who are likely to be interested in a complete nutrition McDonald's diet ~~ I tried to match the expected readership of this research.
Necessary nutrients (example)
#Male: The amount of nutrition required for a day between the ages of 30 and 49.
#Physical activity level 1 = Most of life is sitting,
#Calculated with if static activity is central
#However, the salt equivalent is not necessary and should be "less than or equal to".
one_da_nutrition_dict ={
"Energy kcal" : 2300.0,
"Protein g" : 65.0 ,
"Lipid g" : 63.9 ,
"Carbohydrate g" : 330.6 ,
"Calcium mg" : 750.0 ,
"Iron mg" : 7.5 ,
"Vitamin A μg" : 900.0 ,
"Vitamin B 1mg" : 1.4 ,
"Vitamin B 2mg" : 1.6 ,
"Vitamin Cmg" : 100.0 ,
"Dietary fiber g" : 21.0 ,
"Salt equivalent g" : 7.5 ,
}
At this point everything is ready.
McDonald's menu is diverse, "A perfect polygon with milk" "Healthy with salad and vegetable juice" means ** The typical McDonald's feeling is thin **, so First of all, the following members were selected subjectively as representative players.
Because this choice is expected to be a major religious controversy There may be believers of other gods, but I do not admit any objection. If you are from another sect, please change the selected members and try the code again.
** Only with these combinations ** ** Get all the nutrients you need for the day, ** ** And when the salt content is below the standard value ** ** How many calories will it be at least! ?? ** **
Now that we've put together the code below, let's run it! !!
Linear programming of a complete nutrition McDonald's diet
import pulp
#Problem definition
#This time, I want to minimize calories, so I set it at the beginning
problem = pulp.LpProblem(name="Complete nutrition McDonald's diet", sense=pulp.LpMinimize)
import csv
McDonaldsDict = {}
with open('/content/drive/My Drive/MACD/McDonald's Nutritional Value List 20201009_R.csv') as f:
reader = csv.DictReader(f)
# OrderedDict([('Product name', 'Fillet 'o Shrimp'), ('Weight g', '174'),... is included in each line
#* For juices, etc., the nutritional value is "-Has been replaced with 0
for row in reader:
# 'Fillet 'o Shrimp' : OrderedDict([('Product name', 'Fillet 'o Shrimp'), ('Weight g', '174')Processed into a dictionary format
McDonaldsDict[row["Product name"]] = row
#Get a list of specific nutritional values
#Target target_menu_Get the value of the nutritional value in the order in the list.
def get_nutrition_val_list(nutrition_dict, target_menu_list, eiyou_name):
result_list = []
for menu_name in target_menu_list:
#Get nutritional value and replace with float
eiyou_val = nutrition_dict[menu_name][eiyou_name]
result_list.append(float(eiyou_val))
return result_list
#goods
#* Because it is a matter of calories, Coca-Cola Zero, Sokenbicha, etc.
#Exclude those with completely zero calories.
target_menu_list = [
"Teriyaki McBurger",
"Hamburger",
"cheeseburger",
"Double cheeseburger",
"Tsukimi burger",
"Big Mac",
"Filet-O-Fish",
"Chicken Mac Nugget 5 Piece",
"McDonald's potato(M)",
"McDonald's potato(S)",
"ketchup",
"BBQ sauce",
# "sweet corn",
# "Side salad",
"Coca Cola(M)",
"McShake® Vanilla(S)",
"Minute Maid Orange(M)",
# "milk",
# "Vegetable life 100(M)",
]
#Male: The amount of nutrition required for a day between the ages of 30 and 49.
#Physical activity level 1 = Most of life is sitting,
#Calculated with if static activity is central
#However, the salt equivalent is not necessary and should be "less than or equal to".
one_da_nutrition_dict ={
"Energy kcal" : 2300.0,
"Protein g" : 65.0 ,
"Lipid g" : 63.9 ,
"Carbohydrate g" : 330.6 ,
"Calcium mg" : 750.0 ,
"Iron mg" : 7.5 ,
"Vitamin A μg" : 900.0 ,
"Vitamin B 1mg" : 1.4 ,
"Vitamin B 2mg" : 1.6 ,
"Vitamin Cmg" : 100.0 ,
"Dietary fiber g" : 21.0 ,
"Salt equivalent g" : 7.5 ,
}
#For the target nutrients, create the nutritional value for each target product list in list format.
eiyou_data={}
for key in one_da_nutrition_dict.keys():
#Change the nutrition name (Japanese) contained in the key to the key of the data dict
eiyou_data[key] = get_nutrition_val_list(McDonaldsDict, target_menu_list, key)
#Variable definition (* Use Japanese character strings as variables as they are)
xs = [pulp.LpVariable('{}'.format(x), cat='Integer', lowBound=0) for x in target_menu_list]
#Objective function: Energy minimization
problem += pulp.lpDot(eiyou_data["Energy kcal"], xs)
#Constraints: Meet each of the daily nutritional requirements.
#Condition customization & ON-Described outside the loop to make it easier to turn off.
#The salt equivalent is "within". Does a solution exist? Be careful.
problem += pulp.lpDot(eiyou_data["Protein g"], xs) >= one_da_nutrition_dict["Protein g"]
problem += pulp.lpDot(eiyou_data["Lipid g"], xs) >= one_da_nutrition_dict["Lipid g"]
problem += pulp.lpDot(eiyou_data["Carbohydrate g"], xs) >= one_da_nutrition_dict["Carbohydrate g"]
problem += pulp.lpDot(eiyou_data["Calcium mg"], xs) >= one_da_nutrition_dict["Calcium mg"]
problem += pulp.lpDot(eiyou_data["Iron mg"], xs) >= one_da_nutrition_dict["Iron mg"]
problem += pulp.lpDot(eiyou_data["Vitamin A μg"], xs) >= one_da_nutrition_dict["Vitamin A μg"]
problem += pulp.lpDot(eiyou_data["Vitamin B 1mg"], xs) >= one_da_nutrition_dict["Vitamin B 1mg"]
problem += pulp.lpDot(eiyou_data["Vitamin B 2mg"], xs) >= one_da_nutrition_dict["Vitamin B 2mg"]
problem += pulp.lpDot(eiyou_data["Vitamin Cmg"], xs) >= one_da_nutrition_dict["Vitamin Cmg"]
problem += pulp.lpDot(eiyou_data["Dietary fiber g"], xs) >= one_da_nutrition_dict["Dietary fiber g"]
problem += pulp.lpDot(eiyou_data["Salt equivalent g"], xs) <= one_da_nutrition_dict["Salt equivalent g"]
#Show the content of a given problem
print(problem)
status = problem.solve()
print("Status", pulp.LpStatus[status])
#* Make sure that it is "Optimal".
#Simple result display
print([x.value() for x in xs])
print(problem.objective.value())
#Display by variable name
for x in xs:
print(str(x) + " × "+ str(int(x.value())) )
#Display the calculation result of how much each nutrient is
print("----result----")
for key in one_da_nutrition_dict.keys():
print(key + ": " + str(one_da_nutrition_dict[key]) +"Against" + str(round(pulp.lpDot( eiyou_data[key], xs).value())) )
When you execute the above ...
** Result: 8035kcal **
Output result
#The log output around the problem definition is omitted.
Teriyaki McBurger x 0
Hamburger x 0
Cheeseburger x 0
Double cheeseburger x 1
Tsukimi burger x 2
Big Mac x 0
Filet-O-Fish x 0
Chicken mac nugget_5 pieces x 0
McDonald's potato(M) × 0
McDonald's potato(S) × 0
Ketchup x 2
Barbecue sauce x 0
Coca Cola(M) × 0
McShake®_vanilla(S) × 0
Minute maid_Orange(M) × 46
----result----
Energy kcal: 2300.8035 against 0
Protein g: 65.175 against 0
Lipid g: 63.85 against 9
Carbohydrate g: 330.1654 against 6
Calcium mg: 750.1526 against 0
Iron mg: 7.20 against 5
Vitamin A μg: 900.900 against 0
Vitamin B 1mg: 1.12 against 4
Vitamin B 2mg: 1.2 against 6
Vitamin Cmg: 100.5433 against 0
Dietary fiber g: 21.38 against 0
Salt equivalent g: 7.5 to 8
#Supplement: Salt has the following conditions, and is it 8 in round?
Indeed, for the daily requirement of 2300 kcal, how You will also take ** 8035kcal **. And Double cheeseburger x 1 Overwhelmingly wash away Tsukimi burger x 2 ** 46 Minute Maid_Orange Flood **.
** Typical McDonald's representative player ** If you limit it to only ** I feel a little crazy (vocabulary) **.
But McDonald's fans all over the country, don't worry, In the first place, with few choices like this, Because it is a condition to satisfy all nutrients The result is only 8035 kcal. I would like to confirm even if the conditions are more realistic.
Even for me, if I end up with the results so far Night, night, ** darkness by yellow and red clowns ** You have to be scared.
First of all, according to the edict of "** Let's eat vegetables well **" Uncomment salads, sweet corn, and more. Also, let's make milk and vegetable life OK!
** Result: 1994kcal **
Let's eat vegetables well
Teriyaki McBurger x 1
Hamburger x 0
Cheeseburger x 0
Double cheeseburger x 0
Tsukimi Burger x 0
Big Mac x 0
Filet-O-Fish x 0
Chicken mac nugget_5 pieces x 0
McDonald's potato(M) × 0
McDonald's potato(S) × 2
Ketchup x 0
Barbecue sauce x 0
Sweet corn x 2
Side salad x 95
Coca Cola(M) × 0
McShake®_vanilla(S) × 0
Minute maid_Orange(M) × 0
Milk x 0
Vegetable life 100(M) × 0
----result----
Energy kcal: 2300.1994 against 0
Protein g: 65.72 against 0
Lipid g: 63.64 against 9
Carbohydrate g: 330.331 against 6
Calcium mg: 750.1308 against 0
Iron mg: 7.5 vs 22
Vitamin A μg: 900.2580 against 0
Vitamin B 1mg: 1.3 against 4
Vitamin B 2mg: 1.2 against 6
Vitamin Cmg: 100.1454 against 0
Dietary fiber g: 21.87 against 0
Salt equivalent g: 7.5 vs 4
1994kcal, which is less than the standard value of 2300kcal. You can diet while getting proper nutrition. Really healthy results, and moreover Teriyaki McBurger x 1 McDonald's Potato (S) x 2 You can also eat! !!
I thought, ** Side salad x 95 ** (excuse me)
You can't eat vegetables like this! !! It is an amount that is likely to be a source of mail-order programs for healthy juice. ** After all, the influence of the side salad was too great. ** **
Therefore, I will try the corn flakes method. ** A plan that replenishment with drinks such as milk and juice is OK **. Let's remove only the side salad and sweet corn.
** Result: 2933kcal **
Teriyaki McBurger x 0
Hamburger x 0
Cheeseburger x 1
Double cheeseburger x 0
Tsukimi burger x 1
Big Mac x 0
Filet-O-Fish x 0
Chicken mac nugget_5 pieces x 0
McDonald's potato(M) × 2
McDonald's potato(S) × 2
Ketchup x 0
Barbecue sauce x 0
Coca Cola(M) × 0
McShake®_vanilla(S) × 0
Minute maid_Orange(M) × 2
Milk x 3
Vegetable life 100(M) × 2
----result----
Energy kcal: 2300.2933 against 0
Protein g: 65.81 against 0
Lipid g: 63.125 against 9
Carbohydrate g: 330.371 against 6
Calcium mg: 750.1013 against 0
Iron mg: 7.5 to 8
Vitamin A μg: 900.2018 against 0
Vitamin B 1mg: 1.2 against 4
Vitamin B 2mg: 1.2 against 6
Vitamin Cmg: 100.311 against 0
Dietary fiber g: 21.21 against 0
Salt equivalent g: 7.5 to 8
Cheeseburger x 1 Tsukimi burger x 1 McDonald's Potato (M) x 2 McDonald's Potato (S) x 2 In addition, a few bottles of orange juice, milk, and vegetable juice. Just like asking for a value set during the day and night, It's a little too much, 2933kcal, If this is the case, it will be a little closer to reality! ?? (Probably because there are too many potatoes for fiber or something You can take dietary fiber from a slightly different menu etc.)
This is ** a regular potato version of the value set ** ** Drink, orange juice or milk or vegetable life ** Just make it **, which is quite ideal for nutritional balance **. It suggests that. (Slightly lacking dietary fiber / iron)
McDonald's food is good for your health! I can't say that It wouldn't be that bad.
According to this suggestion, try the following combinations I tried nutrition labeling on the official website mentioned above.
Image Source: McDonald's Official Website > Our Responsibility > Our Food > Nutrition Balance Check
Equivalent to one meal, almost every nutrient exceeds the 40% line per day, ** Just add milk and fruit juice to your value set ** ** It will be such an ideal meal! !! It seems that you can make a promotion like this. ** **
~~ There is a theory that there is an excess of fat. ~~ ~~ Also, maybe the most foods are milk and vegetable juice ~~ ~~ It may be possible to make a "corn flakes pentagon" by reinforcing it. ~~
Even more realistic, as a more realistic solution ** If any menu can be ordered up to once ** (That is, it is NG to order only 95 salads) Try to find the optimal solution with. The target menu range is also expanded to all normal types.
Just change the code as follows! ① For all regular menus (except baristas) (2) Add the condition "maximum value = 1" when defining the variable.
If any menu can be ordered only once
#Pull out the barista menu
target_menu_list = [x for x in McDonaldsDict.keys() if McDonaldsDict[x]["Classification"]!="Varistor"]
#Omission
#Variable definition upBound=1 is the condition that the maximum value is 1
xs = [pulp.LpVariable('{}'.format(x), cat='Integer', lowBound=0, upBound=1) for x in target_menu_list]
Let's see the result when you can order up to once!
** Result: 2453kcal **
Egg McMuffin x 1
Strawberry jam x 1
McGriddles_Bacon and eggs x 1
Side salad x 1
Share potato x 1
Sweet corn x 1
Suntory Black Oolong Tea#Darker x 1
Premium roasted iced coffee(L) × 1
Premium roast coffee(M) × 1
Premium roast coffee(S) × 1
Hot tea(straight)(M) × 1
McShake®_chocolate(S) × 1
Minute maid_Orange(S) × 1
Milk x 1
Liquid lemon x 1
Vegetable life 100(M) × 1
----result----
Energy kcal: 2300.2453 against 0
Protein g: 65.67 against 0
Lipid g: 63.9 vs. 95
Carbohydrate g: 330.331 against 6
Calcium mg: 750.856 against 0
Iron mg: 7.5 to 8
Vitamin A μg: 900.1161 against 0
Vitamin B 1mg: 1.1 for 4
Vitamin B 2mg: 1.2 against 6
Vitamin Cmg: 100.254 against 0
Dietary fiber g: 21.21 against 0
Salt equivalent g: 7.5 to 8
It's a pity that the typical burger system has disappeared, I was able to get a solution that I could order reasonably realistically. Salad, sweet corn, vegetable life, Milk, orange juice, etc. The ace from the last time is still selected. ** The surprising result is that McShake®_chocolate is included **.
Finally, the representative of the nutritional balance pentagon, Let's add the data of Frosted Flakes (Kellogg). From Kellogg's official website, refer to the data of Frosted Flakes, Create Dict data individually as shown below. Just add it to the original data and run it.
Frosted flakes data
from collections import OrderedDict
##Addition of milk-free version of corn frosty data
#Reference: https://www.kelloggs.jp/ja_JP/products/corn-frosties.html
k_od = OrderedDict()
k_od['Product name'] = "Frosted flakes"
k_od['Weight g'] = 30.0
k_od['Energy kcal'] = 114.0
k_od['Protein g'] = 1.7 #1.2~2.2
k_od['Lipid g'] = 0.25 #0~0.5
k_od['Carbohydrate g'] = 26.9
#k_od['Sodium mg'] =
#k_od['Potassium mg'] =
k_od['Calcium mg'] = 1.5 #0.5~2.5
#k_od['Phosphorus mg'] =
k_od['Iron mg'] = 1.4
k_od['Vitamin A μg'] = 96 #53~139
k_od['Vitamin B 1mg'] = 0.47
k_od['Vitamin B 2mg'] = 0.42
#k_od['Niacin mg'] =
k_od['Vitamin Cmg'] = 15
#k_od['Cholesterol mg'] =
k_od['Dietary fiber g'] = 1.2 #0.4~2.0
k_od['Salt equivalent g'] = 0.3
#k_od['Classification'] =
#Addition Addition of Frosted Flakes data
#McDonaldsDict["Frosted flakes"] = k_od
This time, the menu focuses on McDonald's representative players. For the version without salad and with drink, Here are the results of the version with Frosted Flakes as an option.
** Result: 2544kcal **
Teriyaki McBurger x 0
Hamburger x 2
Cheeseburger x 0
Double cheeseburger x 0
Tsukimi Burger x 0
Big Mac x 0
Filet-O-Fish x 0
Chicken mac nugget_5 pieces x 0
McDonald's potato(M) × 2
Coca Cola(M) × 0
Minute maid_Orange(M) × 0
Milk x 3
Vegetable life 100(M) × 0
Frosted flakes x 7
----result----
Energy kcal: 2300.2544 against 0
Protein g: 65.68 against 0
Lipid g: 63.85 against 9
Carbohydrate g: 330.381 against 6
Calcium mg: 750.788 against 0
Iron mg: 7.5 vs. 14
Vitamin A μg: 900.940 against 0
Vitamin B 1mg: 1.4 vs 4
Vitamin B 2mg: 1.4 against 6
Vitamin Cmg: 100.145 against 0
Dietary fiber g: 21.21 against 0
Salt equivalent g: 7.5 vs 7
** Frosted Flakes x 7 ** ** Milk x 3 ** So, if you can't choose Frosted Flakes It was 2933kcal, but up to 2544kcal I was able to reduce the calorie intake. As expected ** That tiger is not Date. ** **
However, on the other hand, even with the addition of tigers ** Hamburger x 2 ** ** McDonald's Potato (M) x 2 ** It is also that the value set force is digging in ** It also shows the excellence of McDonald's **.
That is, corn frosty + milk for breakfast (~~ × 7 is quite a lot ~~) Even with a diet of value sets (potatoes) day and night, It seems that a decent nutritional balance is maintained.
Based on the results of this research ** If you can only bring McDonald's to an uninhabited island **, ** You can now order the best menu **.
Value set, even if the side is potato Although it gives a surprisingly good nutritional balance, Unless you choose salad or sweet corn It will be over-calorie. ** "Let's eat vegetables well" **
Also, as a drink Milk, vegetable life, orange juice, I found that the area was useful. If you make a nutritionally balanced pentagon with added vegetable life ** Can the yellow clown also fight a tiger with his arms folded? ** ** Adding side salad will further increase your strength.
On the other hand, if you narrow down the options to only the super-typical menu, In fact, it will be ** 8000 kcal or more **. ** Get fat if you order only what you like **, It turned out that. (obviously)
If you accept the side salad and sweet corn, While maintaining the nutrients needed for the day Because it was possible to keep calories below the standard value ** After all, as a guideline when living only at McDonald's ** ** While ordering a value set (potato) ** ** By ordering more salad, milk and vegetable life ** ** It is possible to maintain a relatively healthy nutritionally balanced diet. ** **
** Although it is a seemingly obvious conclusion to eat in a well-balanced manner, ** ** This can be achieved only by combining the options in one store ** ** Isn't it pretty Elai? ** **
~~ If I ask McDonald's for improvement, ~~ ~~ As the main option for Happy Meal, it costs about +100 yen ~~ ~~ I want you to be able to choose Teriyaki McBurger as well. ~~ ~~ Also, please incorporate the tool equivalent to this code into the official website. ~~ ~~ In that case, I would like to cooperate. ~~
Initially, the calculation of nutrients It is a typical problem of PuLP and linear programming, Also on McDonald's official website Because the data existed in list format I was wondering if it could be done quite easily.
But when I try to apply it to real data If you make it as it is, it will be a dangerous code. Japanese name variables, dynamic variable assignment, matrix expression definitions, etc. There are many parts that need to be changed from the PuLP sample, It took more ingenuity than expected.
Ultimately, thanks to these ingenuity I was able to deepen my research by exchanging various data ~~ playing ~~.
The code this time is only on the browser as long as you make CSV, Because it is organized in a form that can be executed with one copy and paste If you are interested, please try it again. I would like you to consider changing various conditions. It can be done from a window or an apple because it can be done in Colaboratory.
The menu data on the McDonald's official website is Results may change as it seems to be updated daily.
that's all. The result of this study is ** Feeling guilty every time you go through the McDonald's Gate ** ** I hope it helps to help Mac followers who lack devotion. ** ** ~~ I think someone said that there are many Mac followers among engineers ~~