1、数学建模作业 实验4最优化与存储模型实验实验4 最优化与存储模型实验1. 拟合问题解:解:(1) 根据题意可以列出目标方程:使用Lingo软件进行计算并取最优解,编程如下:model:sets:quantity/1.50/: x,y;endsetsmin=sum(quantity: (B0+B1*x-y)2);data:y=2 10 4 22 16 10 18 26 34 17 28 14 20 24 28 26 34 34 46 26 36 60 80 20 26 54 32 40 32 40 50 42 56 76 84 36 46 68 32 48 52 56 64 66 54 70 9
2、2 93 120 85;x=4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25;enddatafree(B0); free(B1);EndLocal optimal solution found. Objective value: 11353.52 Infeasibilities: 0.000000 Extended solver steps: 5 Total
3、solver iterations: 16 Variable Value Reduced Cost B0 -17.57909 -0.2710756E-08 B1 3.932409 -0.4680284E-07 X( 1) 4.000000 0.000000 X( 2) 4.000000 0.000000 X( 3) 7.000000 0.000000 X( 50) 25.00000 0.000000 Y( 1) 2.000000 0.000000 Y( 2) 10.00000 0.000000 Y( 3) 4.000000 0.000000 Y( 50) 85.00000 0.000000 R
4、ow Slack or Surplus Dual Price 1 11353.52 -1.000000由LINGO解得:0= -17.6,1=3.9(2) 根据题意可以列出目标方程:使用Lingo软件进行计算并取最优解,编程如下:model:sets:quantity/1.50/: x,y;endsetsmin=sum(quantity:abs(B0+B1*x-y);data:y=2 10 4 22 16 10 18 26 34 17 28 14 20 24 28 26 34 34 46 26 36 60 80 20 26 54 32 40 32 40 50 42 56 76 84 36 46
5、 68 32 48 52 56 64 66 54 70 92 93 120 85;x=4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25;enddatafree(B0);free(B1);End得到结果如下:Linearization components added: Constraints: 200 Variables: 200 Integers: 50 G
6、lobal optimal solution found. Objective value: 563.8000 Objective bound: 563.8000 Infeasibilities: 0.1776357E-14 Extended solver steps: 0 Total solver iterations: 83 Variable Value Reduced Cost B0 -11.60000 0.000000 B1 3.400000 0.000000 X( 1) 4.000000 0.000000 X( 2) 4.000000 0.000000 X( 3) 7.000000
7、0.000000 X( 50) 25.00000 0.000000 Y( 1) 2.000000 0.000000 Y( 2) 10.00000 0.000000 Y( 3) 4.000000 0.000000 Y( 50) 85.00000 0.000000 Row Slack or Surplus Dual Price 1 563.8000 -1.000000所以得到绝对偏差和最小时的0为-11.6,1为3.4。(3) 根据题意可以列出目标方程:使用Lingo软件进行计算并取最优解,编程如下:model:sets:quantity/1.50/: x,y;endsetsmin=max(qua
8、ntity:abs(B0+B1*x-y);data:y=2 10 4 22 16 10 18 26 34 17 28 14 20 24 28 26 34 34 46 26 36 60 80 20 26 54 32 40 32 40 50 42 56 76 84 36 46 68 32 48 52 56 64 66 54 70 92 93 120 85;x=4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 2
9、0 22 23 24 24 24 24 25;enddatafree(B0); free(B1);End得到结果如下:Linearization components added: Constraints: 301 Variables: 251 Integers: 100 Global optimal solution found. Objective value: 36.00000 Objective bound: 36.00000 Infeasibilities: 0.3552714E-14 Extended solver steps: 0 Total solver iterations:
10、 996 Variable Value Reduced Cost B0 -12.00000 0.000000 B1 4.000000 0.000000 X( 1) 4.000000 0.000000 X( 2) 4.000000 0.000000 X( 3) 7.000000 0.000000 X( 50) 25.00000 0.000000 Y( 1) 2.000000 0.000000 Y( 2) 10.00000 0.000000 Y( 3) 4.000000 0.000000 Y( 50) 85.00000 0.000000 Row Slack or Surplus Dual Pric
11、e1 36.00000 -1.000000所以得到绝对偏差和最小时的0为-12.00000,1为4.000000。根据y=0+1x,得到的三个解析方程式为:y=-17.57909+3.932409xy=-11.60000+3.400000xy=-12.00000+4.000000x利用Matlab求得所有数据的线性回归方程:Linear model Poly1: f(x) = p1*x + p2Coefficients (with 95% confidence bounds): p1 = 3.653 (2.877, 4.429) p2 = -15.36 (-27.99, -2.737)Good
12、ness of fit: SSE: 9803 R-square: 0.6987 Adjusted R-square: 0.6925 RMSE: 14.29分析结果,其R2约为0.6987,解析式为y=-15.36+3.653x利用Matlab做出所有图像并进行对比:由图像已经可以观察出深蓝色线与红色回归线最为贴近,计算得到其R2约为0.6742,所以由绝对偏差和最小得到的结果y=-11.60000+3.400000x更为贴近。2. 非线性优化问题解:(1)根据题意设x11、x12、x13为汽油加工所需要的A、B类原油与广告费的值,设x21、x22、x23为民用燃油所需要的A、B类原油与广告费的
13、值。则相应的目标函数为总利润:Max=250*x13/10*5+200*x23/10*10-x13-x23=124*x13+199*x23约束条件为:(10x11+5x12)/(x11+x12)8;(10x21+5x22)/(x21+x22)6;x11+x215000;x12+x2210000;5*x13/10x11+x12;10*x23/10x21+x22;使用Lingo软件进行计算并取最优解,编程如下:model:max=124*x13+199*x23;(10*x11+5*x12)/(x11+x12)=8;(10*x21+5*x22)/(x21+x22)=6;(10*x21+5*x22)/
14、(x21+x22)=8;x11+x21=5000; x12+x22=0.5*x13; x21+x22=x23;GIN(x11);GIN(x12);GIN(x13);GIN(x21);GIN(x22);GIN(x23);End得到结果如下: Local optimal solution found. Objective value: 3230000. Objective bound: 3230000. Infeasibilities: 0.000000 Extended solver steps: 1 Total solver iterations: 62 Variable Value X13
15、10000.00 X23 10000.00 X11 3000.000 X12 2000.000 X21 2000.000 X22 8000.000 Row Slack or Surplus 1 3230000. 2 0.000000 3 0.000000 4 2.000000 5 0.000000 6 0.000000 7 0.000000 8 0.000000分析结果易知最优的生产方案为汽油加工所需要的A、B类原油与广告费为3000桶、2000桶、10000元,民用燃油所需要的A、B类原油与广告费的值为2000桶、8000桶、10000元时,可以获得最大利润3230000元。(2)根据题目中
16、条件可设加入汽油中的SQ为x14桶,可设加入民用燃油中的SQ为x24桶,则可得新的目标函数为:Max=250*x13/10*5+200*x23/10*10-x13-x23-200x14-200x24;约束条件为:x11+x215000;x12+x2210000;(10*x11+5*x12)/(x11+x12+x14)+(x14/(x11+x12+x14)0.5=8;(10x21+5x22)/(x21+x22+x24)+0.6*(x24/(x21+x22+x24)0.6=6;x13/10*5x11+x12+x14;x23/10*10x21+x22+x24;x14(x11+x12)*5%;x24(
17、x21+x22)*5%;使用Lingo软件进行计算并取最优解,编程如下:model:max=124*x13+199*x23-200*x14-200*x24;(1+(x14/(x11+x12+x14)0.5)*(10*x11+5*x12)/(x11+x12)=8;(1+0.6*(x24/(x21+x22+x24)0.6)*(10*x21+5*x22)/(x21+x22)=6;x11+x21=5000;x12+x22=0.5*x13;x21+x22+x24=x23;0.05*x11+0.05*x12=x14;0.05*x21+0.05*x22=x24;GIN(x11); GIN(x12);GIN(
18、x13);GIN(x14);GIN(x21);GIN(x22);GIN(x23);GIN(x24);End得到结果如下:Local optimal solution found. Objective value: 3755903. Objective bound: 3755903. Infeasibilities: 0.000000 Extended solver steps: 4 Total solver iterations: 452 Variable Value X13 31496.00 X23 1.000000 X14 749.0000 X24 0.000000 X11 4999.00
19、0 X12 10000.00 X21 1.000000 X22 0.000000 Row Slack or Surplus 1 3755903. 2 0.1203040 3 4.000000 4 0.000000 5 0.000000 6 0.000000 7 0.000000 8 0.9500000 9 0.5000000E-01分析结果易知最优的生产方案为汽油加工所需要的A、B类原油、广告费及SQ化学添加剂为5000桶、10000桶、31496元、749桶时,停止生产民用燃油可以获得最大利润3755903元。(3)根据题意,约束条件中:x14+x24400;同理使用Lingo软件进行计算并
20、取最优解,编程如下:model:max=124*x13+199*x23-100*x14-100*x24;(1+(x14/(x11+x12+x14)0.5)*(10*x11+5*x12)/(x11+x12)=8;(1+0.6*(x24/(x21+x22+x24)0.6)*(10*x21+5*x22)/(x21+x22)=6;x14+x24400;x11+x21=5000;x12+x22=0.5*x13;x21+x22+x24=x23;0.05*x11+0.05*x12=x14;0.05*x21+0.05*x22=x24;GIN(x11);GIN(x12);GIN(x13);GIN(x14);GI
21、N(x21);GIN(x22);GIN(x23);GIN(x24);End得到结果如下:Local optimal solution found. Objective value: 3831000. Objective bound: 3831000. Infeasibilities: 0.4551556E-09 Extended solver steps: 0 Total solver iterations: 36 Variable Value X13 31500.00 X23 0.000000 X14 750.0000 X24 0.000000 X11 5000.000 X12 10000.
22、00 X21 0.000000 X22 0.000000 Row Slack or Surplus 1 3831000. 2 0.1214526 3 0.000000 4 350.0000 5 0.000000 6 0.000000 7 0.000000 8 0.000000 9 0.000000 10 0.000000分析结果易知最优的生产方案为汽油加工所需要的A、B类原油、广告费及SQ化学添加剂为5000桶、10000桶、31500元、750桶时,停止生产民用燃油可以获得最大利润3831000元。3. 库存问题I解:1)单位时间统一为天。已知R=100个/天,C1=0.02元/个.天,C3
23、=100元/次。, *=40(元/天)(3)已知 P=200个, *=40=28.3(元/天)4. 库存问题II解:根据题意,得需求率是D=30件/天,储存费Cp=0.05元/每件每天,订货费为CD=100元/次,采购费C1=10元,采购费C2=8元,分界点Q为600件,提前时间为21天。使用Lingo软件进行计算并取最优解,编程如下:model:D=30; C_P=0.05; C_D=100;C=if(Q #lt# 600, 10, 8);min=1/2*C_P*Q+C_D*D/Q+C*D;end得到结果如下: Linearization components added: Constrai
24、nts: 15 Variables: 8 Integers: 6 Local optimal solution found. Objective value: 260.0000 Objective bound: 260.0000 Infeasibilities: 0.000000 Extended solver steps: 0 Total solver iterations: 5 Variable Value Reduced Cost D 30.00000 0.000000 C_P 0.5000000E-01 0.000000 C_D 100.0000 0.000000 C 8.000000
25、 0.000000 Q 600.0000 0.000000 Row Slack or Surplus Dual Price 1 0.000000 -8.166667 2 0.000000 -300.0000 3 0.000000 -0.5000000E-01 4 0.000000 -30.00000 5 260.0000 -1.000000由此可以得到最优的订货量为600件,最优的储存费为260元/天。根据提前时间L=21天,再订货点为21D=2130件=630件,最优库存策略就是当储存量下降到630件时,订货600件,其最优库存总费为260元/天。5. 库存文件III解:根据题意,设C_P为
26、存储费;C_D为订货费,D为需求,Q为进货数所占面积小于等于24平方米ABC三种货品的的费用为1/2*C_P*Q+C_D*D/Q+C*D约束条件,取货数为整数使用Lingo软件进行计算并取最优解,编程如下:Model:sets: kinds/1.3/: C_P, D, C, W, Q, C_D, N;endsetsmin=sum(kinds: 0.5*C_P*Q+C_D*D/Q);sum(kinds: W*Q)=W_T;for(kinds: N=D/Q; gin(N);data: C_D = 10,5,15; D = 2, 3, 4; C_P = 0.3, 0.1, 0.2; W = 1.0,
27、 1.0, 1.0; W_T = 24;Enddataend得到结果如下:Local optimal solution found. Objective value: 30.85000 Objective bound: 30.85000 Infeasibilities: 0.2117548E-08 Extended solver steps: 2 Total solver iterations: 57 Variable Value Reduced Cost W_T 24.00000 0.000000 C_P( 1) 0.3000000 0.000000 C_P( 2) 0.1000000 0.
28、000000 C_P( 3) 0.2000000 0.000000 D( 1) 2.000000 0.000000 D( 2) 3.000000 0.000000 D( 3) 4.000000 0.000000 C( 1) 0.000000 0.000000 C( 2) 0.000000 0.000000 C( 3) 0.000000 0.000000 W( 1) 1.000000 0.000000 W( 2) 1.000000 0.000000 W( 3) 1.000000 0.000000 Q( 1) 2.000000 0.000000 Q( 2) 3.000000 0.000000 Q(
29、 3) 4.000000 0.000000 C_D( 1) 10.00000 0.000000 C_D( 2) 5.000000 0.000000 C_D( 3) 15.00000 0.000000 N( 1) 1.000000 9.699999 N( 2) 1.000000 4.850000 N( 3) 1.000000 14.60000 Row Slack or Surplus Dual Price 1 30.85000 -1.000000 2 15.00000 0.000000 3 -0.2117548E-08 9.699999 4 0.000000 4.850000 5 0.000000 14.60000由此易知A、B、C三种货物的最优订货量为3件、1件、2件,及最优存贮费用为30.85元。
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1