文档详情

管理运筹实验报告.docx

发布:2017-12-11约6.29千字共10页下载文档
文本预览下载声明
实验五:用MATLAB求解线性规划2-10c=[-3,-1,-4]; a = [6,3,5;3,4,5]; b=[45,30]; [x,fval]=linprog(c,a,b);Exiting: One or more of the residuals, duality gap, or total relative errorhas grown 100000 times greater than its minimum value so far:the dual appears to be infeasible (and the primal unbounded). (The primal residual TolFun=1.00e-08.) xx = 1.0e+29 * -1.5497 -4.6492 4.64924-2 c=[-240,-1200,-700];A=[1,1,1;0.5,0.5,0.5]B=[30000;20000][x,fval]=linprog(c,A,B)A = 1.0000 1.0000 1.0000 0.5000 0.5000 0.5000B = 30000 20000Exiting: One or more of the residuals, duality gap, or total relative errorhas stalled:the dual appears to be infeasible (and the primal unbounded). (The primal residual TolFun=1.00e-08.)x = 1.0e+24 * -4.6326 4.6326 0.0000fval =-4.4473e+27实验六:非线性规划5-4 f=2*x(1)^2+2*x(2)^2-4*x(1)+2*x(1)*x(2)-4*x(1)-6*x(2);x0=[1,1];[x,f_min]=fminsearch(f,x0)x = 1.6667 0.6666f_min =-8.66675-10运用直接法编写程序:h=[2,1,0;1,4,0;0,0,0];f=[-6;-2;-12];a=[-1,2,0];b=[3];aeq=[1,1,1];beq=[2];[x,value]=quadprog(h,f,a,b,aeq,beq,zeros(3,1))结果即得:Warning: Trust-region-reflective algorithmdoes not solve this type of problem, usingactive-set algorithm. For more help, seeChoosing the Algorithm in the documentation. In quadprog at 371 Warning: Your current settings will run adifferent algorithm (interior-point-convex)in a future release. In quadprog at 375 Optimization terminated.x = 0 0 2value = -245-12.5-12 H=[2 0 0 0 ;0 1 0 0 ;0 0 0 0;0 0 0 0]; f=[0 0 0 0]; Aeq=[1 -1 1 0;-2 1 0 1]; beq=[2 1]; x0=[1;3;4;0]; lb=zeros(4,1); [x,fval,exitflag,output,lambda]=quadprog(H,f,[],[],Aeq,beq,lb,[],x0)The interior-point-convex algorithm does not accept an initial point.Ignoring X0.Minimum found that satisfies the constraints.Optimization completed because the objective function is non-decreasing in feasible directions, to within the default value of the function tolerance,and constraints are satisfied to within the default value
显示全部
相似文档