Difference Evolution algorithm __ Difference algorithm

Source: Internet
Author: User
Tags cos

Differential Evolution (differential evolution,de) is an evolutionary algorithm based on group difference, which is proposed by Rainer Storn and Kenneth Price in 1996 to solve Chebyshev polynomial. The differential evolution algorithm is superior in the first IEEE Evolution calculation competition, and has been widely used in various fields. The basic idea of the difference algorithm is to reorganize the intermediate population by applying the difference of the current population, and then to use the offspring to compete with the parent to obtain the new generation of population.

The most novel feature of the differential evolution algorithm is its mutation operation. When an individual is selected, the algorithm completes the mutation by adding two individual weighted differences to the individual. In the initial stage of the algorithm, the individual difference in the population is large, so the mutation operation will make the algorithm have a strong global search capability; By the end of the iteration, when convergence is convergent, the individual difference in the population is small, which makes the algorithm have strong local search ability. The main advantages of this novel mutation operation are: fewer parameters to be determined, less likely to fall into local optimum, and faster convergence.

The main steps of the differential evolution algorithm include:

(1) Group initialization
(2) Mutation operation
(3) Cross operation
(4) Select operation

The process of the difference algorithm is as follows:


An example is provided:

The minimum value of the function f (x,y) =3cos (XY) +x+y, where x is a range of [ -4,4], and Y has a value range of [ -4,4] (functions with multiple local extremum)

First in the MATLAB to draw the function of the image, as follows:

X=[-4:0.1:4];
y=x;
[X,y]=meshgrid (x,y);
[Row,col]=size (X);
For L=1:col for
    H=1:row
        z (h,l) =3*cos (X (h,l) *y (h,l)) +x (h,l) +y (h,l);
    End
-end Surf (x,y,z);
Shading Interp
The drawing is as follows:


Matlab realizes the difference Evolution algorithm:

The first step: Define the Fitness function

  function Value=func2 (x)  
  Value=3*cos (x (1) *x (2)) +x (1) +x (2);  
  End  

The second step: Matlab main function program

% initialization parameter set clear all;
Close all;
CLC     np=20;       % population quantity d=2;     The dimension of the% variable is g=100;     % max Evolutionary algebra f=0.5;    % mutation operator cr=0.1;      % crossover operator xs=4;     % Upper xx=-4;       % Lower X=zeros (D,NP);       % initial population v=zeros (D,NP);       % variant population U=zeros (D,NP);  % Select population X=rand (D,NP) * (XS-XX) +xx;
% assigns the initial value to calculate the fitness function value for M=1:NP Ob (m) =func2 (x (:, m));
End Trace (1) =min (OB);
        The% difference operation for gen=1:g% mutation operation%R1,R2,R3 and M are different for M=1:NP R1=randi ([1,np],1,1);
        while (r1==m) R1=randi ([1,np],1,1);
         End R2=randi ([1,np],1,1); while (r2==m) |
         (R2==R1) R2=randi ([1,np],1,1);
         End R3=randi ([1,np],1,1); while ((r3==m) | ( R3==R1) |
          (R3==R2))
         R3=randi ([1,np],1,1);
     End V (:, M) =x (:, R1) +f* (x (:, R2)-X (:, R3));
     End% Cross Operation R=randi ([1,np],1,1);
         For N=1:d Cr=rand (1); if (CR<CR) |
         (n==r) u (n,:) =v (n,:);
         else u (n,:) =x (n,:); End end% boundary condition processing% boundary absorption
     For n=1:d for M=1:NP if U (n,m) <xx u (n,m) =xx;
           End If U (n,m) >xs u (n,m) =xs;
     End-end-end% select operation for M=1:NP Ob1 (m) =func2 (U (:, m));
        End for M=1:NP if OB1 (m) <ob (m)% is less than the previous target value x (:, M) =u (:, M);
    End end for M=1:np Ob (m) =func2 (x (:, m));
End Trace (gen+1) =min (Ob);
    End [Sortob,index]=sort (OB);
    X=x (:, Index);          X=x (:, 1);         % optimal variable y=min (OB);
   % optimal value disp (' optimal variable ');
   Disp (X);
   Disp (' optimal value ');
  Disp (Y);
  % drawing Figure plot (trace);
  %plot (x,y, '-ro ');
  Xlabel (' iterative times ');
  Ylabel (' objective function value ');
   Title (' De objective function curve ');

Run Result:



Optimal variable
-4.0000
-3.9467

Optimal value
-10.9374


Reference articles:

http://blog.csdn.net/zuochao_2013/article/details/71514058

http://blog.csdn.net/u010480899/article/details/73795669

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.