资源描述:
《飞行管理问题的优化模型.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、MATLAB:%约束条件函数function[c,ceq]=aircon(delta)x0=[150,85,150,145,130,0];y0=[140,85,155,50,150,0];alpha0=[243,236,220.5,159,230,52];%第一组数据;%x0=[60,70,80,50,40,0];%y0=[100,100,100,100,100,40];%alpha0=[270,270,270,270,270,0];%第二组数据;%x0=[60,60,60,60,60,0];%y0=[80,7
2、0,60,90,100,60];%alpha0=[180,180,180,180,180,0];%第三组数据;%x0=[0,55,90,40,80,0];%y0=[70,5,60,130,5,60];%alpha0=[0,90,180,270,180,0];alpha0=alpha0*pi/180;v=800;co=cos(alpha0+delta);si=sin(alpha0+delta);fori=2:6forj=1:i-1b(i,j)=(x0(i)-x0(j))*(co(i)-co(j))+(y0(i)-
3、y0(j))*(si(i)-si(j));a(i,j)=v*((co(i)-co(j))^2+(si(i)-si(j))^2);t(i,j)=-b(i,j)/a(i,j);ift(i,j)<0d(i,j)=1000;elsed(i,j)=(x0(i)-x0(j)+v*t(i,j)*(co(i)-co(j)))^2+(y0(i)-y0(j)+v*t(i,j)*(si(i)-si(j)))^2;endendendc=64-[d(2,1),d(3,1:2),d(4,1:3),d(5,1:4),d(6,1:5)];ce
4、q=[];/***************分割符****************************/%目标函数functionf=airfun(delta)f=delta*delta';%f=sum(abs(delta));/***************分割符****************************/%计算程序clear;clclb=-pi/18*ones(1,6);ub=pi/18*ones(1,6);options=optimset('LargeScale','off');n=20;
5、fval=100;fori=1:ndelta0=10*(rand(1,6)-0.5);[dt,feval]=fmincon(@airfun,delta0,[],[],[],[],lb,ub,@aircon,options);if(feval6、lled');fori=1:6text(x(i)+2,y(i),num2str(i));endc=[542163];axis([-10,195,-10,170]);gridon;holdon;plot([0,160,160,0,0],[0,0,160,160,0],'b');zt=[270,270,270,270,270,0];%zt=[270,270,270,270,270,0]+[6.045.565.08-6.15-5.674.78];%zt=[270,270,270,270,270,0]+[-7.7172
7、5.54350.3477-1.04486.0843-3.4276];zt1=zt*pi/180;vt=1;dx=vt*cos(zt1);dy=vt*sin(zt1);forvt=1:160x1=x+dx;y1=y+dy;scatter(x1,y1,11,c,'filled');forj=1:5fork=2:6ifk~=jtx=x1(j)-x1(k);ty=y1(j)-y1(k);dl=sqrt(tx^2+ty^2);ifdl<=8fprintf('i=%dj=%dvt=%d',j,k,vt);endende
8、ndendx=x1;y=y1;pause(0.1);endx=[60,60,60,60,60,0];y=[80,70,60,90,100,60];scatter(x,y,30,'r','filled');fori=1:6text(x(i)+2,y(i),num2str(i));endc=[542163];axis([-10,195,-10,170]);gridon;holdon;plo