运筹学实验报告_第1页
运筹学实验报告_第2页
运筹学实验报告_第3页
运筹学实验报告_第4页
运筹学实验报告_第5页
已阅读5页,还剩23页未读 继续免费阅读

下载本文档

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

文档简介

.运筹学实验报告专 业: 班 级: 姓 名: 学 号: 指导教师: 数学与应用数学专业2015-12-18实 验 目 录一、实验目的3二、实验要求3三、实验内容31、 线性规划32、 整数规划63、 非线性规划134、 动态规划145、 排队论19四、需用仪器设备26五、MATLAB优化工具箱使用方法简介26六、LINGO优化软件简介26七、实验总结27一、实验目的 1、 会利用适当的方法建立相关实际问题的数学模型;2、 会用数学规划思想及方法解决实际问题;3、 会用排队论思想及方法解决实际问题;4、 会用决策论思想及方法解决实际问题;5、 掌握MATLAB、LINGO等数学软件的应用;2、 实验要求1、 七人一组每人至少完成一项实验内容;2、 每组上交一份实验报告;3、 每人进行12分钟实验演示;4、 实验成绩比例: 出 勤:40% 课堂提问:20% 实验报告:30% 实验演示:10%。3、 实验内容1、 线性规划例运筹学74页14题 Min z=-2x1-x2 s.t. 2x1+5x260 x1+x218 3x1+x244 X210 X1,x20用matlab运行后得到以下结果:the program is with the linear programmingPlease input the constraints number of the linear programming m=6m = 6Please input the variant number of the linear programming n=2n = 2Please input cost array of the objective function c(n)_T=-2,-1c = -2 -1Please input the coefficient matrix of the constraints A(m,n)=2,5;1,1;3,1;0,1;-1,0;0,-1A = 2 5 1 1 3 1 0 1 -1 0 0 -1Please input the resource array of the program b(m)_T=60,18,44,10,0,0b = 60 18 44 10 0 0Optimization terminated.The optimization solution of the programming is:x = 13.0000 5.0000The optimization value of the programming is:opt_value = -31.0000LINDO程序在命令窗口键入以下内容:max -2x-ysubject to2x+5y=60x+y=183x+y=44y=10end按solve键在reports window出现:Global optimal solution found. Objective value: 0.000000 Total solver iterations: 0 Variable Value Reduced Cost X 0.000000 2.000000 Y 0.000000 1.000000 Row Slack or Surplus Dual Price 1 0.000000 1.000000 2 60.00000 0.000000 3 18.00000 0.000000 4 44.00000 0.000000 5 10.00000 0.0000002、 整数规划课本第二章79页1题 Max z=100x1+180x2+70x3 s.t. 40x1+50x2+60x310000 3 x1+6x2+ 2x3600 x1130 X280 x3200 x1 x2 x30程序运行及结果:biprogramtheprogramiswiththebinarylinearprogrammingPleaseinputtheconstraintsnumberoftheprogrammingm=5m=5Pleaseinputthevariantnumberoftheprogrammingn=5n=5Pleaseinputcostarrayoftheobjectivefunctionc(n)_T=100,180,70c=10018070PleaseinputthecoefficientmatrixoftheconstraintsA(m,n)=40,50,60;3,6,2;1,0,0;0,1,0;0,0,1A=405060362100010001Pleaseinputtheresourcearrayoftheprogramb(m)_T=10000;600;130;80;200b=1000060013080200Optimizationterminated.Theoptimizationsolutionoftheprogrammingis:x=000Theoptimizationvalueoftheprogrammingis:opt_value= 0程序名:intprogram b程序说明:%theprogrammiswiththeintegerlinearprogrammingusebranchandboundmethod!%这个程序是用分支定界法解决整数规划问题%pleaseinputtheparametersinthemainfunctioninthecommandwinows%请在命令窗口输入这个主要定义函数的参数functionx,f=ILp(c,A,b,vlb,vub,x0,neqcstr,pre)%minf=c*x,s.t.A*x=b,vlb=x=vub%f的最小值等于c的转置乘以x,A乘以x小于等于b,x大于等于vlb小于等于vub%thevectorsofxisrequiredasintegersaswhole%x是整个的整数需要%x0istheinitialization,isalsook%x0是初始值,也可以是。%neqcstristhenumberofequationalconstraints,when0canbedelete%neqcstr是平均约束条件的数目,当0能删除时%preistheconciserate%pre是简明率%xistheintegeroptimizationandfistheoptimalvalue%x是整数规划,f是最优值%ifnargin8,pre=0;%narginisthefactuallyinputvariantsnumber(这个参数是实际输入的变量个数)ifnargin7,neqcstr=0;ifnargin6,x0=;ifnargin5,vub=;ifnarginpre);mtemp=length(temp2);ifisempty(temp2)x_f_b=xtemp;ftemp;vlb;vub;whilej=mmi=1;whilei=mtemp%ifx_f_b(nvars+1,j)pre);ifisempty(templ2)xall=xall,xtemp;fall=fall,ftemp;fvub=min(fvub,fall);elseifftemp=fvubx_f_b=x_f_b,xtemp;ftemp;vlbl;vubl;endendend%ifx_f_b(nvars+1,j)pre);ifisempty(tempr2)xall=xall,xtemp;fall=fall,ftemp;fvub=min(fvub,fall);elseifftempmmbreakend%theendbecausethebreak(因为中断而结束)temp0=round(xint(:,j);temp1=floor(xint(:,j);temp2=find(abs(xint(:,j)-temp0)pre);mtemp=length(temp2);end%theendofwhile(结束当前)else%correspondthesecondif(符合第一个如果)x=xtemp;f=ftemp;end%theendofsecondif(第二个如果的结束)%5ifisempty(fall)fmin=min(fall);nmin=find(fall=fmin);x=xall(:,nmin);f=fmin;endelse%correspondthefirstif(符合第一个如果)x=nan*ones(1,nvars);end LINDO程序例99页第6题第二问在命令窗口键入以下内容:max -11x1-4x2st-x1+2x2=45x1+2x2=162x1-x2 In fminunc at 265Optimization terminated: relative infinity-norm of gradient less than options.TolFun.x = 1.0e-006 * 0.2541 -0.2029fval = 1.3173e-0134、 动态规划程序名: dynamic; dynfun1_1, dynfun1_2, dynfun1_3;例180页第一题程序说明:dynamic程序:% the programm is with the dynamic programming use the recurisive method for the last to first% this is the main function of the methodfunctionp_opt,fval,u=dynprog(x,DecisFun,ObjFun,TransFun)% the function is to solve the dynamic example in the textbook% x is the situation variant and its column number represent the stage situation% subfunction DecisFun(k,x) is to solve the decision variant of k stage variant x % subfunction ObjFun(k,x,u) is to stage index function% subfunction TransFun(k,x,u) is the stage transformation function,u is the corresponding decision variant% p_opt has four output,the first is the number of the stage,the second is the optimal road of decision% the third is the optimal stategies of the decision ,the forth is the index function group.% fval is a column vector,is to represent the optimal value correspend to the initial stage is x % k=length(x(1,:);f_opt=nan*ones(size(x);d_opt=f_opt;t_vubm=inf*ones(size(x);x_isnan=isnan(x);t_vub=inf;% to caculate the teminate valuestmp1=find(x_isnan(:,k);tmp2=length(tmp1);for i=1:tmp2 u=feval(DecisFun,k,x(i,k); tmp3=length(u);for j=1:tmp3 tmp=feval(ObjFun,k,x(tmp1(i),k),u(j);if tmp=t_vub f_opt(i,k)=tmp; d_opt(i,k)=u(j); t_vub=tmp;endendend% recurisivefor ii=k-1:-1:1 tmp10=find(x_isnan(:,ii); tmp20=length(tmp10);for i=1:tmp20 u=feval(DecisFun,ii,x(i,ii); tmp30=length(u);for j=1:tmp30 tmp00=feval(ObjFun,ii,x(tmp10(i),ii),u(j); tmp40=feval(TransFun,ii,x(tmp10(i),ii),u(j); tmp50=x(:,ii+1)-tmp40; tmp60=find(tmp50=0);if isempty(tmp60),if nargin5 tmp00=tmp00+f_opt(tmp60(1),ii+1);if tmp00x=nan*ones(3,5);x(1,1)=1;x(1:3,2)=(2:4);x(1:2,3)=5,6;x(1:3,4)=(7:9);x(1,5)=10; p,f=dynamic(x,dynfun2_1,dynfun2_2,dynfun2_3)得到以下结果:p = 1 1 3 2 2 3 5 1 3 5 7 2 4 7 10 3 5 10 10 0f = 8该结果表明 最短路线为1 3 5 7 10最短路程为85排队论程序:queue M/M/1/k系统 课本270页例8.2.5程序及结果如下:queuethe program is with queueing theoryPlease input the system pattern:M/M/1/inf=1,M/M/1/k=2,M/M/c/inf=3,M/M/c/m/m=4! Pattern=2Pt = 2(该数字表示选择M/M/1/k系统)Please input the average arrival number in unit time lapta=10lapta = 10Please input the average service number in unit time mu=30mu = 30Please input the parameter k=2k = 2输出结果如下:The service intensity(Untruth) of the system is:ru = 0.3333The average queue length is:L = 0.3846(平均队长)The average waiting length is:Lq = 0.0769(平均等待队长)The lost possibility is:p_k = 0.0769The average lost customer number in unit time is:lapta_L = 0.7692The truth average arrival customer number in unit time is:lapta_e = 9.2308The average delay time is:W = 0.0417(平均逗留时间)The average waiting time is:Wq = 0.0083(平均等待时间)The average service intensity(efficent and truth) of the system is:ru_e =0.3077若按照甲方案,则如下结果:the program is with queueing theoryPlease input the system pattern:M/M/1/inf=1,M/M/1/k=2,M/M/c/inf=3,M/M/c/m/m=4! Pattern=2Pt = 2Please input the average arrival number in unit time lapta=10lapta = 10Please input the average service number in unit time mu=30mu = 30Please input the parameter k=3k = 3输出结果如下:The service intensity(Untruth) of the system is:ru = 0.25The average queue length is:L = 0.3176The average waiting length is:Lq = 0.0706The lost possibility is:p_k = 0.0118The average lost customer number in unit time is:lapta_L = 0.1176The truth average arrival customer number in unit time is:lapta_e = 9.8824The average delay time is:W = 0.0321The average waiting time is:Wq = 0.0071The average service intensity(efficent and truth) of the system is:ru_e =0.2471the program is with queueing theoryPlease input the system pattern:M/M/1/inf=1,M/M/1/k=2,M/M/c/inf=3,M/M/c/m/m=4! Pattern=2Pt = 2Please input the average arrival number in unit time lapta=10lapta = 10Please input the average service number in unit time mu=40mu = 40Please input the parameter k=2k = 2输出结果如下:The service intensity(Untruth) of the system is:ru = 0.25The average queue length is:L = 0.2857The average waiting length is:Lq = 0.0476The lost possibility is:p_k = 0.0476The average lost customer number in unit time is:lapta_L = 0.4762The truth average arrival customer number in unit time is:lapta_e = 9.5238The average delay time is:W = 0.03The average waiting time is:Wq = 0.005The average service intensity(efficent and truth) of the system is:ru_e =0.2381the program is with queueing theoryPlease input the system pattern:M/M/1/inf=1,M/M/1/k=2,M/M/c/inf=3,M/M/c/m/m=4! Pattern=2Pt = 2Please input the average arrival number in unit time lapta=30lapta = 30Please input the average service number in unit time mu=30mu = 30Please input the parameter k=2k = 2输出结果如下:The service intensity(Untruth) of the system is:ru = 1The average queue length is:L = 1The average waiting length is:Lq = 0.3333The lost possibility is:p_k = 0.3333The average lost customer number in unit time is:lapta_L = 10The truth average arrival customer number in unit time is:lapta_e = 20The average delay time is:W = 0.05The average waiting time is:Wq = 0.0167The average service intensity(efficent and truth) of the system is:ru_e =0.6667四、需用仪器设备 PC i5、 windows XP、MATLABR2007a、LINGO115、 MATLAB优化工具箱使用方法简介MATLAB优化工具箱具有强大的科学计算能力,在工程设计领域 得到了广泛的应用.简要介绍了MATLAB优化工具箱,通过对MATtAB优化工具箱中fmincon函数的语法进行分析,提出了结构优化设计的通用求解 方法.首先,合理设置优化目标函数和约束条件.然后,使用MATLAB优化工具箱进行编程计算.结果显示,与其他方法相比,使用MATLAB优

温馨提示

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

评论

0/150

提交评论