【优化求解】基于matlab冠状病毒群体免疫优化算法(CHIO)【Matlab 138期】

一、简介

本文提出了一种新的基于自然启发的人本优化算法:冠状病毒群免疫优化算法(CHIO)。

In this paper, a new nature-inspired human-based optimization algorithm is proposed which is called coronavirus herd immunity optimizer (CHIO).

CHIO的灵感来源于群体免疫概念,作为应对冠状病毒大流行(COVID-19)的一种方法。

The inspiration of CHIO is originated from the herd immunity concept as a way to tackle coronavirus pandemic (COVID-19).

冠状病毒感染的传播速度取决于感染者如何与其他社会成员直接接触。

The speed of spreading coronavirus infection depends on how the infected individuals directly contact with other society members.

为了保护其他社会成员免受疾病的侵害,健康专家建议保持社会距离。

In order to protect other members of society from the disease, social distancing is suggested by health experts.

群体免疫是一种状态,当大多数人免疫时,人群达到这种状态,从而防止疾病传播。

Herd immunity is a state the population reaches when most of the population is immune which results in the prevention of disease transmission.

这些概念是根据优化理论建模的。

These concepts are modeled in terms of optimization concepts.

CHIO模仿了群体免疫策略和社会距离概念。

CHIO mimics the herd immunity strategy as well as the social distancing concepts.

群体免疫利用了三种类型的个体病例:易感、感染和免疫。

Three types of individual cases are utilized for herd immunity: susceptible, infected, and immuned.

这是为了确定如何用社会距离策略更新其基因产生的解决方案。

This is to determine how the newly generated solution updates its genes with social distancing strategies.

CHIO使用23个著名的基准函数进行评估。

CHIO is evaluated using 23 well-known benchmark functions.

首先,研究了CHIO对其参数的敏感性。

Initially, the sensitivity of CHIO to its parameters is studied.

在此基础上,对现有的七种方法进行了比较评价。

Thereafter, the comparative evaluation against seven state-of-the-art methods is conducted.

通过对比分析,证实了CHIO与其他成熟方法相比,能够产生非常有竞争力的结果。

The comparative analysis verifies that CHIO is able to yield very competitive results compared to those obtained by other well-established methods.

为了进一步验证,使用了从IEEE-CEC 2011中提取的三个实际工程优化问题。

For more validations, three real-world engineering optimization problems extracted from IEEE-CEC 2011 are used.

同样,CHIO被证明是有效的。

Again, CHIO is proved to be efficient.

总之,CHIO是一个非常强大的优化算法,可以用来解决跨各种优化领域的许多优化问题。

In conclusion, CHIO is a very powerful optimization algorithm that can be used to tackle many optimization problems across a wide variety of optimization domains.

二、源代码

%=======================================================================
%            Coronavirus herd immunity optimizer (CHIO)
 
% All rights reserved.       
%=======================================================================
 
 
clear all
close all
clc
 
PopSize=30; %/* The number of Solutions*/
 
MaxAge = 100;
 
C0 = 1; % number of solutions have corona virus
 
Max_iter=100000; %/*The number of cycles for foraging {a stopping criteria}*/
 
SpreadingRate = 0.05;   % Spreading rate parameter
 
runs = 1;%/*Algorithm can be run many times in order to see its robustness*/
 
ObjVal = zeros(1,PopSize);
 
Age = zeros(1,PopSize);
 
BestResults = zeros(runs,1); % saving the best solution at each run
 
for funNum=7:7  % fun#1 to fun#23
    if(funNum==1)
        Function_name='F1';
    elseif(funNum==2)
        Function_name='F2';
    elseif(funNum==3)
        Function_name='F3';
    elseif(funNum==4)
        Function_name='F4';
    elseif(funNum==5)
        Function_name='F5';
    elseif(funNum==6)
        Function_name='F6';
    elseif(funNum==7)
        Function_name='F7';
    elseif(funNum==8)
        Function_name='F8';
    elseif(funNum==9)
        Function_name='F9';
    elseif(funNum==10)
        Function_name='F10';
    elseif(funNum==11)
        Function_name='F11';
    elseif(funNum==12)
        Function_name='F12';
    elseif(funNum==13)
        Function_name='F13';
    elseif(funNum==14)
        Function_name='F14';
    elseif(funNum==15)
        Function_name='F15';
    elseif(funNum==16)
        Function_name='F16';
    elseif(funNum==17)
        Function_name='F17';
    elseif(funNum==18)
        Function_name='F18';
    elseif(funNum==19)
        Function_name='F19';
    elseif(funNum==20)
        Function_name='F20';
    elseif(funNum==21)
        Function_name='F21';
    elseif(funNum==22)
        Function_name='F22';
    elseif(funNum==23)
        Function_name='F23';
    end
 
    % Load details of the selected benchmark function
    [lb,ub,dim,fobj]=Get_Functions_details(Function_name);
 
    for run = 1:runs
        % Initializing arrays
        swarm=zeros(PopSize,dim);
        
        % Initialize the population/solutions
        swarm=initialization(PopSize,dim,ub,lb);
 
        for i=1:PopSize,
          ObjVal(i)=fobj(swarm(i,:));
        end
        
        Fitness=calculateFitness(ObjVal);
        
        
        %% update the status of the swarms (normal, confirmed) 
        %%the minmum C0 Immune rate will take 1 status which means 
        %%infected by corona 
 
        Status=zeros(1,PopSize);
        
        for i=1:C0,
            Status(fix(rand*(PopSize))+1)=1;  
        end
        
      %===================== loop ===================================
      tic
      
      itr=0;   % Loop counter
 
      while itr<Max_iter
          
          for i=1:PopSize,
           
              %evaluate new solution
              ObjValSol=fobj(NewSol);
              FitnessSol=calculateFitness(ObjValSol);
              
              % Update the curent solution  & Age of the current solution
              if (ObjVal(i)>ObjValSol) 
                swarm(i,:)=NewSol;
                Fitness(i)=FitnessSol;
                ObjVal(i)=ObjValSol;
              else
                  if(Status(i)==1)
                      Age(i) = Age(i) + 1;
                  end
              end            
                           
              % change the solution from normal to confirmed
              if ((Fitness(i) < mean(Fitness))&& Status(i)==0 && CountCornoa>0)
                  Status(i) = 1;
                  Age(i)=1;
              end
              
              % change the solution from confirmed to recovered
              if ((Fitness(i) >= mean(Fitness))&& Status(i)==1)
                  Status(i) = 2; 
                  Age(i)=0;
              end
              
              % killed the current soluion and regenerated from scratch
              if(Age(i)>=MaxAge)
                  NewSolConst = initialization(1,dim,ub,lb);
                  swarm(i,:) = NewSolConst(:);
                  Status(i) = 0;
              end
          end
                
          if(mod(itr,100)==0)
             display(['Fun#',num2str(funNum),' Run#', num2str(run), ', Itr ', num2str(itr), ' Results ', num2str(min(ObjVal))]);
          end
 
          itr=itr+1;    
      end
      
      toc;
    
      % Save the best results at each iteration
      BestResults(run)=min(ObjVal);
 
    end % run
  
    fprintf(1, '\n\n Done \n\n'); 
  
end

三、运行结果

【优化求解】基于matlab冠状病毒群体免疫优化算法(CHIO)【Matlab 138期】

四、备注

完整代码或者代写添加QQ912100926
往期回顾>>>>>>
【优化求解】粒子群算法之充电站最优布局【Matlab 061期】
【优化求解】遗传算法之多旅行商问题【Matlab 062期】
【优化求解】遗传和模拟退火之三维装箱问题【Matlab 063期】
【优化求解】遗传算法之求最短路径【Matlab 064期】
【优化求解】粒子群之优化灰狼算法【Matlab 065期】
【优化求解】多目标之灰狼优化算法MOGWO 【Matlab 066期】
【优化求解】遗传算法之求解优化车辆发车间隔【Matlab 067期】
【优化求解】磷虾群算法简介【Matlab 068期】
【优化求解】差分进化算法简介【Matlab 069期】
【优化求解】约束优化之惩罚函数法简介【Matlab 070期】
【优化求解】改进灰狼算法之求解重油热解模型【Matlab 072期】
【优化求解】蚁群算法之配电网故障定位【Matlab 073期】
【优化求解】遗传算法之求解岛屿物资补给优化问题【Matlab 137期】

上一篇:5、第一章PHP 基础教程——PHP if...else...elseif 语句


下一篇:Nancy之基于Nancy.Hosting.Aspnet的小Demo