ä»åããã¯ããã°ãæ¸ãã«ãããã以ä¸ã®è¨äºãåèã«ãã¾ããã
ãã¡ãã®è¨äºã§ã¯ããã¯ããã«ãã®ã¡ãã¥ã¼ã対象ã«çµã¿åããæé©ååé¡ãæ±ã£ã¦ãããå 容ãé常ã«é¢ç½ãèªã¾ãã¦é ãã¾ããã ä»åãå¼ç¤¾askenã§ãèªç¤¾ãã¼ã¿ã使ç¨ãã¦é£äºã®çµã¿åããæé©ååé¡ããã£ã¦ã¿ãã®ã§ãç´¹ä»ãã¾ãã
ã¯ããã«
ããã«ã¡ã¯ï¼
askenã§æ©æ¢°å¦ç¿ã¨ã³ã¸ãã¢ã¨ãã¦åãã¦ããyumaã§ãã shoku_panã¨ããååã§Twitterããã£ã¦ã¾ãã
ãã¦ã¿ãªãããå¼ç¤¾ãã¤ã¨ããã¢ããªããããããããåç¥ã§ããï¼
ããããã§ã¯ããã®æ¥ã®é£äºå 容ãè¨é²ããã¨æ é¤å£«ã®æªæ¥ï¼ã¿ãï¼ããããã¢ããã¤ã¹ããããã¾ããç¹æ°ãåºãã®ã§ãé«å¾ç¹ãã¨ããã¨ãã¢ããã¼ã·ã§ã³ã«ãªã£ã¦ããæ¹ãããã£ãããã¨æãã¾ãã
ãã¡ããåã使ã£ã¦ãã¾ããã¡ãªã¿ã«ä»å¹´ã®ãæ£æã¯ãã®ãããªçµæã«ãªãã¾ããã
32ç¹ãããã¯ãããã
ãªã«ãè¯ããªãã£ãã®ãã詳ããè¦ã¦ã¿ã¾ãããã
ãã®ããã«ãããããã§ã¯åæ é¤æåã«ã¤ãã¦ãç´°ããéä¸è¶³ã確èªã§ãã¾ãã
å·¦ã®ã°ã©ããè¦ãã¨ãå ¨ä½çã«æåéãä¸è¶³ãã¦ããããã§ããã è質ã«å ãã¦ãçæ°´åç©ã飽åèèªé ¸ãå¡©åã¯éå°ã¨ãªã£ã¦ãã¾ããã ã©ããããæåããã°é©æ£ãªã®ããå ·ä½çãªæ°å¤ã確èªãããã¨ãã§ãã¾ããå³ã®å³ã§ã¯ãä¾ãã°è質ã ã¨åºæºå¤ã36.7ã44.9gã¨ãªã£ã¦ãã¾ãã
32ç¹ãããããç¹æ°ãã¨ããããã©ãããªã100ç¹ãã¨ãããâ¦ã
é«å¾ç¹ãã¨ãããã«ã¯ãå½ç¶ã®ãã¨ãªãããã©ã³ã¹è¯ãæ é¤ãã¨ãå¿ è¦ãããããã§ãã ããããå¥åº·åº¦ã®ç¹æ°ã¯ã©ã®ããã«è¨ç®ããã¦ããã®ãã 調ã¹ãã¨ããã以ä¸ã®ããã«æ¸ããã¦ãã¾ãã1ã
ãé£äºã®ãã©ã³ã¹ã¨é©åº¦ãªéåãéè¦ã§ããããã¨ã ããã£ã¡ããããã©ãªããªãã§ããªããã ããªãâ¦ã
ããããå¥åº·åº¦ã§ã¯
- é£äºæåã«ããªã¼
- éåæ¶è²»ã«ããªã¼
- é£äºãã©ã³ã¹
- PFCãã©ã³ã¹
- ãèåã»ã¢ã«ã³ã¼ã«ã®é
ãè©ä¾¡é ç®ã«ãªã£ã¦ããããã§ãããªãã»ã©â¦ã
ã§ã¯ããã£ãããªã®ã§
ããããå ¨ã¦ã®è©ä¾¡é ç®ãé©æ£å¤ã«ããé£äºã®çµã¿åãããèãã¦100ç¹ã¨ãã
ãã¨ã«ææ¦ãã¦ã¿ã¾ãããï¼
ãªããä»åã¯ããã¾ã§é£äºã®çµã¿åããã ããèããããããéåæ¶è²»ã«ããªã¼ãã¯å¥éé©æ£å¤ãã¨ãããè¨å®ãã¦ãã¾ãï¼ãã¸ã§ã®ã³ã°20åããçãã¬10åããªã©ï¼ã
ãã¦ãããã§ãé£äºãã©ã³ã¹ãã¨ããè¨èãåºã¦ãã¾ããã
ãã®å³2ã«ããã¨ãæ³å®ããæåã«ããªã¼ã2,200kcal±200kcalã®å ´åã主é£ã¯5~7SVã¨ãªã£ã¦ãã¾ãããã®SVã¨ããã®ã¯é£äºãã©ã³ã¹ã¬ã¤ãã®ãåä½ãã§ãï¼ä»¥ä¸ãç°¡åã®ããé£äºãã©ã³ã¹èªä½ãSVã¨æ¸ããã¨ãããã¾ãï¼ããã¨ãã°ãã飯ä¸çã2æ¯ã¨ãã©ã1æ¯ã ã¨5ï¼=1.5Ã2+2ï¼SVã¨ãªãã¾ãã é£äºãã©ã³ã¹ã¨ããèãæ¹ã使ãã°ã1æ¥ã®é£äºã®çµã¿åããã¨éãããã¾ãã«è¨ç®ãããã¨ãã§ãã¾ãã ããããã§ã¯ãé£äºãã©ã³ã¹ã®éä¸è¶³ãæãã¦ããã¾ãã
32ç¹ã®åã®å ´åã主é£ã¯é©æ£ã主èã¯éå°ã§ãã®ä»ã¯ä¸è¶³ãã¦ãã¾ããã ãèåã»ã¢ã«ã³ã¼ã«ã®éã¯é©æ£ã¨ãªã£ã¦ãã¾ããã
ã¡ãªã¿ã«ããããã§ã¯ãé£äºãã©ã³ã¹ã®é©æ£å¤ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ããã
è¦ä»¶ã®æ´ç
ããã§ã¯ãããã¾ã§ã®å 容ããã£ããã¾ã¨ãã¾ãã
åãããããã§100ç¹ãã¨ãããã«ã¯ã以ä¸ã®æ¡ä»¶ãæºããé£äºã®çµã¿åãããèããå¿ è¦ãããã¾ã3ã
é ç® | å°é ç® | æ¡ä»¶ |
---|---|---|
é£äºæåã«ããªã¼ï¼kcalï¼ | 1637ã1900 | |
é£äºãã©ã³ã¹ï¼SVï¼ | 主é£SV | 3ã4 |
å¯èSV | 5ã | |
主èSV | 3ã4 | |
æå®SV | 2 | |
乳製åSV | 2 | |
ãèåã»ã¢ã«ã³ã¼ã«ã®éï¼kcalï¼ | ã200 | |
PFCãã©ã³ã¹ï¼gï¼ | ããã±ã質 | 144.6ã176.8 |
è質 | 36.7ã44.9 | |
çæ°´åç© | 186ã227.4 |
ãããå ¨ã¦ã®æ¡ä»¶ãæºããé£äºã®çµã¿åãããèããªããã°ãããªãâ¦ãããããã¨è©¦è¡é¯èª¤ããã°ãã¾ãçµã¿åãããè¦ã¤ããã¨ã¯æãã¾ãããããªã大å¤ããâ¦ã
ããã§ä»åã¯ãè¤æ°æ¡ä»¶ãæºããé£äºã®çµã¿åãããã
ãä¸ããããå¶ç´æ¡ä»¶ã®ä¸ã§ãããç®çé¢æ°ãæ大ãããã¯æå°ã«ãã解ãæ±ãããæé©ååé¡ãã
ã¨ãã¦æããæé©ååé¡ã®ä¸ã¤ã§ããç·å½¢è¨ç»åé¡ã¨ãã¦æ±ã£ã¦ã¿ã¾ããã
ç·å½¢è¨ç»åé¡
ããã§ã¯ãç·å½¢è¨ç»åé¡ã®å®ç¾©ã«ã¤ãã¦ç¢ºèªãã¾ãã
â»æ°å¦ãè¦æãªæ¹ã¯èªã¿é£ã°ãã¦é ãã¦ãã¾ãã¾ããã
ç·å½¢è¨ç»åé¡ï¼linear programming problemï¼ã¨ã¯ãæéåã®ç·å½¢å¶ç´å¼ï¼ä¸æ¬¡ä¸çå¼ãä¸æ¬¡çå¼ï¼ã®ãã¨ã§ç·å½¢é¢æ°ï¼ä¸æ¬¡é¢æ°ï¼ãæå°ï¼ãããã¯æ大ï¼ã«ããåé¡ã§ãã
ç·å½¢è¨ç»åé¡ã¯ã ã¨ãã¦ã ï¼å¶ç´æ¡ä»¶ï¼ãæºãã㧠ç·å½¢é¢æ°ï¼ç®çé¢æ°ï¼ ãæå°åããåé¡ã¨ãã¦ã
ã¨æ¸ããã¨ãã§ãã¾ã4ã
ããã§ããå®æ°å ¨ä½ã®éåãã¯ã®è»¢ç½®ã表ãã¾ããå ·ä½çã«
ã¨æ¸ããã¨ã«ããã¨
ã¨æ¸ããã¨ãã§ãã¾ã5ã
ç·å½¢è¨ç»åé¡ã解ãæ¹æ³ï¼ç·å½¢è¨ç»æ³ï¼ã¨ãã¦ã¯ãã·ã³ãã¬ãã¯ã¹æ³ï¼simplex methodãåä½æ³ï¼ã¨ããã¢ã«ã´ãªãºã ãæåã§ãå®ç¨ä¸ãé«éã§ãããã¨ããåºãç¨ãããã¦ãã¾ãã
ãã¦ããã®ãããªå½¢ã«ã§ããåé¡ã¯ãç·å½¢è¨ç»åé¡ã¨ãã¦æ±ããã¨ãã§ãã¾ãã ããããç·å½¢è¨ç»åé¡ã¨ãã¦æ±ãããã¨ã¨ãããã解ãããã¨ã¨ã¯è©±ãå¥ã§ãã
ç·å½¢è¨ç»åé¡ã解ããã¨ãã§ããå ´åãå®è¡å¯è½ï¼ãã®è§£ãå®è¡å¯è½è§£ï¼ã解ããã¨ãã§ããªãå ´åãå®è¡ä¸è½ã¨è¨ãã¾ãã å®è¡å¯è½è§£ã®ãã¡ãç®çé¢æ°ãæé©ã«ãã解ãæé©è§£ã¨ããã¾ãããæé©è§£ã¯å¿ ãããåå¨ããã¨ã¯éãã¾ããã
以ä¸ã®ä¾ã§ç¢ºèªãã¦ã¿ã¾ãããã
â æé©è§£ãåå¨
ãã®å ´åãæé©è§£ã¯ã¨ãªãã¾ãã
â¡å®è¡å¯è½ã ãæé©è§£ãåå¨ããªã
ãã®å ´åããæºããã¨ãã¦ãããã§ã大ããªå¤ãã¨ããã¨ãã§ããã®ã§ãå®è¡å¯è½ã§ããæé©è§£ã¯åå¨ãã¾ããã
â¢å®è¡ä¸è½
ãã®å ´åããæºããã¯åå¨ãããå®è¡ä¸è½ã¨ãªãã¾ãã
å®å¼å
â»ãã®é¨åããæ°å¦ãè¦æãªæ¹ã¯èªã¿é£ã°ãã¦é ãã¦ãã¾ãã¾ããã
ç·å½¢è¨ç»åé¡ãã©ããã£ããã®ããããã£ãã¨ããã§ãè¤æ°æ¡ä»¶ãæºããé£äºã®çµã¿åãããç·å½¢è¨ç»åé¡ã¨ãã¦æ±ãæ¹æ³ãèãã¾ãã
ããããã«ã¯ãè¨å¤§ãªé£åãã¼ã¿ã®ãã¼ã¿ãã¼ã¹ããããåé£åãã©ããã£ãæ é¤æåãã©ãã ãå«ããã¨ãã£ãæ å ±ãæã£ã¦ãã¾ã6ã
ããã§ãã飯ãå³åæ±ãªã©ã¨ãã£ãé£åã®æ°ãã³ããé£äºæåã«ããªã¼ããé£äºãã©ã³ã¹ãããèåã»ã¢ã«ã³ã¼ã«ã®éããPFCãã©ã³ã¹ãã¨ãã£ãé ç®ã®æ°ãã³ã¨ãã¾ã7ãããã¦ã
- é£åãé¸ã¶åæ°ã
- é£åã«å«ã¾ããé ç®ã®éã
- é ç®ã®é©æ£ç¯å²ã®ä¸éããã³ä¸éã
ã¨ããã¨ãé ç®ã«å¯¾ãã¦è¨±ãããæ¡ä»¶ã¯
ã¨ããå¶ç´æ¡ä»¶ã«ãªãã¾ãã
ããã«ãé£åã«å«ã¾ããã«ããªã¼ã®éãã¨ãã¦ãç®çé¢æ°ã
ã¨ããã¨ã
ã¯ã
ãããããå¥åº·åº¦ã100ç¹ã§ãããã¤æåã«ããªã¼ãæå°åããé£äºã®çµã¿åãããæ±ããã
ã¨ããç·å½¢è¨ç»åé¡ã«ãªãã¾ãã
å®è£
è¤æ°æ¡ä»¶ãæºããé£äºã®çµã¿åãããç·å½¢è¨ç»åé¡ã¨ãã¦æ±ãããã¨ãããã£ãã¨ããã§ãããããå®è£ ã«å ¥ãã¾ãã
ä»åã¯ãè¨èªã¯Pythonãç°å¢ã¯Google Colaboratoryã使ç¨ãã¾ããã
PuLP
Pythonã§ç·å½¢è¨ç»åé¡ãæ±ãããã«ãPuLPã¨ããã©ã¤ãã©ãªã使ç¨ãã¾ããã¾ãã¯ã¤ã³ã¹ãã¼ã«ãã¦ããã¾ãããã
!pip install pulp
PuLPã®ä½¿ãæ¹ã確èªããããã«ãã¾ãã¯ç·å½¢è¨ç»åé¡ã®èª¬æã§ãããç°¡åãªä¾ã§åããã¦ã¿ã¾ãããã
â æé©è§£ãåå¨
from pulp import * prob = LpProblem(sense=LpMinimize) # ã¢ãã«ã®ä½æï¼æå°ååé¡ï¼ x1 = LpVariable('x1', lowBound=0) # å¤æ°ã®ä½æ x2 = LpVariable('x2', lowBound=0) # å¤æ°ã®ä½æ prob += -x1-2*x2 # ç®çé¢æ°ã®è¨å® prob += x1+x2 == 1 # å¶ç´æ¡ä»¶ã®è¨å® prob.solve() # 解ã print(LpStatus[prob.status]) # 解ã®ç¶æ print(value(x1), value(x2)) # 解 # Optimal # 0.0 1.0
PuLPã§ç·å½¢è¨ç»åé¡ã解ãæµãã¯ä»¥ä¸ã§ãã
- ã¢ãã«ãä½æãã¾ãã
LpProblem(sense=LpMinimize)
ã¨ãããã¨ã§æå°ååé¡ã®ã¢ãã«prob
ãä½æãã¦ãã¾ãï¼æ大ååé¡ã¯LpMaximize
ï¼ã - å¤æ°ãä½æãã¾ãã
LpVariable
ã«å¤æ°åï¼x1
,x2
ï¼ã¨æå°å¤ï¼lowBound=0
ï¼ãä¸ãã¦ãã¾ããããã«upBound=10
ãªã©ã¨ãã¦æ大å¤ãè¨å®ãããã¨ãã§ãã¾ãã - ç®çé¢æ°ãè¨å®ãã¾ããç®çé¢æ°ã¯ãä½æããã¢ãã«
prob
ã«ä¸æ¬¡é¢æ°ã追å ãããã¨ã§è¨å®ã§ãã¾ãã - å¶ç´æ¡ä»¶ãè¨å®ãã¾ããå¶ç´æ¡ä»¶ã¯ãä½æããã¢ãã«
prob
ã«ä¸æ¬¡ä¸çå¼ãããã¯ä¸æ¬¡çå¼ã追å ãããã¨ã§è¨å®ã§ãã¾ãã - æå¾ã«
prob.solve()
ã¨ãã¦åé¡ã解ãã¾ããå¾ããã解ã®ç¶æ ã¯LpStatus[prob.status]
ãå®éã®è§£ã®å¤ã¯value(x1), value(x2)
ã§åå¾ã§ãã¾ãã
å®è¡ããçµæããæé©è§£ï¼Optimal
ï¼ãã¨ãæé©è§£ã確ãã«å¾ããã¾ããã
ãâ¡å®è¡å¯è½ã ãæé©è§£ãåå¨ããªãããâ¢å®è¡ä¸è½ãã«ã¤ãã¦ãåæ§ã«å®è¡ã§ãããããããæé©è§£ç¡ãï¼Unbounded
ï¼ããå®è¡ä¸è½ï¼Infeasible
ï¼ãã¨ãªããã¨ã確èªã§ãã¾ãã
ã§ã¯å®éã«é£åã®ãã¼ã¿ã«å¯¾ãã¦PuLPã使ã£ã¦ã¿ã¾ãããã
ä»å使ç¨ããé£åãã¼ã¿ï¼data.csvï¼ã¯ä»¥ä¸ã®å 容ã§ãã
- idï¼
str
ï¼ï¼é£åã®id - nameï¼
str
ï¼ï¼é£ååï¼ã飯ãå³åæ±ãªã©ï¼ - energyï¼
float
ï¼ï¼é£åã®ã«ããªã¼ - shushoku_svãshusai_svãfukusai_svãfruits_svãmilk_svï¼å
¨ã¦
float
ï¼ï¼é£åã®åé£äºãã©ã³ã¹ - proteinãlipidãcarbohydrateï¼å
¨ã¦
float
ï¼ï¼é£åã®PFC - alcoholãokashi_energyï¼å
¨ã¦
float
ï¼ï¼ãèåã»ã¢ã«ã³ã¼ã«ã®é
ããããããpandasã§dataframeã¨ãã¦ç¨æãã¦ããã¾ãã
import pandas as pd df = pd.read_csv('data.csv')
ã¾ããåé ç®ã®æå°å¤ã¨æ大å¤ãè¾æ¸ã¨ãã¦ç¨æãã¦ããã¾ãã
# åé ç®ã®æå°å¤ã¨æ大å¤ãè¨å® item_dict = { 'energy' : {'min': 1637, 'max': 1900}, 'shushoku_sv' : {'min': 3, 'max': 4}, 'fukusai_sv' : {'min': 5, 'max': 99}, 'shusai_sv' : {'min': 3, 'max': 4}, 'fruits_sv' : {'min': 2, 'max': 2}, 'milk_sv' : {'min': 2, 'max': 2}, 'okashi_alcohol' : {'min': 0, 'max': 200}, 'protein' : {'min': 144.6, 'max': 176.8}, 'lipid' : {'min': 36.7, 'max': 44.9}, 'carbohydrate' : {'min': 186, 'max': 227.4}, }
次ã«é¢æ°ãç¨æãã¦ããã¾ãã
# é¢æ°å®ç¾© def create_LpVariable(x, lowBound, upBound): """å¤æ°ï¼LpVariableï¼ãä½æãã""" return LpVariable(name=str(x), lowBound=lowBound, upBound=upBound, cat='Integer') def show_result(df, lp_status): """çµæã表示ãã""" df = df[['name', 'value'] + list(item_dict.keys())] df = df[df['value']>=1] # çµã¿åããã¨ãã¦é¸ã°ããé£åã®ã¿è¡¨ç¤º df = df.astype({'value': int}) print(f'STATUS {lp_status}\n') for i in item_dict: print('{} {:.2f}ï¼{}ã{}ï¼'.format(i, (df['value']*df[i]).sum(), item_dict[i]['min'], item_dict[i]['max'])) display(df[['name', 'value', 'energy']].sort_values('value', ascending=False)) def solve_lp_problem(df, lowBound, upBound): """ç·å½¢è¨ç»åé¡ãè¨å®ãã¦è§£ã""" prob = LpProblem(name="asken_lp_problem", sense=LpMinimize) # ã¢ãã«ã®ä½æï¼æå°ååé¡ï¼ df['var'] = df['id'].apply(create_LpVariable, args=(lowBound, upBound)) # å¤æ°ã®ä½æãidãå¤æ°åã¨ãã¦ä½æããå¤æ°ãvaråã«æ ¼ç´ãã¦ããã prob += (df['var']*df['energy']).sum() # ç®çé¢æ°ã®è¨å® for item in item_dict: # å¶ç´æ¡ä»¶ã®è¨å® prob += (df['var']*df[item]).sum() >= item_dict[item]['min'] prob += (df['var']*df[item]).sum() <= item_dict[item]['max'] prob.solve() # 解ã lp_status = LpStatus[prob.status] # 解ã®ç¶æ df['value'] = [row['var'].value() for _, row in df.iterrows()] # 解 return df, lp_status
詳細ãªèª¬æã¯å²æãã¾ãããdataframeã®åè¡ã«å¯¾ãã¦å¤æ°ãä½æããåé
ç®ã®å¤ã¨æãç®ãããã®ãå¶ç´æ¡ä»¶ã¨ããé¨åãæ®éã®å¤æ°ã§ã®è¨ç®ã¨åæãè¥å¹²ç°ãªãã¾ããããã«é¢ãã¦ã¯ãå¤æ°ãä½æããé¢æ°create_LpVariable
ãå¥éç¨æããdataframeã®apply
ã使ããã¨ã«ãã£ã¦ãåè¡ã®id
ãå¤æ°åã¨ãã¦ä½æããå¤æ°ãvar
åã«æ ¼ç´ãã¦ãã¾ãã
ããã§ã¯æ©éå®è¡ãã¦ã¿ã¾ãããã
lowBound = 0 # æå°å¤ upBound = 999 # æå¤§å¤ sample_num = 300 df_sample = df.sample(n=sample_num) # ã©ã³ãã ãµã³ããªã³ã° df_res, lp_status = solve_lp_problem(df_sample, lowBound, upBound) show_result(df_res, lp_status)
å¶ç´æ¡ä»¶ã®æå°å¤ã0ãæ大å¤ã¯ç¹ã«è¨ãã999ã¨ãã¦ãã¾ããããã¯ãåãé£åãããã¤é¸ãã§ãããï¼ãã ã999以ä¸ï¼ãã¨ã«ç¸å½ãã¾ããã¾ããçµã¿åããã¯ãã¼ã¿ããæ¯åã©ã³ãã ã«300ååãåºãããã«ãã¦ãã¾ãããã¼ã¿ãçµãè¾¼ããã¨ã§å®è¡æéãçãããã¨åæã«ãæ§ã ãªæé©è§£ãåºãã¦ã¿ããã¨ãã¾ããã
å ´åã«ãã£ã¦ã¯ãé¸ã°ãã300åã®çµã¿åããã§ã¯å®è¡ä¸è½ï¼Infeasible
ï¼ã¨ãªããã¨ãããããã®ã¨ãã¯æé©è§£ï¼Optimal
ï¼ãåºãã¾ã§å®è¡ãã¾ãã1åã®å®è¡æéã¯ããã1ã2ç§ã§ããã
æé©è§£ã®1ã¤ã¯ãã¡ãã§ãï¼ç»åã®ä¸é¨ãå å·¥ãã¦ãã¾ãï¼ã
ãè ¹ãã£ã·ããã£ã·ãã«ãªã£ã¡ããã
20æ¯ãããã§é£½ãã¡ãããããªã®ã§ãã¨ããããupBound=5
ã¨ãã¦åãé£åã¯æ大ã§ã5åã¾ã§ã¨ãã¦ã¿ã¾ããã5åã¾ã§ãªããªãã¨ããããã®ã§ã¯â¦ï¼
æ大å¤ã5ã¨ãã¦ã¿ãçµæã¯ä»¥ä¸ã§ãã
ããã¯å ç¨ã®çµæã«æ¯ã¹ãã¨ç¾å®çã§ã¯ãªãã§ããããï¼ï¼
ãã¼ããå»ã¿ã®ãé£ã¹ãã®ã«ç¼ãã®ããé£ã¹ããã§ãã
ã¯ãªã£ããã¼â¦ï¼
ãã¯ãªãªï¼è±èï¼ãã¨ããããã³ãªã¼ãã§ãã¯ãªã£ããã¼ãã å±±å£çã§ã¯ç¹ã«æåã ããã§ãã çã¿ãããããã¦ã¬ã³ã½ã¦ä¸¦ã¿ã®ãã¿ãã³Cãé£ç©ç¹ç¶ãè±å¯ã ããã ãªãã»ã©ãç¥ããªãã£ãâ¦ã
ã©ã³ãã ãµã³ããªã³ã°ãã¦ããã®ã§ãå®è¡ãã度ã«çµæãç°ãªãã¾ãã ä»ã®æé©è§£ãè¦ã¦ã¿ã¾ãããã
ãã¦ãããã§ã¯ãããããã®é£äºã®çµã¿åãããããããã«ç»é²ãã¦ã¿ã¾ãã
çµæã¯â¦
100ç¹ãããã¯ããã
ã·ãã¥ã¬ã¼ã·ã§ã³ã ããããã¡ã§ããã å®éã«ãã¡ããã¨é£ã¹ãã¾ã§ãããããã§ãã
ã¾ã¨ã
ä»åãããããã§100ç¹ãã¨ãé£äºã®çµã¿åãããèãã¾ããã è¤æ°æ¡ä»¶ãæºããé£äºã®çµã¿åãããæ¢ãåé¡ããæé©ååé¡ã®ä¸ã¤ã§ããç·å½¢è¨ç»åé¡ã¨ãã¦æ±ãã¾ããã
ç·å½¢è¨ç»åé¡ã¯ãPythonã§ã¯PuLPã使ã£ã¦å®è£ ãããã¨ãã§ãã¾ãã
ç¡äºã100ç¹ãã¨ããã¨ããç®æ¨ã¯éæã§ããã®ã§ãããçµæã確èªããã¨ä»¥ä¸ã®èª²é¡ãèãããã¾ããã
- ææ¼æ©ã«åãã¦èãã
ããããã§ã¯ã1é£ã ãã§ãªãææ¼æ©ã®3é£ãã¹ã¦ãè¨é²ãããã¨ã§ç¹æ°ãè¦ããã¨ãã§ãã¾ããä»åã¯çµæãé©å½ã«3é£ã«ããã¦ç»é²ãã¾ããããå®éã«ã¯1é£ãã¨ã«é£äºã®çµã¿åãããèããå¿ è¦ãããã¾ãã - 妥å½ãªçµã¿åãããèãã
ãã¨ãã°ãã飯ã»å³åæ±ã»ç¼ãéãããã³ã»ã¨ã¼ã°ã«ãã»éèã¸ã¥ã¼ã¹ãã¯ããããçµã¿åããã ã¨æãã¾ãããããã³ã»ç¼ãéã»ã·ã¥ã¦ãã¤ããªã©ã¯ãã¾ãè¦ãªãçµã¿åãããã¨æãã¾ãã - æã«å
¥ãããããã®ã«çµã
ããããã®ãã¼ã¿ãã¼ã¹ã«ã¯ãä¸è¬çãªé£åããã¬ã¢ãªé£åã¾ã§å¤å²ã«ãããé£åã®ãã¼ã¿ãç»é²ããã¦ãã¾ããæ示ãããé£åãèªåã«ã¨ã£ã¦å ¥æãã¥ãããã®ã§ããã°ãã¾ãæå³ãããã¾ããï¼è¿ããã®ã§ä»£ç¨ããã¨ããæã¯ããã¾ããï¼ãåºãä¸è¬çãªé£åããããã¯ãã®äººã«ã¨ã£ã¦æã«å ¥ãããããã®ã«éå®ãã¦çµã¿åãããæ示ããå¿ è¦æ§ãããããããã¾ããã
ã¿ãªããããããããã使ã£ã¦ãªãªã¸ãã«ã®100ç¹ã¬ã·ããã¤ãã£ã¦ã¿ã¾ãããï¼
ãã©ã³ã¹ã®ããé£äºã¨é©åº¦ãªéåã§ãå¥åº·ãªæ¯æ¥ãéããã¦ãã ããã
ãç¥ãã
askenã§ã¯ãä¸ç·ã«åãã¦ãããã¨ã³ã¸ãã¢ãåéãã¦ãã¾ãï¼
主ãªåèè³æ
- ãã¯ããã«ãã§ä¸æ¥åã®æ é¤ãåããçµã¿åãããè¨ç®ãããè¡æã®çµæã«
- 京é½å¤§å¦ æ°çæ°ç解æç 究æè¬ç©¶é²
- æ±äº¬å·¥æ¥å¤§å¦ 大å¦é¢ç¤¾ä¼çå·¥å¦ç ç©¶ç§ çµå¶å·¥å¦å°æ» è¬ç¾©ãã¼ã
- çæ³¢å¤§å¦ è¬ç¾©ãã¼ã
- 3é£è¨é²å¾ã«è¡¨ç¤ºããããã¢ããã¤ã¹ç»é¢ã®æåæ é¤ç´ ã°ã©ããå¤å®åºæºããã¿ã³ãã確èªã§ãã¾ãã↩
- https://www.maff.go.jp/j/balance_guide/↩
- é£äºæåã«ããªã¼ã¯ãã°ã©ãã§ã¯ã1637ã2037(kcal)ããé©æ£ç¯å²ã¨ãªã£ã¦ãã¾ãããSVã®é©æ£ç¯å²ï¼é£äºæåã«ããªã¼ã«ãã£ã¦å¤ããï¼ãåºå®ãã¦æ±ãããããããããæ大å¤ã1900(kcal)ã¨ãã¦ãã¾ãã↩
- ãsubject toãã¯ããã¨ããæ¡ä»¶ã®ãã¨ã§ãã¨ããæå³ã§ãã↩
- å®éã«ã¯ãç·å½¢è¨ç»åé¡ã®åºæºç³»ï¼canonical formï¼ã¯ãç®çé¢æ°ãæ大åããåé¡ã§ããããããç®çé¢æ°ãæ大åããåé¡ã¯ãåããç®çé¢æ°ãæå°åããåé¡ã¨æãããã¨ãã§ãã¾ããã¾ããä¸è¨åºæºç³»ã®å¶ç´æ¡ä»¶ã¯ãã¹ã¦ããã®åãã«ãªã£ã¦ãã¾ãããããã®ãã®ããã£ãã¨ãã¦ã両辺ã«ãããããã¨ã§åããæãããã¨ãã§ãã¾ããããã«ãå¶ç´æ¡ä»¶ã«çå¼ããã£ãå ´åã§ããéè² ã®å®æ°ãæ°ãã«å ãããã¨ã§ä¸çå¼ã«ãããã¨ãã§ãã¾ããä»åã¯ç°¡åã®ãããä¸è¨ã®å½¢å¼ãç·å½¢è¨ç»åé¡ã¨ãã¦æ±ããã¨ã«ãã¾ãã↩
- ä»åãå¸è²©é£åã®ãã¼ã¿ã¯å¯¾è±¡å¤ã¨ãã¦ãã¾ãã↩
- å®éã«ã¯ä»ã§ãããä¸è¬çãªå½¢ã§æ¸ãã¦ãã¾ãã↩