天天看點

基于企鵝優化算法的航空排程問題(Matlab代碼實作)

目錄

​​1 概述​​

​​2 企鵝優化算法​​

​​3 運作結果​​

​​4 Matlab代碼及文章講解​​

​​5 參考文獻 ​​

​​6 寫在最後​​

1 概述

針對艦載機航空作業排程問題的特性進行了分析,指出艦載機出動回收能力等影響水面艦船作戰能力的重要因素。通過闡述目前常用的機群保障流程,決定将其抽象為混合作業工廠中的房間排程問

題,并着重分析和研究了工廠中的房間排程的相關常用算法,如分支定界法、遺傳算法、模拟退火算法、群智能算法和啟發式算法等。在結合了實際的艦面排程作業之後,決定選擇群智能算法和構造型啟發式算法進行求解。然後,将航空作業排程問題中的各方面因素,按照工廠中的房間排程中的各個元素以及工廠中的房間環境進行抽象模組化,并且評估其排程任務的優先級順序和限制條件之後,建立了艦載機航空作業排程模型,并以此為據進行了算法設計。

2 企鵝優化算法

帝企鵝優化算法(emperor penguin optimizer,EPO)是Gaurav 等提出的一種新型群智能優化算法,其思想是模拟帝企鵝群體冬天擁擠在一起取暖的行為進行尋優。Baliarsingh 等進一步将EPO算法用于求解多目标優化問題。Kumar 等将EPO算法用于處理圖像分割問題。Jia等通過結合多項式變異、levy飛行及熱交換操作政策改進帝企鵝優化算法。

3 運作結果

基于企鵝優化算法的航空排程問題(Matlab代碼實作)
基于企鵝優化算法的航空排程問題(Matlab代碼實作)

 4 Matlab代碼及文章講解

function [fit,result]=aimFcn_1(x,option,data)
    x=reshape(x,data.num_flight,3);
    x(x<0.01)=0.01;
    T=min(data.flight(:,3));
    recording.node=zeros(data.num_flight,data.num_node);  %記錄每架飛機通過該節點的時間
    recording.flight=zeros(data.num_flight,20);     %記錄每一家航班的狀态   
    recording.route=cell(data.num_Route,1);        %記錄該航線最後一架 飛機的位置
    for i=1:data.num_Route
        recording.route{i}=cell(length(data.Route_type{i,2}),1);
    end
    recording.Section=zeros(1,option.num_Section);  %記錄扇區内飛機數量
    priority_flihgt=x(:,1);
    while 1
        %% 查找可排程飛機
        position=find(data.flight(:,3)<=T & recording.flight(:,8)==0);
        [~,position1]=sort(priority_flihgt(position));
        position=position(position1);
        for i=1:length(position)
            % 航班編号
            no_flight=position(i);
            % 航班類型
            type_flight=data.flight(no_flight,5);
            % 航班速度
            v_flight=(data.vehicle(type_flight,2)-data.vehicle(type_flight,3))*x(no_flight,2)+data.vehicle(type_flight,3);
            % 航線編号
            no_route=data.flight(no_flight,2);
            % 航班高度
            height_type=ceil(length(data.Route_type{no_route,2})*x(no_flight,3));
            height_flight=data.Route_type{no_route,2}(height_type);
            temp_route=data.Route_num{no_route}(3:end);
            temp_T0=T;
            biaoji=0;
            total_distance=0;
            % 檢查該航線運作飛機狀态
            if ~isempty(recording.route{no_route})
                if ~isempty(recording.route{no_route}{height_type})
                    if recording.route{no_route}{height_type}(1)<=option.gap_D
                        continue;
                    end
                end
            end
            % 計算每個節點的抵達時間
            temp_no=[];
            temp_time=[];
            for ii=1:length(temp_route)
                no_node=temp_route(ii);
                no_Section=data.Point(no_node,4);
                if ii==1
                    if temp_T0-max(recording.node(:,no_node))<option.min_gap(no_node)
                        biaoji=1;
                        break;
                    else
                       % recording.node(no_flight,no_node)=temp_T0;
                    end 
                else
                    no_node0=temp_route(ii-1);
                    temp_distance=norm(data.Point(no_node,:)-data.Point(no_node0,:),2);
                    total_distance=total_distance+temp_distance;
                    temp_T=temp_distance/v_flight;
                    temp_T0=temp_T0+temp_T;
                    if temp_T0-max(recording.node(:,no_node))<option.min_gap(no_node)
                        biaoji=1;
                        break;
                    else
                      %  recording.node(no_flight,no_node)=temp_T0;
                    end
                end
                temp_no=[temp_no,no_node];
                temp_time=[temp_time,temp_T0];
            end
            if no_Section~=0
                if recording.Section(no_Section)>option.total_flight(no_Section)
                    continue;
                end
            end
            if biaoji==1
                continue;
            end
            recording.node(no_flight,temp_no)=temp_time;
            % 記錄航班狀态
            recording.flight(no_flight,1)=type_flight; %航班類型
            recording.flight(no_flight,2)=v_flight;    %航班速度
            recording.flight(no_flight,3)=no_route;     %航班路線
            recording.flight(no_flight,4)=height_flight;%航班高度
            recording.flight(no_flight,5)=no_route;     %航班路線
            recording.flight(no_flight,6)=0;            %目前位置
            recording.flight(no_flight,7)=total_distance;%終點位置
            recording.flight(no_flight,8)=1;            %飛行狀态 1 完成狀态2
            recording.flight(no_flight,9)=T;            %進入時間
            recording.flight(no_flight,10)=data.flight(no_flight,3); %航班預定時間
            recording.flight(no_flight,11)=T+total_distance/v_flight; %離開航線時間
            recording.route{no_route}{height_type}(1)=0;
            recording.route{no_route}{height_type}(2)=no_flight;
        end
        %% 查找飛行狀态的飛機
        recording.Section=zeros(1,option.num_Section);  %記錄扇區内飛機數量
        position=find(recording.flight(:,8)==1);
        for i=1:length(position)
            % 航班編号
            no_flight=position(i);
            % 航班類型
            type_flight=data.flight(no_flight,5);
            % 航班速度
            v_flight=(data.vehicle(type_flight,2)-data.vehicle(type_flight,1))*x(no_flight,2)+data.vehicle(type_flight,1);
            % 航線編号
            no_route=data.flight(no_flight,2);
            % 航班高度
            height_type=ceil(length(data.Route_type{no_route,2})*x(no_flight,3));
            height_flight=data.Route_type{no_route,2}(height_type);
            temp_route=data.Route_num{no_route}(3:end);
            % 航班位置
            temp_distance0=recording.flight(no_flight,6)+v_flight*option.T_step;
            recording.flight(no_flight,6)=temp_distance0;
            total_distance=recording.flight(no_flight,7);%終點位置
            if temp_distance0>total_distance %飛機 完成飛行
                recording.flight(no_flight,8)=2;
                continue;
            end
            temp_D=0;
            node_flight=temp_route(1); 
            % 查找目前飛機所在節點位置
            for ii=2:length(temp_route)
                no_node=temp_route(ii);
                no_node0=temp_route(ii-1);
                temp_distance=norm(data.Point(no_node,2:3)-data.Point(no_node0,2:3),2);
                if temp_D+temp_distance>=temp_distance0
                    node_flight=temp_route(ii); 
                end
            end
            % 飛機所在扇區
            no_Section=data.Point(node_flight,4);
            if no_Section~=0
                recording.Section(no_Section)=recording.Section(no_Section)+1;
            end
            if recording.route{no_route}{height_type}(2)==no_flight
                recording.route{no_route}{height_type}(1)=temp_distance0;
            end
        end
        T=T+option.T_step;
        position=find(recording.flight(:,8)~=2);
        if isempty(position)
            break;
        end
    end
    %% 
    fit1=sum(recording.flight(:,9)-recording.flight(:,10));
    fit2=max(recording.flight(:,11));
    fit=sum(data.w.*[fit1,fit2]);
    if nargout>1
        result.recording=recording;
    end
end      

5 參考文獻 

6 寫在最後

繼續閱讀