线性规划大作业.docx
- 文档编号:24152617
- 上传时间:2023-05-24
- 格式:DOCX
- 页数:26
- 大小:19.87KB
线性规划大作业.docx
《线性规划大作业.docx》由会员分享,可在线阅读,更多相关《线性规划大作业.docx(26页珍藏版)》请在冰豆网上搜索。
线性规划大作业
线性规划大作业
题目:
GeorgeDantzig曾使用线性规划建立饮食结构。
现在请你选择你的爸爸(妈妈)或其他熟悉的亲人,根据他(她)的身体状况、饮食习惯、运动情况等因素,为你亲人确定一周的合理饮食。
另外,回答下面的问题:
1、每餐亲人应该吃什么?
2、如果亲人同意减少食品种类,你的建议有什么变化;
3、如果每周的预算超过150元,你的建议如何变化;
4、哪些重要的矿物质和维生素会限制解决方案
分析:
考虑到此模型的选择对象是我的父亲,因此饮食结构基本考虑是一个中年男子的饮食结构,但考虑到父亲有胆结石及脂肪肝,在脂肪及热量上有所减少。
营养上考虑的项目有蛋白质、脂肪、碳水化合物、热量、钙(主要由于爸爸身高较高)、维生素A及维生素C。
食物上,蔬果主要考虑时令蔬果。
营养上,维生素B族及E、F由于从部分食物的摄取可以满足,故在此模型中不再考虑;至于维生素D,因为考虑了钙质的摄入,故不再考虑了。
由于食物在烹制过程中会加入辅料及调料及喝绿茶的习惯,维生素A、C会有一个增加值。
在饮食营养上,一周的总量作为约束条件,这样比较科学,而且也更具可操作性。
由于每餐都可以自行决定吃什么,故不需要考虑工作条件的问题。
由于家里大家早晨都有喝咖啡的习惯,所以奶制品便由咖啡中的牛奶代替。
通过数据收集,所得数据整理如表所示:
(见附表)
(单位为:
价格为元/100克,蛋白质、脂肪、碳水化合物为克/100克,热量为千卡/100克,其他为毫克/100克)
模型假设:
考虑的食物有:
大米、面粉、萝卜、土豆、芋头、韭菜、芹菜、香菇、西红柿、香蕉、海带、黄豆芽、绿豆芽、牛肉、羊肉、猪肉、鸡、鸭、鸡蛋、带鱼、虾米(包括海鲜)、牛奶、大豆油、豆腐。
考虑的因素有:
价格、蛋白质、脂肪、碳水化合物、热量、钙、维生素A、维生素C。
(其中维生素A及维生素C的增加值有绿茶及辣椒产生)
约束因素有:
1.总预算小于150元
2.满足各种营养物质的需求(详见附表)
规划的时间为一周。
使用的软件:
Lingo8
代码:
model:
sets:
food:
volume,choice,cost,protein,fat,ch,heat,ca,va,vc;
endsets
data:
food,cost,protein,fat,ch,heat,ca,va,vc=
a10.347.50.5793511008
a20.44120.87033922110
b10.20.6062649312
b20.361.90.72812611516
b30.52.20.1167419276
b40.82.40.543056133215
b50.52.20.32201601012
b61.6131.85438412435
b70.560.60.321389211
b80.31.20.6209010563
b90.48.20.1572622250400
b100.511.527926858
b110.33.20.14302336
c13.620.110.20172730
c22.811.128.80.530611111
c3316.929.21.133511161
c42.223.31.2010411483
c52.816.57.50.113411470
c60.6814.811.60164551540
c72.415.93.41.510048291
c8546.82020588200
d10.83.13.54.6621201200
e11.601000900000
e20.249.21.2672110530;
enddata
min=@sum(food:
volume*cost);
!
食物的数量关于价格及营养的限制;
@for(food:
@sum(food(I):
volume*cost)<=150);
@for(food:
@sum(food(I):
volume*protein)>=350);
@for(food:
@sum(food(I):
volume*fat)>=84);
@for(food:
@sum(food(I):
volume*fat)<=140);
@for(food:
@sum(food(I):
volume*ch)>=2100);
@for(food:
@sum(food(I):
volume*heat)>=13720);
@for(food:
@sum(food(I):
volume*ca)>=5600);
@for(food:
@sum(food(I):
volume*va)>=(10000-4866));
@for(food:
@sum(food(I):
volume*vc)>=(525-95));
!
食物的种类的限制;
@for(food:
@bin(choice));
@for(food:
volume<=choice*1000);
!
避免出现choice=1而volume=0的问题;
@for(food:
volume>=@if(choice#eq#1,0.1,0));
@for(food:
@sum(food(I):
choice(I))>=15);
@for(food(I)|(I#ge#1)#and#(I#le#2):
@sum(food(I):
choice(I))>=1);
@for(food(I)|(I#ge#3)#and#(I#le#13):
@sum(food(I):
choice(I))>=1);
@for(food(I)|(I#ge#14)#and#(I#le#21):
@sum(food(I):
choice(I))>=1);
@for(food(I)|I#eq#22:
@sum(food(I):
choice(I))=1);
@for(food(I)|I#eq#22:
volume(I)>=8);
end
运算结果:
Localoptimalsolutionfoundatiteration:
33
Objectivevalue:
27.42368
VariableValueReducedCost
VOLUME(A1)33.704540.000000
VOLUME(A2)0.20000000.7547959E-02
VOLUME(B1)0.20000000.1710758
VOLUME(B2)0.20000000.2447815
VOLUME(B3)0.20000000.4007892
VOLUME(B4)2.9965010.000000
VOLUME(B5)0.20000000.4316437
VOLUME(B6)0.20000001.113649
VOLUME(B7)0.20000000.4872514
VOLUME(B8)0.20000000.1909130
VOLUME(B9)1.5414630.000000
VOLUME(B10)0.20000000.1963601
VOLUME(B11)0.20000000.2172928
VOLUME(C1)0.20000002.994948
VOLUME(C2)0.20000002.088508
VOLUME(C3)0.20000002.151219
VOLUME(C4)0.20000001.644011
VOLUME(C5)0.20000002.292376
VOLUME(C6)0.20000000.8398753E-01
VOLUME(C7)0.20000001.976909
VOLUME(C8)0.20000003.913582
VOLUME(D1)8.0000000.000000
VOLUME(E1)0.13438690.000000
VOLUME(E2)3.2805380.000000
CHOICE(A1)1.0000000.000000
CHOICE(A2)1.0000000.000000
CHOICE(B1)1.0000000.000000
CHOICE(B2)1.0000000.000000
CHOICE(B3)1.0000000.000000
CHOICE(B4)1.0000000.000000
CHOICE(B5)1.0000000.000000
CHOICE(B6)1.0000000.000000
CHOICE(B7)1.0000000.000000
CHOICE(B8)1.0000000.000000
CHOICE(B9)1.0000000.000000
CHOICE(B10)1.0000000.000000
CHOICE(B11)1.0000000.000000
CHOICE(C1)1.0000000.000000
CHOICE(C2)1.0000000.000000
CHOICE(C3)1.0000000.000000
CHOICE(C4)1.0000000.000000
CHOICE(C5)1.0000000.000000
CHOICE(C6)1.0000000.000000
CHOICE(C7)1.0000000.000000
CHOICE(C8)1.0000000.000000
CHOICE(D1)1.0000000.000000
CHOICE(E1)1.0000000.000000
CHOICE(E2)1.0000000.000000
COST(A1)0.34000000.000000
COST(A2)0.44000000.000000
COST(B1)0.20000000.000000
COST(B2)0.36000000.000000
COST(B3)0.50000000.000000
COST(B4)0.80000000.000000
COST(B5)0.50000000.000000
COST(B6)1.6000000.000000
COST(B7)0.56000000.000000
COST(B8)0.30000000.000000
COST(B9)0.40000000.000000
COST(B10)0.50000000.000000
COST(B11)0.30000000.000000
COST(C1)3.6000000.000000
COST(C2)2.8000000.000000
COST(C3)3.0000000.000000
COST(C4)2.2000000.000000
COST(C5)2.8000000.000000
COST(C6)0.68000000.000000
COST(C7)2.4000000.000000
COST(C8)5.0000000.000000
COST(D1)0.80000000.000000
COST(E1)1.6000000.000000
COST(E2)0.24000000.000000
PROTEIN(A1)7.5000000.000000
PROTEIN(A2)12.000000.000000
PROTEIN(B1)0.60000000.000000
PROTEIN(B2)1.9000000.000000
PROTEIN(B3)2.2000000.000000
PROTEIN(B4)2.4000000.000000
PROTEIN(B5)2.2000000.000000
PROTEIN(B6)13.000000.000000
PROTEIN(B7)0.60000000.000000
PROTEIN(B8)1.2000000.000000
PROTEIN(B9)8.2000000.000000
PROTEIN(B10)11.500000.000000
PROTEIN(B11)3.2000000.000000
PROTEIN(C1)20.100000.000000
PROTEIN(C2)11.100000.000000
PROTEIN(C3)16.900000.000000
PROTEIN(C4)23.300000.000000
PROTEIN(C5)16.500000.000000
PROTEIN(C6)14.800000.000000
PROTEIN(C7)15.900000.000000
PROTEIN(C8)46.800000.000000
PROTEIN(D1)3.1000000.000000
PROTEIN(E1)0.0000000.000000
PROTEIN(E2)9.2000000.000000
FAT(A1)0.50000000.000000
FAT(A2)0.80000000.000000
FAT(B1)0.0000000.000000
FAT(B2)0.70000000.000000
FAT(B3)0.10000000.000000
FAT(B4)0.50000000.000000
FAT(B5)0.30000000.000000
FAT(B6)1.8000000.000000
FAT(B7)0.30000000.000000
FAT(B8)0.60000000.000000
FAT(B9)0.10000000.000000
FAT(B10)2.0000000.000000
FAT(B11)0.10000000.000000
FAT(C1)10.200000.000000
FAT(C2)28.800000.000000
FAT(C3)29.200000.000000
FAT(C4)1.2000000.000000
FAT(C5)7.5000000.000000
FAT(C6)11.600000.000000
FAT(C7)3.4000000.000000
FAT(C8)2.0000000.000000
FAT(D1)3.5000000.000000
FAT(E1)100.00000.000000
FAT(E2)1.2000000.000000
CH(A1)79.000000.000000
CH(A2)70.000000.000000
CH(B1)6.0000000.000000
CH(B2)28.000000.000000
CH(B3)16.000000.000000
CH(B4)4.0000000.000000
CH(B5)2.0000000.000000
CH(B6)54.000000.000000
CH(B7)2.0000000.000000
CH(B8)20.000000.000000
CH(B9)57.000000.000000
CH(B10)7.0000000.000000
CH(B11)4.0000000.000000
CH(C1)0.0000000.000000
CH(C2)0.50000000.000000
CH(C3)1.1000000.000000
CH(C4)0.0000000.000000
CH(C5)0.10000000.000000
CH(C6)0.0000000.000000
CH(C7)1.5000000.000000
CH(C8)0.0000000.000000
CH(D1)4.6000000.000000
CH(E1)0.0000000.000000
CH(E2)6.0000000.000000
HEAT(A1)351.00000.000000
HEAT(A2)339.00000.000000
HEAT(B1)26.000000.000000
HEAT(B2)126.00000.000000
HEAT(B3)74.000000.000000
HEAT(B4)30.000000.000000
HEAT(B5)20.000000.000000
HEAT(B6)384.00000.000000
HEAT(B7)13.000000.000000
HEAT(B8)90.000000.000000
HEAT(B9)262.00000.000000
HEAT(B10)92.000000.000000
HEAT(B11)30.000000.000000
HEAT(C1)172.00000.000000
HEAT(C2)306.00000.000000
HEAT(C3)335.00000.000000
HEAT(C4)104.00000.000000
HEAT(C5)134.00000.000000
HEAT(C6)164.00000.000000
HEAT(C7)100.00000.000000
HEAT(C8)205.00000.000000
HEAT(D1)62.000000.000000
HEAT(E1)900.00000.000000
HEAT(E2)72.000000.000000
CA(A1)10.000000.000000
CA(A2)22.000000.000000
CA(B1)49.000000.000000
CA(B2)11.000000.000000
CA(B3)19.000000.000000
CA(B4)56.000000.000000
CA(B5)160.00000.000000
CA(B6)124.00000.000000
CA(B7)8.0000000.000000
CA(B8)10.000000.000000
CA(B9)2250.0000.000000
CA(B10)68.000000.000000
CA(B11)23.000000.000000
CA(C1)7.0000000.000000
CA(C2)11.000000.000000
CA(C3)11.000000.000000
CA(C4)11.000000.000000
CA(C5)11.000000.000000
CA(C6)55.000000.000000
CA(C7)48.000000.000000
CA(C8)882.00000.000000
CA(D1)120.00000.000000
CA(E1)0.0000000.000000
CA(E2)110.00000.000000
VA(A1)0.0000000.000000
VA(A2)11.000000.000000
VA(B1)3.0000000.000000
VA(B2)5.0000000.000000
VA(B3)27.000000.000000
VA(B4)1332.0000.000000
VA(B5)10.000000.000000
VA(B6)3.0000000.000000
VA(B7)92.000000.000000
VA(B8)56.000000.000000
VA(B9)40.000000.000000
VA(B10)5.0000000.000000
VA(B11)3.0000000.000000
VA(C1)3.0000000.000000
VA(C2)11.000000.000000
VA(C3)16.000000.000000
VA(C4)48.000000.000000
VA(C5)47.000000.000000
VA(C6)154.00000.000000
VA(C7)29.000000.000000
VA(C8)0.0000000.000000
VA(D1)120.00000.000000
VA(E1)0.0000000.000000
VA(E2)5.0000000.000000
VC(A1)8.0000000.000000
VC(A2)0.0000000.000000
VC(B1)12.000000.000000
VC(B2)16.000000.000000
VC(B3)6.0000000.000000
VC(B4)15.000000.000000
VC(B5)12.000000.000000
VC(B6)5.0000000.000000
VC(B7)11.000000.000000
VC(B8)3.0000000.000000
VC(B9)0.0000000.000000
VC(B10)8.0000000.000000
VC(B11)6.0000000.000000
VC(C1)0.0000000.000000
VC(C2)1.0000000.000000
VC(C3)1.0000000.000000
VC(C4)3.0000000.000000
VC(C5)0.0000000.000000
VC(C6)0.0000000.000000
VC(C7)1.0000000.000000
VC(C8)0
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 线性规划 作业