版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)專心-專注-專業(yè)精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)上海海事大學 2014 - 2015 學年第 二 學期研究生 優(yōu)化與統(tǒng)計建模試驗 課程考查模擬題專業(yè): 學生姓名: 學號: 要求:1.本考查為無紙化形式,要求每位研究生獨立完成,禁止和他人交流。2.請將本文件更名(原文件名學號姓名)。3.必須在本文件內(nèi)作答并緊隨相應試題后面,評閱老師只評閱本文件。4.所有問題僅限于采用本課程所學軟件: Lingo,Cplex,Spss,R進行求解. 其他方式求解將不被認可。5.作答主要內(nèi)容:Lingo,Cplex,R要求源代碼及關(guān)鍵的輸
2、出結(jié)果;Spss要求關(guān)鍵的輸出結(jié)果,一些重要的操作設置最好能加以說明。一. (共10分)線性規(guī)劃:已知線性規(guī)劃 Max z=x12x2x3 x1+x2 +2x3 12 x1+x2 x3 1 x1,x2 ,x30. 1.分別用Lingo和Cplex求解該問題;最優(yōu)解x=(0,0,0)目標函數(shù)值 02.求對偶問題; min z=12*y1+y2 y1+y2=-1; y1+y2=-2; 2*y1-y2=-1; y1,y2=0; 3.解對偶問題,試驗影子價格; y=(0,0)4.對目標函數(shù)系數(shù),約束右邊常量進行靈敏度分析。源代碼:Lingo代碼:model:sets:ii/1.3/:x,c;jj/1.
3、2/:b;link(jj,ii):a;endsetsdata:c=-1,-2,-1;b=12 1;a=1 1 2 1 1 -1;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;dva
4、r float+ xii;maximizesum(i in ii)ci*xi;subject to forall(j in jj) sum(i in ii) aji*xi= - 1; X_2 y_2 + y_3 = - 2; X_3 2 * y_2 - y_3 = - 1; END主要輸出結(jié)果LingoX( 1) 0. 1. X( 2) 0. 2. X( 3) 0. 1.Cplex最終解決方案 目標 = 0:x = 0 0 0;對偶問題輸出結(jié)果 Variable Value Reduced Cost Y_2 0. 12.00000 Y_3 0. 1.靈敏度分析Ranges in which t
5、he basis is unchanged: Objective Coefficient Ranges: Current Allowable 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. INF
6、INITY 1.二. (共15分)最短路: 已知線路網(wǎng)路如圖,兩點之間聯(lián)系上數(shù)字表示兩點間的距離。1. 求A1到A7所有最短路。共兩條: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
7、 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: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
8、);for(arcs(i,j):bin(x(i,j);end長度:92. 求A1到A6所有最短路。僅一條:146model: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
9、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: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(
10、i)+s(i-1)=d(i);s(1)=x(1)+10-d(1);for(time(i)|i#gt#1:s(i)=x(i)+s(i-1)-d(i);end主要輸出結(jié)果:X( 1) 40.00000 0. X( 2) 50.00000 0. X( 3) 75.00000 0. X( 4) 25.00000 0.四. (共10分)統(tǒng)計描述性分析:對data1描述性分析: 求均值,方差,標準差,變異系數(shù),偏度,峰度,常用分位數(shù),極差,四分位差,直方圖,箱式圖,經(jīng)驗分布圖,Q_Q圖源代碼: x=c( 0.28, 0.08,-0.97, 0.42, 1.22,-1.13, 0.37,-0.14, 0.2
11、,-0.51,-0.29, 0.10,-0.14, -0.10,-0.09,-0.32, 0.38,-0.55, 0.39, 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
12、.35,-0.48, 0.30, 0.02,-0.88, 0.56,-0.21, 0.06, 0.54,-1.07, 0.36, 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,-
13、0.11, 0.43,-0.12,-1.00, 0.51, 0.79,-1.34, 0.55, 1.44, -1.17,-0.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)
14、/mean(x)#變異系數(shù)#all.moments(x,central=TRUE, order.max=4)all.moments( 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)#經(jīng)驗分布圖#plot(ecdf(x),verticals=TRUE,do.p=T) #do
15、.p是邏輯變量=FALSE表示不畫點處的記號#x=seq(-2,2,0.01)#lines(x,pnorm(x,mean(x),sd(x),col=red)hist(x)#直方圖#boxplot(x)#箱式圖#boxplot(x,horizontal=T);qqnorm(x,pch=+,ylab=,main=)#q-q圖#qqline(x, col = 2)主要輸出結(jié)果: 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, orde
16、r.max=4 )1 1. 2. 4. 12. 32. all.moments( x, central=TRUE, order.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)
17、 plot(ecdf(x),verticals=TRUE,do.p=T) #do.p是邏輯變量=FALSE表示不畫點處的記號 #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中經(jīng)漂吟霉素處理數(shù)據(jù)用指數(shù)增長模型非線性回歸1. 寫出回歸表達式,獲得回歸的檢驗結(jié)論;y1=192.095(1-exp(-11.385x)2. 比較M
18、ichaelis-Menten回歸,哪一個效果好,為什么?用R語言兩者求解系數(shù)顯著度差距不大,回歸效果差不多。見后面回歸檢驗結(jié)果。(用SPSS比較R2值, Michaelis-Menten R2=0.96126, 而指數(shù)模型, 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
19、.11, 0.11, 0.22, 0.22, 0.56, 0.56, 1.10, 1.10);x=xx;y=y1;plot(x,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,作圖基礎上添加擬合值主要輸出結(jié)果回歸檢驗輸出:Michaelis-Menten模型代
20、碼:Formula: y SSmicmen(x, Vm, K)Parameters: Estimate Std. Error 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 Ac
21、hieved convergence tolerance: 1.93e-06指數(shù)模型代碼:Formula: y beta1 * (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 f
22、reedomNumber of iterations to convergence: 19 Achieved convergence tolerance: 4.533e-06指數(shù)回歸效果圖六. (共15分)主成分分析:對data7 進行主成分分析,1. 要求獲得載荷矩陣,主成分得分矩陣,碎石圖;2. 各主成分命名。各企業(yè)總效應大小的綜合指標y1y1=0.32113x1+0.29516x2+0.38912x3+0.38472x4+0.37955x5+0.37087x6+0.31996x7+0.35546x8Spss主要輸出結(jié)果Communalities InitialExtractionVAR0
23、00011.000.812VAR000021.000.907VAR000031.000.984VAR000041.000.989VAR000051.000.988VAR000061.000.988VAR000071.000.709VAR000081.000.801Extraction Method: Principal Component Analysis.Total Variance ExplainedComponentInitial EigenvaluesExtraction Sums of Squared Loadings Total% of VarianceCumulative %To
24、tal% of VarianceCumulative %16.13776.70876.7086.13776.70876.70821.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) Component 12VAR00001.796.424VAR000
25、02.731.610VAR00003.964-.235VAR00004.953-.285VAR00005.940-.323VAR00006.919-.379VAR00007.793.284VAR00008.881.160Extraction Method: Principal Component Analysis.a 2 components extracted.Component Score Coefficient Matrix Component 12VAR00001.130.407VAR00002.119.585VAR00003.157-.225VAR00004.155-.273VAR0
26、0005.153-.310VAR00006.150-.364VAR00007.129.272VAR00008.143.154Extraction Method: Principal Component Analysis.七. (共15分)時間序列分析:data2,3作時間序列分析(數(shù)據(jù)橫著讀)(要求用R語言)1. ARIMA模型的最佳參數(shù)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
27、, 146.6, 114.8, 122.3,389.1, 571.2, 647.6, 754.3, 1030.2, 733.8, 541.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.
28、7, 48.8,81.1, 173.7, 408, 540.4, 516.6, 569.6, 506.9,337.3, 120.6, 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.
29、1, 180, 480.7, 738, 1181.5,1491.8, 1150.4, 798.4, 774, 650.5, 468.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
30、.2,84.6, 427.5, 875.6, 1019.2, 936.1, 767.6, 501.4,314.9, 320.6, 145.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
31、, 432.7, 956.8, 1372.8, 1314.6,1065, 813.4, 569.7, 367.2, 195.9, 115.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)#起始時間和結(jié)束時間#acf(z)pacf(z)x - ari
32、ma(z,order=c(3,0,0)tsdiag(x)#3個圖的出現(xiàn)#fore.mod-predict(object =x, n.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)#
33、產(chǎn)生新序列已設置后面plot格式pred.mod=z-x$residuals#計算擬和值par(mfrow=c(1,1)plot(zt,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,
34、581.68, 581.17, 580.53, 580.01, 579.91, 579.14, 579.16, 579.55, 579.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, 5
35、77.79, 576.75, 576.75, 577.82, 578.64, 580.58, 579.48, 577.38, 576.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, 5
36、77.91, 576.89, 575.96, 576.8, 577.68, 578.38, 578.52, 579.74, 579.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任務無人做; 最小耗時數(shù)為:z=29+20+32+24=105 源代碼:model:sets:i0/1.9/;links(i0,i0):x,a,c;endsetsdata:a=0 0 0 0 1
37、 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;c=0 0 0 0 25 29 31 42 37 0 0 0 0 39 38 26 20 33 0 0 0 0 34 27 28 40 32 0 0 0 0 24 42 36 23 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;enddatamin=sum(links: x*c);for(i0(i)|i#le#4:sum(i0(j)|j#ge#5:x(i,j)=1); for(i0(i)|i#Ge#5#and#i#ne#9:sum(i0(j)|j#le#4:x(j,i)=1);sum(i0(j)|j#le#4:x(j,9)=1;x(1,5)=0;for(links:bin(x);end主要輸出結(jié)果:X( 1, 1) 0. 0. X( 1, 2) 0. 0. X( 1, 3) 0. 0. X( 1, 4) 0. 0. X(
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度藝術(shù)展覽項目策劃與媒體合作合同4篇
- 2025年度電子產(chǎn)品OEM代工與品牌合作合同4篇
- 二零二五年度苗木種植基地環(huán)境治理合同4篇
- 二零二五版2025年度智慧城市建設戰(zhàn)略合作協(xié)議2篇
- 二零二五年度文化旅游資源承包經(jīng)營合同書范文4篇
- 2025年度建筑石材精細打磨施工合同4篇
- 影視行業(yè)自律規(guī)范與監(jiān)督2025年度合同3篇
- 二零二五年度文化娛樂產(chǎn)業(yè)出資股東協(xié)議標準模板4篇
- 二零二五版生態(tài)養(yǎng)殖產(chǎn)業(yè)技術(shù)創(chuàng)新合作協(xié)議2篇
- 2024酒店委托經(jīng)營合同范本
- 骨科手術(shù)后患者營養(yǎng)情況及營養(yǎng)不良的原因分析,骨傷科論文
- GB/T 24474.1-2020乘運質(zhì)量測量第1部分:電梯
- GB/T 12684-2006工業(yè)硼化物分析方法
- 定崗定編定員實施方案(一)
- 高血壓患者用藥的注意事項講義課件
- 特種作業(yè)安全監(jiān)護人員培訓課件
- (完整)第15章-合成生物學ppt
- 太平洋戰(zhàn)爭課件
- 封條模板A4打印版
- T∕CGCC 7-2017 焙烤食品用糖漿
- 貨代操作流程及規(guī)范
評論
0/150
提交評論