运筹学 菜篮子工程.docx
某市的菜篮子工程某市是一个人口不到15万的小城市,根据该市的蔬菜种植情况,分别在A、 B、C三地设三个收购点,再由收购点分别送到全市8个蔬菜市场。按照常年情 况,A、B、C三个收购点每天收购量分别为200、170和160 (单位:100kg), 各个菜市场每天需求量及发生供应短缺时的损失见表lo从收购点到个菜市场的 距离见表2,设从收购点到各菜市场蔬菜调运费用为1元/(100kg - 100m).表1各菜市场每天需求量及短缺损失菜市场每天需求量(100kg)短缺损失(元/100kg)175102608380547010510010655879058808表2收购点到各菜市场的距离距离(单位:100m)菜市场12345678收购点A488191162216B14771612162317C20191114615510(1)为该市设计一个从收购点到菜市场的定点供应方案,使蔬菜调运费用与预期 的短缺损失之和最小.若规定各菜市场短缺量一律不超过需求量的20%,重新设计定点供应方案.为了满足城市居民的蔬菜供应,该市的领导规划增加蔬菜种植面积,试问增 产的蔬菜每天应分别向A、B、C三个收购点各供应多少最为经济合理。参考答案:(1)调运总费用3890,短缺总损失720,总费用为4610 (方案略)。(2)调运总费用4208,短缺总费用598,总费用为4806 (方案略).(3)增产蔬菜80,每天都向C这个收购点供应最经济。因为根据题意,各菜市场的需求量大于各收购点的收购量,所以要增大收购量来满足短缺的 需求.与第一问比较分析,应使收购量大于目前的量,使需求量得到满足,不再产生短缺损失, 因此重新建立模型为:Minz=ZZ Cij *2, 3; j=l。8)i jZ"3)Exbj(i=l,2,3)XiJ =0(i=l,2,3; j=l.o 8)程序:Model:Sets :Jsd/lo .3/:a;Csc/lo o 8/ :b;J_c (jsd, esc) : x, c, 1;EndsetsData: a=200,170, 160;b=75, 60,80, 70, 100,55, 90,80; 1=4,8,8,19,11,6, 22, 16,14, 7, 7, 16, 12,16,23,17,20, 19, 11, 14,6, 15, 5,10;c=l, 1,1,1, 1,1,L 1,1.1, 1, 1, 1, 1, 1, 1,1.1.1, 1, 1,1, 1, 1;Enddata f or ( j sd (i):stl sum (esc (j ) : x (iz j ) )=a (i);for (esc (j ):st2 sum (j sd (i) : x (i, j ) ) =b (j );ob j min=sum (jsd (i) : sum (esc (j ) : c (i, j ) *x(i,j)*l(i,j);End运行结果为:Global optimal solution found.4770.0000o 00000012Objective value:Infeasibilities:Total solver iterations:ModelClass:LPTotalvariables:24Nonlinear variables:Integer variables:Total constraints:12Nonlinear constraints:0Total nonzeros:72Nonlinear nonzeros:0VariableValueReduced CostA ( 1)200.00000o 000000A( 2)170o 00000o 000000A( 3)160.0000Oo 000000B( 1)75.00000Oo 000000B ( 2)60o 00000Oo 000000B ( 3)80.000000.000000B ( 4)70o 000000.000000B( 5)100o 0000Oo 000000B ( 6)55o 00000Oo 000000B ( 7)90.00000Oo 000000B( 8)80.000000.000000X ( 1, 1)75.00000Oo 000000X( 1, 2)40.00000Oo 000000X( 1,3)0.0000000.000000X( 1, 4)0.0000002o 000000X ( 1, 5)30o 00000Oo 000000X( 1, 6)55o 000000.000000X( 1,7)0o 00000012.00000X( 1,8)0.000000lo 000000X ( 2, 1)0.000000llo 00000X( 2, 2)20o 000000.000000X( 2, 3)80.00000Oo 000000X ( 2, 4)70o 00000Oo 000000X ( 2, 5)Oo 0000002.000000X( 2,6)Oo 00000011.00000X(2,7)Oo 00000014o 00000X( 2,8)Oo 0000003o 000000X( 3,1)Oo 00000021o 00000X ( 3, 2)0.00000016.00000X( 3,3)0.0000008o 000000X( 3, 4)Oo 0000002o 000000X( 3,5)70o 000000.000000X( 3, 6)0.00000014.00000X ( 3, 7)90.00000Oo 000000X (3,8)80.000000.000000c(1,1)lo 000000Oo 000000c (1,2)lo 0000000.000000C(1,3)1.000000Oo 000000c (1,4)lo 000000Oo 000000C(1,5)lo 000000Oo 000000c (1,6)lo 0000000.000000c (1,7)lo 000000Oo 000000c (1,8)1.0000000.000000C(2,1)lo 0000000.000000c(2,2)1.0000000.000000C ( 2,3)lo 000000Oo 000000c (2,4)lo 000000Oo 000000c(2,5)1.0000000.000000c (2,6)lo 0000000.000000C(2,7)1.000000Oo 000000c (2,8)lo 0000000.000000C(3,1)1.0000000.000000c (3,2)lo 000000Oo 000000C(3,3)1.000000Oo 000000c (3,4)lo 0000000.000000c(3,5)1.000000Oo 000000c (3,6)1.0000000.000000c (3,7)1.000000Oo 000000C(3,8)1.000000Oo 000000L (1,1)4.000000Oo 000000L(1,2)8.0000000.000000L(1,3)8o 000000Oo 000000L (1,4)19o 000000.000000L (1,5)11.00000Oo 000000L (1,6)6o 000000Oo 000000L(1,7)22.00000Oo 000000L (1,8)16.000000.000000L(2,1)14o 000000.000000L (2,2)7o 0000000.000000L (2,3)7.000000Oo 000000L (2,4)16o 000000.000000L(2,5)12.000000.000000L(2,6)16.00000Oo 000000L (2,7)23.000000.000000L(2,8)17o 000000.000000L (3,1)20.000000.000000L (3,2)19.00000Oo 000000L(3,3)llo 00000Oo 000000L ( 3,4)14o 000000.000000L ( 3, 5)6o 000000Oo 000000L ( 3, 6)15o 000000o000000L ( 3, 7)5o 0000000.000000L( 3, 8)10.000000.000000RowSlack or SurplusDual PriceSTI ( 1)0o 000000-5o 000000STI ( 2)0.000000-4o 000000STI ( 3)80.000000o 000000ST2 ( 1)0.0000001.000000ST2 ( 2)0.000000-3.000000ST2 ( 3)0.000000-3.000000ST2 ( 4)Oo 000000-12o 00000ST2 ( 5)0.000000-6o 000000ST2 ( 6)Oo 000000-1.000000ST2 ( 7)0.000000-5o 000000ST2 ( 8)0o 000000-1 0 o00000OBJ4770o 000-lo 000000结果:最优运输方案为A运往菜市场1蔬菜数量为75公斤,运往菜市场2蔬菜数量为40公斤, 运往菜市场5蔬菜数量为30公斤,运往菜市场6蔬菜数量为55公斤;B运往菜市场2蔬菜 数量为20公斤,运往菜市场3蔬菜数量为80公斤,运往菜市场4蔬菜数量为70公斤;C 运往菜市场5蔬菜数量为70公斤,运往菜市场7蔬菜数量为90公斤,运往菜市场8蔬菜数量 为80公斤,最小损失为4770元根据结果知A收购量仍为200公斤,B收购量仍为170公斤,只有C收购量变为240公斤, 比较分析原先的结果,则增产的蔬菜向C多供应80公斤。(1)基本假设设Xij为第i个集散点向第j个菜市场供应蔬菜的数量,lij为第i个集散点到第j个菜市场供 应蔬菜的距离,bj为第j个市场每天的需求量,dj为第j个市场每天的短缺损失,ai为第i 个集散点每天的收购量,cij为第i个集散点向第j个菜市场的单位运费(i=123,j=l.。8)(2)约束条件、Z羽=。=1,2,3) iE/=bj g。8)iXij)=0(i=l,2, 3;>lo .8)(3)对各问求解分析第一问目标函数 minz=ZZ Cj * Xjlj + Ej%(瓦Z羽)(i=L2, 3户1。8) i j程序:Model:Sets:Jsd/1 o o 3/: a;Csc/1 o o 8/: b;dqss/lo .8/:d;J_c (jsd, esc): x, c,l;EndsetsData:a=200,170, 160;b=75,60, 80, 70, 100,55, 90, 80;d=10,8, 5, 10,10, 8,5,8;1=4, 8, 8, 19,11,6,22,16,14, 7,7,16, 12, 16,23, 17,20, 19, 11,14,6,15,5,10;c=l, 1, 1,1, 1,1,1, 1,1, 1,1, b b 1,1,1,1, 1,1,1, 1, 1,1, 1;Enddatafor(jsd (i):stl sum (esc (j):x(i,j)尸a);for(csc (j):Lst2 sum (jsd (i): x (i, j) )<=b(j);objmin=sum(jsd(i) :sum (esc (j) :c(iJ) *x (i,j)*l (ij) ) +sum (csc(j):d(j) *(b (j)-sum (jsd(i): x(i, j);End运行结果:Global optimal solution found.Objective value:Infeasibilities:Total solver iterations:Model Class:4610o 0000o 0000009LPTotal variables:24Nonlinear variables:0Integer variables:0Total constraints:12Nonlinear constraints:0Total nonzeros:70Nonlinear nonzeros:0B( 8)VariableValueReduced CostA ( 1)200o 00000.000000A ( 2)170.00000.000000A ( 3)160.00000o 000000B ( 1)75o 000000o 000000B( 2)60.000000o 000000B ( 3)80.000000.000000B( 4)70.00000Oo 000000B( 5)100o 0000Oo 000000B( 6)55o 000000.000000B( 7)90o 00000Oo 00000080o 000000o 000000D( 1)10.000000.000000D( 2)8.0000000.000000D ( 3)5o 000000Oo 000000D( 4)10o 000000.000000D ( 5)lOo 00000Oo 000000D( 6)8o 0000000.000000D( 7)5.000000Oo 000000D ( 8)8o 0000000.000000X ( 1, 1)75.000000.000000X ( 1, 2)0o 000000Oo 000000X ( 1, 3)40.00000Oo 000000X ( 1, 4)0o 0000002.000000X ( 1, 5)30.000000.000000X ( 1, 6)55o 00000Oo 000000X ( 1, 7)0.00000012.00000X (1,8)Oo 000000lo 000000X (2,1)0o 00000011.00000X (2,2)60.000000.000000X(2,3)40.000000.000000X(2,4)70o 000000.000000X (2,5)Oo 0000002o 000000X(2,6)0o 000000llo 00000X (2,7)Oo 00000014o 00000X (2,8)0.0000003.000000X(3,1)0.00000021o 00000X (3,2)Oo 00000016.00000X(3,3)0.0000008.000000X (3,4)Oo 0000002o 000000X(3,5)70.00000Oo 000000X(3,6)Oo 00000014.00000X(3,7)90o 000000.000000X(3,8)0.0000000.000000c (1,1)1.000000Oo 000000C(1,2)1.0000000.000000c (1,3)lo 000000Oo 000000c(1,4)1.0000000.000000c(1,5)1.000000Oo 000000C(1,6)1.000000Oo 000000c (1,7)lo 0000000.000000C(1,8)lo 000000Oo 000000C(2,1)lo 0000000.000000c(2,2)1.0000000.000000c(2,3)1.0000000.000000c (2,4)1.0000000.000000c (2,5)lo 000000Oo 000000C(2,6)1.000000Oo 000000c (2,7)1.0000000.000000c (2,8)lo 0000000.000000C(3,1)1.000000Oo 000000C(3,2)lo 0000000.000000C(3,3)lo 0000000.000000c (3,4)1.000000Oo 000000c (3,5)1.000000Oo 000000C(3,6)1.0000000.000000c (3,7)1.0000000.000000C(3,8)1.0000000.000000L (1,1)4o 0000000.000000L(1,2)8.0000000.000000L (1,3)8.000000Oo 000000L ( 1, 4)19o 00000Oo 000000L ( 1, 5)11.000000.000000L(1,6)6o 000000Oo 000000L( 1, 7)22o 000000.000000L ( 1, 8)16.00000Oo 000000L( 2, 1)14.000000.000000L( 2, 2)7.0000000.000000L( 2,3)7o 0000000.000000L( 2, 4)16o 00000Oo 000000L ( 2, 5)12o 000000.000000L ( 2, 6)16o 000000.000000L ( 2, 7)23.00000Oo 000000L ( 2, 8)17o 00000Oo 000000L( 3, 1)20o 000000.000000L( 3, 2)19o 00000Oo 000000L( 3, 3)11.00000Oo 000000L ( 3, 4)14o 00000Oo 000000L ( 3, 5)6.0000000.000000L( 3,6)15.00000Oo 000000L( 3, 7)5.000000Oo 000000L ( 3, 8)10o 00000Oo 000000RowSlack or SurplusDual PriceSTI ( 1)0o 000000-7.000000STI ( 2)0.000000-6o 000000STI ( 3)0o 000000-2.000000ST2 ( 1)0.00000013o 00000ST2 ( 2)0.0000007o 000000ST2 ( 3)0.0000004.000000ST2 ( 4)Oo 000000Oo 000000ST2 ( 5)Oo 0000006o 000000ST2 ( 6)Oo 0000009.000000ST2 ( 7)0.0000002.000000ST2 ( 8)80.000000.000000OBJ4610o 000-lo 000000结果分析最优运输方案为A运往菜市场1蔬菜数量为75公斤,运往菜市场3蔬菜数量为40公斤,运 往菜市场5蔬菜数量为30公斤,运往菜市场6蔬菜数量为55公斤;B运往菜市场2蔬菜数 量为60公斤,运往菜市场3蔬菜数量为40公斤,运往菜市场4蔬菜数量为70公斤;C运 往菜市场5蔬菜数量为70公斤,运往菜市场7蔬菜数量为90公斤,最小损失为4610元第二问目标函数minz=£Z C/Xij* 匕 + Ej d/S/Z 羽)g23;j=l。.8) i J新增一个约束条件:YjXirbj (j=100 8)程序Model:Sets:Jsd/1.3/:a;Csc/loo 8/:b;dqss/l.o 8/: d;J_c(jsd, esc) :x, c, 1;EndsetsData:a=200,170, 160;b=75,60,80, 70,100, 55, 90, 80;d=10, 8,5,10,10,8,5, 8;1=4, 8,8, 19,11, 6,22, 16,14, 7, 7, 16, 12,16, 23,17,20, 19,11, 14, 6, 15, 5, 10;c=l, 1,1, 1, 1, 1,1, 1,1,1,1,1,1,1, 1, 1,1, 1,1,1;Enddatafor(jsd(i):stl sum(csc(j): x (i, j)尸a (i);for (esc (j):Lst2 sum(jsd (i): x(i,j) (=b (j);for (csc(j):st3sum (jsd (i): x(i,j) )>=0.8*b (j);obj min=sum (jsd(i): sum (csc(j) :c (i, j) *x(i,j)*l (i,j) +sum(csc(j) :d(j)*(b(j) 一sum(jsd(i):x (i, j);End运行结果:Global optimal solution found.Objective value:Infeasibilities:Total solver iterations:4806.0000.00000011Model Class:LPTotal variables:24Nonlinear variables:200940Integer variables:Total constraints:Nonlinear constraints:Total nonzeros:Nonlinear nonzeros:VariableValueReduced CostA( 1)200o 00000o 000000A( 2)170.00000.000000A ( 3)160o 00000.000000B( 1)75.000000o 000000B ( 2)60o 000000.000000B ( 3)80.000000.000000B ( 4)70.000000.000000B ( 5)100o 0000Oo 000000B ( 6)55.00000Oo 000000B( 7)90o 000000.000000B( 8)80o 00000Oo 000000D( 1)10.00000Oo 000000D( 2)8o 0000000.000000D( 3)5.0000000.000000D ( 4)10.000000.000000D( 5)10.000000.000000D( 6)8.0000000.000000D( 7)5.000000Oo 000000D( 8)8.000000Oo 000000X( 1, 1)75.00000Oo 000000X( 1,2)0o 0000000.000000X ( 1,3)10.00000Oo 000000X ( 1, 4)Oo 0000002.000000X( 1, 5)60o 000000.000000X ( 1,6)55o 000000.000000X ( 1, 7)0.00000012o 00000X( 1,8)Oo 0000001.000000X( 2,1)0.00000011.00000X ( 2, 2)60o 00000Oo 000000X ( 2, 3)54o 000000.000000X( 2, 4)56.00000Oo 000000X ( 2, 5)0.0000002.000000X( 2, 6)0o 000000llo 00000X ( 2, 7)0.00000014.00000X(2,8)Oo 0000003.000000X(3,1)Oo 00000021o 00000X (3,2)0.00000016o 00000X(3,3)Oo 0000008o 000000X (3,4)Oo 0000002.000000X (3,5)24o 00000Oo 000000X(3,6)0.00000014.00000X (3,7)72o 000000.000000X(3,8)64.000000.000000C(1,1)lo 0000000.000000c (1,2)1.000000Oo 000000c (1,3)lo 0000000.000000c (1,4)1.0000000.000000c(1,5)1.0000000.000000C(1,6)lo 000000Oo 000000c (1,7)1.000000Oo 000000c(1,8)1.0000000.000000C(2,1)1.0000000.000000C(2,2)lo 0000000.000000c (2,3)lo 0000000.000000C(2,4)1.000000Oo 000000c(2,5)1.0000000.000000C(2,6)1.0000000.000000c (2,7)1.0000000.000000c (2,8)lo 0000000.000000c (3,1)lo 000000Oo 000000c(3,2)1.0000000.000000c(3,3)lo 0000000.000000c (3,4)lo 0000000.000000C(3,5)1.0000000.000000c (3,6)1.000000Oo 000000c(3,7)1.0000000.000000c (3,8)1.0000000.000000L(1,1)4.0000000.000000L(1,2)8o 0000000.000000L (1,3)8o 0000000.000000L(1,4)19o 00000Oo 000000L(1,5)11.000000.000000L(1,6)6o 000000Oo 000000L (1,7)22o 00000Oo 000000L (1,8)16o 000000.000000L (2,1)14o 00000Oo 000000L (2,2)7.0000000.000000L (2,3)7.0000000.000000L ( 2, 6)L ( 2, 4)16.0000012.000000o 000000Oo 000000L ( 2,5)16o 00000L( 2,0o7)00000023o 000000.000000L( 2,8)17.00000Oo 000000L ( 3,1)20.000000.000000L( 3,2)19o 000000.000000L ( 3,3)llo 000000.000000L ( 3,4)14.000000.000000L( 3,5)6.000000Oo 000000L( 3,6)15.00000Oo 000000L ( 3,7)5.0000000.000000L( 3,8)10o 000000.000000RowSlack or SurplusDual PriceSTI (1)0o 000000-1.000000STI (2)0.000000Oo 000000STI (3)0o 0000004o 000000ST2 (1)0o 0000007.000000ST2 (2)0o 000000lo 000000ST2 (3)16.00000Oo 000000ST2 (4)14o 000000.000000ST2 (5)16.00000Oo 000000ST2 (6)0.0000003.000000ST2 (7)18.00000Oo 000000ST2 (8)16.00000Oo 000000ST3 (1)15o 00000Oo 000000ST3 (2)12o 000000.000000ST3 (3)0.000000-2o 000000ST3 (4)0.000000-6o 000000ST3 (5)4.000000Oo 000000ST3 (6)llo 00000Oo 000000ST3 (7)0.000000-4.000000ST3 (8)0.000000-6o 000000OBJ4806o 000-lo 000000结果:最优运输方案为A运往菜市场1蔬菜数量为75公斤,运往菜市场3蔬菜数量为10公斤,运 往菜市场5蔬菜数量为60公斤,运往菜市场6蔬菜数量为55公斤;B运往菜市场2蔬菜数 量为60公斤,运往菜市场3蔬菜数量为54公斤,运往菜市场4蔬菜数量为56公斤;C运往 菜市场5蔬菜数量为24公斤,运往菜市场7蔬菜数量为72公斤,运往菜市场8蔬菜数量为 64公斤,最小损失为4806元第三问