A list,

1. Population initialization Set the initial evolution algebra t=0, press the following formula in the feasible solution space of the optimization problem, and randomly generate NP individuals X meeting the constraint conditions to form the initial population. The selection of NP is generally 5-10 times of dimension D.



2. Mutation operation Mutation operation is a key step in DE algorithm, which is also the main difference between DE algorithm and other evolutionary algorithms. The most basic variation component of DE algorithm is the difference vector of the parent generation. Each difference vector corresponds to the difference vector of two different individuals in the parent population. The difference vector is defined as follows:



Where r1, R2, R3 ∈{1, 2… ,NP} are randomly selected positive integers, and R1, R2 and R3 are different from the current target individual vector index I. Therefore, it can be seen that the population size of DE algorithm must be greater than 4; otherwise, mutation operation cannot be carried out. Vi(t+1) is the variant individual vector corresponding to the target individual vector Xi(t), Xr3(t) is called the basis vector, and F∈[0, 2] is a constant. It is one of the main control parameters of DE algorithm, known as the variation factor or scaling factor, to control the scaling range of the difference vector, that is, the size of the influence on the basis vector.



3. Crossover operation To further increase population diversity, DE algorithm cross-operates the target vector individual Xi(t) and its corresponding variant individual Vi(t+1) to generate test individuals, i.e., candidate individual Ui(t+1) of target individuals. In order to ensure the evolution of the target individual Xi(t), it is necessary to ensure that at least one dimension component of Ui(t+1) of the test individual is contributed by the mutant individual Vi(t+1), while the other dimension components are determined by the cross probability factor CR. Thus, for each one-dimensional component uij(t+1) in the test individual, press the formula.



Where xij(t) represents the JTH component of the target individual vector Xi(t) in the parent population, and Vij (t+1) represents the JTH component of the mutant individual Vi(t+1), where I =1… , NP, j = 1,… , D. Rand (j)∈[0,1] is a random number corresponding to the j-th component. CR∈[0,1] is another major control parameter of DE algorithm, which determines the proportion of Vi(t+1) in the generated Ui(t+1) of test individuals. K is the coefficient corresponding to the ith individual, which is generally an integer randomly selected from the sequence [1, 2… D] to ensure that at least one one-dimensional component of Ui(t+1) of candidate individual comes from Vi(t+1) of mutant individual.

4. Selection (Survival of the fittest)

Ii. Source code

CLC Clear All Close ALL % differential evolution algorithm F0=0.5; % is the variation rate Gm=1000; % Maximum number of iterations pd=10500; % Total system power demand Np=100; % population size CR=0.9; % hybridization parameter G=1; % initialize algebra DD=40; % The dimension of the problem ge=zeros(1,Np); % The optimal value X1= Zeros (Np,DD); % Optimal solution xmax=[114 114 120 190  97 140 300 300 300 300 375 375 500 500 500 500 500 500 550 550 550 550 550 550 550 550 150 150 150 97 190 190 190 200 200 200 110 110 110 550];
 
xmin=[36 36 60 80 47 68 110 135 135 130 94 94 125 125 125 125 220 220 242 242 254 254 254 254 254 254 10 10 10 47 60 60 60 90 90 90 25 25 25 242]; % feasible region %%%%%%%%%% initial solution A=xmax-xmin; B=repmat(A,Np,1);
 C=repmat(xmin,Np,1); X0=B.*rand(Np,DD)+C; X=X0; % generate initial population %%%%%%%%%% mutation operation X1new= Zeros (Np,DD); % X X1_new=zeros(Np,DD); X X1=zeros(Np,DD); % value=zeros(1,Np);
whileG<=Gm % start iteration /G=1,G=Tmax % find the minimum valuefor i=1:Np value(i)=f(X1(i,:)); end [fmin,nmin]=min(value); % returns the minimum value and corresponding sequence numberif G>1
    iffmin<min(ge) ge(G)=fmin; % X1(G,:)=X1(nmin,:); % optimal value corresponds to optimal solutionelse
         ge(G)=ge(G- 1); % X1(G,:)=X1(G- 1, :); % optimal value corresponds to optimal solutionend
    else
         ge(G)=fmin; % X1(G,:)=X1(nmin,:); % optimal value corresponds to optimal solution end G=G+1;
    X=X1;
end
figure
ii=linspace(1,Np,Np); plot(ge) [gmin,n]=min(ge); % the optimal value % bestvalue=gmin % bestsolution=X1(n,:) % is obtained by comparing each generationCopy the code

3. Operation results

Fourth, note

Version: 2014 a