上海海事大学-2015优化与统计建模试验模拟考查题(答案_第1页
上海海事大学-2015优化与统计建模试验模拟考查题(答案_第2页
上海海事大学-2015优化与统计建模试验模拟考查题(答案_第3页
上海海事大学-2015优化与统计建模试验模拟考查题(答案_第4页
上海海事大学-2015优化与统计建模试验模拟考查题(答案_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、上海海事大学 2014 - 2015 学年第 二 学期研究生 优化与统计建模试验 课程考查模拟题专业: 学生姓名: 学号: 要求:1.本考查为无纸化形式,要求每位研究生独立完成,禁止和他人交流。2.请将本文件更名(原文件名学号姓名)。3.必须在本文件内作答并紧随相应试题后面,评阅老师只评阅本文件。4.所有问题仅限于采用本课程所学软件: Lingo,Cplex,Spss,R进行求解. 其他方式求解将不被认可。5.作答主要内容:Lingo,Cplex,R要求源代码及关键的输出结果;Spss要求关键的输出结果,一些重要的操作设置最好能加以说明。一. (共10分)线性规划:已知线性规划 Max z=x

2、12x2x3 x1+x2 +2x3 12 x1+x2 x3 1 x1,x2 ,x30. 1.分别用Lingo和Cplex求解该问题;最优解x=(0,0,0)目标函数值 02.求对偶问题; min z=12*y1+y2 y1+y2=-1; y1+y2=-2; 2*y1-y2=-1; y1,y2=0; 3.解对偶问题,试验影子价格; y=(0,0)4.对目标函数系数,约束右边常量进行灵敏度分析。源代码:Lingo代码:model:sets:ii/1.3/:x,c;jj/1.2/:b;link(jj,ii):a;endsetsdata:c=-1,-2,-1;b=12 1;a=1 1 2 1 1 -1

3、;enddatamax=sum(ii(i):x(i)*c(i);for(jj(j):sum(ii(i):a(j,i)*x(i)=b(j);Cplex代码: /* * OPL 5.5 Model * Author: zh * Creation Date: 2015/5/19 at 10:00 */range ii=1.3;range jj=1.2;float cii=-1,-2,-1;float bjj=12,1;float ajjii=1,1,2, 1,1,-1;dvar float+ xii;maximizesum(i in ii)ci*xi;subject to forall(j in j

4、j) sum(i in ii) aji*xi= - 1; X_2 y_2 + y_3 = - 2; X_3 2 * y_2 - y_3 = - 1; END主要输出结果LingoX( 1) 0. 1. X( 2) 0. 2. X( 3) 0. 1.Cplex最终解决方案 目标 = 0:x = 0 0 0;对偶问题输出结果 Variable Value Reduced Cost Y_2 0. 12.00000 Y_3 0. 1.灵敏度分析Ranges in which the basis is unchanged: Objective Coefficient Ranges: Current Al

5、lowable Allowable Variable Coefficient Increase Decrease X( 1) -1. 1. INFINITY X( 2) -2. 2. INFINITY X( 3) -1. 1. INFINITY Righthand Side Ranges: Current Allowable Allowable Row RHS Increase Decrease 2 12.00000 INFINITY 12.00000 3 1. INFINITY 1.二. (共15分)最短路: 已知线路网路如图,两点之间联系上数字表示两点间的距离。1. 求A1到A7所有最短路

6、。共两条:1257 1457model:sets:node/1.7/;arcs(node,node):d,x,u;!d:distance,x:0,1,u:exist or not;endsetsdata:d=0 6 2 3 0 0 0 0 0 0 3 1 0 0 0 0 0 0 0 4 0 0 0 0 0 4 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1;u=0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0

7、1;enddatamin=sum(arcs:d*x);!省略(i,j)!condition1: 进口路径和出口路径是唯一的;sum(node(i):x(1,i)=1;sum(node(i):x(i,7)=1;!condition2:进出口相同;for(node(j)|j#ne#1#and#j#ne#7:sum(node(i):x(j,i)=sum(node(i):x(i,j);!condition3:不可用路径不显示;for(arcs(i,j):x(i,j)=u(i,j);for(arcs(i,j):bin(x(i,j);end长度:92. 求A1到A6所有最短路。仅一条:146model:s

8、ets:node/1.7/;arcs(node,node):d,x,u;!d:distance,x:0,1,u:exist or not;endsetsdata:d=0 6 2 3 0 0 0 0 0 0 3 1 0 0 0 0 0 0 0 4 0 0 0 0 0 4 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1;u=0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1;enddatamin=sum(arcs

9、:d*x);!省略(i,j)!condition1: 进口路径和出口路径是唯一的;sum(node(i):x(1,i)=1;sum(node(i):x(i,6)=1;!condition2:进出口相同;for(node(j)|j#ne#1#and#j#ne#6:sum(node(i):x(j,i)=sum(node(i):x(i,j);!condition3:不可用路径不显示;for(arcs(i,j):x(i,j)=d(1);for(time(i)|i#Gt#1:x(i)+s(i-1)=d(i);s(1)=x(1)+10-d(1);for(time(i)|i#gt#1:s(i)=x(i)+s

10、(i-1)-d(i);end主要输出结果:X( 1) 40.00000 0. X( 2) 50.00000 0. X( 3) 75.00000 0. X( 4) 25.00000 0.四. (共10分)统计描述性分析:对data1描述性分析: 求均值,方差,标准差,变异系数,偏度,峰度,常用分位数,极差,四分位差,直方图,箱式图,经验分布图,Q_Q图源代码: x=c( 0.28, 0.08,-0.97, 0.42, 1.22,-1.13, 0.37,-0.14, 0.2,-0.51,-0.29, 0.10,-0.14, -0.10,-0.09,-0.32, 0.38,-0.55, 0.39,

11、0.18,-1.00, 0.90, 0.47,-1.48, 1.13, 1.20, -1.08,-0.54, 1.63, 0.46,-1.53, 1.09, 1.26,-1.04,-0.17, 0.91, 0.16,-1.11, 0.25, 0.89,-0.46,-0.44, 0.77, 0.14,-0.87,-0.34, 0.50, 0.37,-1.19, 0.74, 0.17,-0.48, -0.16, 0.32,-0.65,-0.03,-0.20, 0.21,-0.35,-0.48, 0.30, 0.02,-0.88, 0.56,-0.21, 0.06, 0.54,-1.07, 0.36

12、, 0.90,-0.83, 0.12, 1.19,-0.42,-0.50, 0.08, 0.19,-0.89, 0.57, 0.31,-0.66, 0.39, 0.06,-0.90, 0.09, 0.39,-0.44,-0.12, 0.12,-0.56, 0.55, 0.15,-0.97, 0.88, 0.77,-1.89, 1.32, 0.95,-1.04, 0.44,-0.17, 0.01, 0.46,-0.48, -0.10,-0.21, 0.41,-0.73,-0.11, 0.43,-0.12,-1.00, 0.51, 0.79,-1.34, 0.55, 1.44, -1.17,-0.

13、17, 0.52, 0.23,-1.06, 0.35, 0.75,-0.64,-0.46, 0.69,-0.37, 0.08, 0.79, -0.82, 0.00, 0.09,-0.65, 0.12, 0.40,-1.17, 0.51, 0.57,-1.08, 0.33, 0.87,-0.59, -0.29, 1.22,-0.38,-0.51, 0.48, 0.21,-1.16, 0.85)mean(x)#均值#var(x)#方差#sd(x)#标准差#100*sd(x)/mean(x)#变异系数#all.moments(x,central=TRUE, order.max=4)all.momen

14、ts( x, order.max=4 )all.moments( x, absolute=TRUE, order.max=4 )skewness(x)#偏度#kurtosis(x)#峰度#max(x)-min(x)#极差#quantile(x, probs = c(0.1, 0.5, 1, 2.5, 5,0.75, 10, 50, NA)/100,type=1)y=ecdf(x)#经验分布图#plot(ecdf(x),verticals=TRUE,do.p=T) #do.p是逻辑变量=FALSE表示不画点处的记号#x=seq(-2,2,0.01)#lines(x,pnorm(x,mean(x)

15、,sd(x),col=red)hist(x)#直方图#boxplot(x)#箱式图#boxplot(x,horizontal=T);qqnorm(x,pch=+,ylab=,main=)#q-q图#qqline(x, col = 2)主要输出结果: mean(x)1 -0. var(x)1 0. x=c(1,2,3) all.moments(x,central=TRUE, order.max=4)1 1. 0. 0. 0. 0. all.moments( x, order.max=4 )1 1. 2. 4. 12. 32. all.moments( x, central=TRUE, order

16、.max=4 )1 1. 0. 0. 0. 0. all.moments( x, absolute=TRUE, order.max=4 )1 1. 2. 4. 12. 32. skewness(x)1 0 kurtosis(x)1 1.5 quantile(x, probs = c(0.1, 0.5, 1, 2, 5, 10, 50, NA)/100,type=1)0.1% 0.5% 1% 2% 5% 10% 50% 1 1 1 1 1 1 2 NA y=ecdf(x) plot(ecdf(x),verticals=TRUE,do.p=T) #do.p是逻辑变量=FALSE表示不画点处的记号

17、#x=seq(-2,2,0.01) #lines(x,pnorm(x,mean(x),sd(x),col=red) #boxplot(x) #boxplot(x,horizontal=T); qqnorm(x,pch=+,ylab=,main=) qqline(x, col = 2)五. (共10分)回归分析:对data6中经漂吟霉素处理数据用指数增长模型非线性回归1. 写出回归表达式,获得回归的检验结论;y1=192.095(1-exp(-11.385x)2. 比较Michaelis-Menten回归,哪一个效果好,为什么?用R语言两者求解系数显著度差距不大,回归效果差不多。见后面回归检验结

18、果。(用SPSS比较R2值, Michaelis-Menten R2=0.96126, 而指数模型, R2=0.90144, 因而前者回归效果好)3. 画出回归效果图像。源代码x=c(0.02 , 0.06, 0.11, 0.22, 0.56, 1.10);#底物浓度#y1=c(76, 47, 97, 107, 123, 139, 159, 152, 191, 201, 207, 200);#反应速度处理#xx=c(0.02 , 0.02 , 0.06, 0.06, 0.11, 0.11, 0.22, 0.22, 0.56, 0.56, 1.10, 1.10);x=xx;y=y1;plot(x

19、,y,pch=8); z=nls(ySSmicmen(x,Vm,K);#Michaelis-Menten模型summary(z);z=nls(ybeta1*(1-exp(-beta2*x),start=list(beta1 = 195, beta2=0.4);#混合反应模型summary(z);points(x,fitted(z),pch=e,col=red);#在前面最后一个plot,作图基础上添加拟合值主要输出结果回归检验输出:Michaelis-Menten模型代码:Formula: y SSmicmen(x, Vm, K)Parameters: Estimate Std. Error

20、t value Pr(|t|) Vm 2.127e+02 6.947e+00 30.615 3.24e-11 *K 6.412e-02 8.281e-03 7.743 1.57e-05 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 10.93 on 10 degrees of freedomNumber of iterations to convergence: 0 Achieved convergence tolerance: 1.93e-06指数模型代码:Formula: y beta1 *

21、 (1 - exp(-beta2 * x)Parameters: Estimate Std. Error t value Pr(|t|) beta1 192.095 8.176 23.495 4.42e-10 *beta2 11.385 1.628 6.992 3.75e-05 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 17.44 on 10 degrees of freedomNumber of iterations to convergence: 19 Achieved converge

22、nce tolerance: 4.533e-06指数回归效果图六. (共15分)主成分分析:对data7 进行主成分分析,1. 要求获得载荷矩阵,主成分得分矩阵,碎石图;2. 各主成分命名。各企业总效应大小的综合指标y1y1=0.32113x1+0.29516x2+0.38912x3+0.38472x4+0.37955x5+0.37087x6+0.31996x7+0.35546x8Spss主要输出结果Communalities InitialExtractionVAR000011.000.812VAR000021.000.907VAR000031.000.984VAR000041.000.98

23、9VAR000051.000.988VAR000061.000.988VAR000071.000.709VAR000081.000.801Extraction Method: Principal Component Analysis.Total Variance ExplainedComponentInitial EigenvaluesExtraction Sums of Squared LoadingsTotal% of VarianceCumulative %Total% of VarianceCumulative %16.13776.70876.7086.13776.70876.7082

24、1.04213.02789.7341.04213.02789.7343.4365.44995.184 4.2202.75597.938 5.1521.89999.837 6.009.11099.948 7.003.03799.985 8.001.015100.000 Extraction Method: Principal Component Analysis.Component Matrix(a) Component12VAR00001.796.424VAR00002.731.610VAR00003.964-.235VAR00004.953-.285VAR00005.940-.323VAR0

25、0006.919-.379VAR00007.793.284VAR00008.881.160Extraction Method: Principal Component Analysis.a 2 components extracted.Component Score Coefficient Matrix Component12VAR00001.130.407VAR00002.119.585VAR00003.157-.225VAR00004.155-.273VAR00005.153-.310VAR00006.150-.364VAR00007.129.272VAR00008.143.154Extr

26、action Method: Principal Component Analysis.七. (共15分)时间序列分析:data2,3作时间序列分析(数据横着读)(要求用R语言)1. ARIMA模型的最佳参数data2 AR(3) data3 AR(2)2. 模型的检验3. 往后预测至少六期4. 画图源代码: data2代码:par(mfrow=c(1,1)#library(tseries)#无效命令x0=c(1000.7, 571.9, 573.6, 368.3, 146.6, 114.8, 122.3,389.1, 571.2, 647.6, 754.3, 1030.2, 733.8, 5

27、41.4,436.2, 250.9, 136.9, 453.9, 838.1, 1273.1, 1209.6,979, 797.9, 417.3, 367.4, 84.1, 237.8, 1110,1852.4, 1511.1, 1017.6, 817.1, 461.5, 273.6, 122,289.2, 994.4, 1584.3, 1570.9, 1417.3, 1078.7, 799,720.5, 562.8, 492, 255.2, 192.2, 76.7, 48.8,81.1, 173.7, 408, 540.4, 516.6, 569.6, 506.9,337.3, 120.6,

28、 97.7, 30.4, 0, 17, 59.4,146.3, 167.2, 424.8, 549.7, 492.7, 360.7, 287.3,188.1, 79.1, 48, 21.5, 102.5, 198.8, 435.3,596.5, 769.8, 804.3, 851.8, 573.7, 330.3, 102.3,158.9, 682.3, 1457.4, 1659.3, 1237.8, 1029.8, 758.3,441.6, 290.3, 128.1, 180, 480.7, 738, 1181.5,1491.8, 1150.4, 798.4, 774, 650.5, 468.

29、3, 246.8,80.5, 51.6, 273.3, 657.7, 1126, 1148.3, 926,709.3, 528.2, 563.4, 365.7, 195.5, 87.1, 447.5,886.8, 1669.3, 1334.4, 1220, 795.5, 535.8, 204.9,135.8, 147.3, 40.5, 71.5, 387.2, 651, 715.8,764.4, 761.4, 625.9, 304.5, 156.6, 81, 75.2,84.6, 427.5, 875.6, 1019.2, 936.1, 767.6, 501.4,314.9, 320.6, 1

30、45.3, 113.5, 32.9, 60.3, 292.6,503.4, 761.6, 646.3, 744.4, 582.5, 526.6, 223,68.4, 43.1, 17.3, 115.1, 568.4, 684.8, 1246.7,966.9, 763.3, 451.7, 313.6, 170.9, 69.3, 200.6,531.7, 766.7, 828.5, 933.5, 779.6, 428, 254.7,133.7, 67.9, 104.6, 432.7, 956.8, 1372.8, 1314.6,1065, 813.4, 569.7, 367.2, 195.9, 1

31、15.1, 397.1,1110.1, 1798.1, 1634.4, 1621.4, 1007.1, 837.1, 376.9,166.2, 52.9, 455.4, 1700.5, 2278.2, 2215.1, 1905,1347.3, 646.8, 451.2, 334.7, 122.4, 180.7)x0z=ts(x0,frequency=1,start=c(1742),end=c(1957)#起始时间和结束时间#acf(z)pacf(z)x - arima(z,order=c(3,0,0)tsdiag(x)#3个图的出现#fore.mod-predict(object =x, n.

32、ahead = 12, se.fit = TRUE) fore.modforevalue=c( 275.1532, 324.2066 ,456.2553, 562.3887, 644.3462 ,663.5609, 639.0554, 581.7076 ,521.1731, 474.8483 ,455.7449, 462.8644)x00=c(x0,forevalue)zt=ts(x00,frequency=1,start=c(1742),end=c(1969)#产生新序列已设置后面plot格式pred.mod=z-x$residuals#计算拟和值par(mfrow=c(1,1)plot(z

33、t,col=green,lwd=2,xlab=,ylab=)#实值与预测值lines(pred.mod,col=green,lwd=2)#拟和值lines(z,col=red,lwd=2)#实值data3代码:par(mfrow=c(1,1)#library(tseries)#无效命令x0=c(580.38, 581.86, 580.97, 580.8, 579.79, 580.39, 580.42, 580.82, 581.4, 581.32, 581.44, 581.68, 581.17, 580.53, 580.01, 579.91, 579.14, 579.16, 579.55, 57

34、9.67, 578.44, 578.24, 579.1, 579.09, 579.35, 578.82, 579.32, 579.01, 579, 579.8, 579.83, 579.72, 579.89, 580.01, 579.37, 578.69, 578.19, 578.67, 579.55, 578.92, 578.09, 579.37, 580.13, 580.14, 579.51, 579.24, 578.66, 578.86, 578.05, 577.79, 576.75, 576.75, 577.82, 578.64, 580.58, 579.48, 577.38, 576

35、.9, 576.94, 576.24, 576.84, 576.85, 576.9, 577.79, 578.18, 577.51, 577.23, 578.42, 579.61, 579.05, 579.26, 579.22, 579.38, 579.1, 577.95, 578.12, 579.75, 580.85, 580.41, 579.96, 579.61, 578.76, 578.18, 577.21, 577.13, 579.1, 578.25, 577.91, 576.89, 575.96, 576.8, 577.68, 578.38, 578.52, 579.74, 579.

36、31, 579.89, 579.96)x0z=ts(x0,frequency=1,start=c(1875),end=c(1972)acf(z)pacf(z)x - arima(z,order=c(2,0,0)tsdiag(x)fore.modB;乙-D;丙-E;丁-A;C任务无人做; 最小耗时数为:z=29+20+32+24=105 源代码:model:sets:i0/1.9/;links(i0,i0):x,a,c;endsetsdata:a=0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论