I. Structural model of artificial fish

Artificial fish is an abstract and virtual entity of real fish, which encapsulates its own data and a series of behaviors. It can accept the stimulus information of the environment and make corresponding activities. Its environment is determined by the solution space of the problem and the state of other artificial fish. Its behavior at the next moment depends on its own state and the state of the environment, and it also affects the environment through its own activities, and then affects the activities of other artificial fish.

 

Second, the optimization principle of artificial fish swarm algorithm

In the process of optimization, the artificial fish swarm algorithm may gather around several local optimal solutions to make the artificial fish jump out of the local optimal solution. The main factors to realize global optimization are:

  • In foraging behavior, when the number of repetitions is small, it provides the chance for the artificial fish to move randomly, which may jump out of the local optimal solution.
  • The random step size makes it possible for the artificial fish to turn to the global optimal solution on the way to the local optimal solution.
  • The crowding factor δδ limits the size of the swarm, which enables the artificial fish to search more widely.
  • The clustering behavior can make the artificial fish less trapped in the local optimal solution tend to the direction of the global optimal solution and escape from the local optimal solution.
  • Rear-end behavior accelerates the artificial fish to swim to a better state.

Three, artificial fish swarm algorithm implementation steps

  1. Initial Settings, including population size N, initial position of each artificial fish, Visual field of artificial fish, step size, crowding factor δ, and Trynumber of repetitions;
  2. The adaptive value of each individual in the initial fish group was calculated and the optimal artificial fish state and its value were given to the bulletin board.
  3. Evaluate each individual and select behaviors to perform, including foraging Pray, Swarm, Follow, and bulletin;
  4. Perform the behavior of artificial fish, renew themselves, and generate new fish;
  5. Evaluate all individuals. If an individual is superior to the bulletin board, the bulletin board is updated to that individual;
  6. When the optimal solution on the bulletin board reaches the satisfactory error boundary or reaches the upper limit of iteration times, the algorithm ends; otherwise, go to Step 3.

Iv. Flowchart of artificial fish swarm algorithm

5. Influence of various parameters on convergence

In artificial fish swarm algorithm, foraging behavior lays the foundation of algorithm convergence. The clustering behavior enhances the convergence stability of the algorithm. Rear-end behavior enhances the rapidity and global convergence of the algorithm. Its evaluation behavior also guarantees the speed and stability of algorithm convergence.

The artificial fish swarm algorithm has five basic parameters: swarm size N, Visual field of artificial fish, Step size, crowding factor δ, and Trynumber of repetitions. 1. Visual field: Since Visual field has a great influence on all the behaviors in the algorithm, its change has a complicated influence on the convergence performance. Foraging behavior and random behavior of artificial fish were more prominent when the field of vision was small. When the field of vision is larger, the tail chasing behavior and swarm behavior of artificial fish will become more prominent, and the complexity of the corresponding algorithm will also increase. In general, the larger the field is, the easier it is for the artificial fish to find the global optimal solution and converge. Step size Step: For a fixed Step size, with the increase of Step size, the convergence speed accelerates to a certain extent, but when the Step size exceeds a certain range, the convergence speed slows down. When the Step size is too large, the oscillation phenomenon will occur, which will greatly affect the convergence speed. Using random walk a long way to a certain extent, prevent the occurrence of the phenomenon of shock, and greatly reduces the sensitivity of the parameter, but the fastest convergence speed and convergence rate of optimal fixed step, so, for a specific optimization problem, we can consider to use appropriate fixed step length or variable metric method to improve the convergence speed. 3. Group size N: The more artificial fish, the stronger the ability to jump out of the local optimal solution, and the faster the convergence speed. Of course, the cost is that the calculation amount of each iteration of the algorithm is larger. Therefore, the number of graphs should be reduced as much as possible under the premise of stable convergence in the process of use. 4. Trynumber: The more Trynumber, the stronger foraging behavior and higher convergence efficiency of artificial fish. When the local extreme value is prominent, it should be reduced appropriately to increase the probability of artificial fish random walk and overcome the local optimal solution. 5. Delta crowded degree factor: in the maximum problem, the delta = 1 / (alpha nmax), alpha ∈ (0, 1] delta = 1 / (alpha nmax), alpha ∈ (0, 1]; In the minima problem, δ=αnmax,α∈(0,1]δ=αnmax,α∈(0,1]. Where α is the extreme value close to the level, and nmax is the maximum number of artificial fish expected to gather in this neighborhood. The crowding factor combined with NF influenced the optimization results by whether the artificial fish performed tailgating and clustering behaviors. Taking the maximum value as an example (the minimum value is just opposite to the maximum value), the larger δ is, the smaller the allowable crowding degree is, the stronger the ability of the artificial fish to get rid of the local optimal solution is. However, the convergence speed will slow down, mainly because when the artificial fish approach the optimal solution, they will randomly walk away or be rejected by other artificial fish to avoid overcrowding, so they cannot approach the extreme point accurately. It can be seen that the introduction of δ prevents the artificial fish from overcrowding and falling into the local optimal solution, but on the other hand, this parameter makes the artificial fish located near the extreme point have mutually exclusive influence, and it is difficult to accurately approximate the extreme point. Therefore, for some specific problems where the local extremum is not very serious, the crowding factor can be ignored, so as to simplify the algorithm and accelerate the convergence speed and improve the accuracy of the results.

6. Characteristics of artificial fish swarm algorithm

  1. We only need to compare the value of the objective function, and the properties of the objective function are not high.

  2. The requirements for initial values are not high, which can be randomly generated or set as fixed values, with strong robustness;

  3. The requirements for parameter setting are not high and the tolerance range is large;

  4. The convergence speed is slow, but it has parallel processing ability.

  5. Have a good global optimization ability, can quickly jump out of the local optimum;

  6. For some occasions where intensive reading is not required, it can be used to get a feasible solution quickly.

  7. It does not need a strict mechanism model of the problem, or even an accurate description of the problem, which makes its application scope extended.

    Tic Clear all CLC format Long Visual=2.5; Step = 0.3; N=100; % 50 fish Try_number = 100; % do 50 searches while foraging d=[]; h=1e-1; Friend_number=50; A = [977977977977977977977957977970977977]. % % [898898898898898898893892892898898898]. B = [970970970970952952952952952952970970]. % % [888888888888888893888888888888888888]. k=0; % outermost variable, m is its upper limit, the number of control cycles m=50; X1=rand(N,1)*(a(1)-b(1))+b(1); X2=rand(N,1)*(a(2)-b(2))+b(2); X3=rand(N,1)*(a(3)-b(3))+b(3); X4=rand(N,1)*(a(4)-b(4))+b(4); X5=rand(N,1)*(a(5)-b(5))+b(5); X6=rand(N,1)*(a(6)-b(6))+b(6); X7=rand(N,1)*(a(7)-b(7))+b(7); X8=rand(N,1)*(a(8)-b(8))+b(8); X9=rand(N,1)*(a(9)-b(9))+b(9); X10=rand(N,1)*(a(10)-b(10))+b(10); X11=rand(N,1)*(a(11)-b(11))+b(11); X12=rand(N,1)*(a(12)-b(12))+b(12); X=[X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12]; % Artificial fish population 50, A line of 24 vector for a fish for I = 1: N WWWW = [X (I, 1), X (I, 2), X (I, 3), X (I, 4), X (I, 5), X (I, 6), X (I, 7), X (I, 8), X (I, 9), X (I, 1), X (I, 11), X (I, 12)]; % WWW =maxf(WWWW); % WWW =maxf(WWWW); end [w,i]=max(d); maxX=[X(i,1),X(i,2),X(i,3),X(i,4),X(i,5),X(i,6),X(i,7),X(i,8),X(i,9),X(i,10),X(i,11),X(i,12)]; maxY=w; % initial bulletin board record w is the maximum function value figurex1=[]; figurex2=[]; figurex3=[]; figurex4=[]; figurex5=[]; figurex6=[]; figurex7=[]; figurex8=[]; figurex9=[]; figurex10=[]; figurex11=[]; figurex12=[]; figurez=[]; figurex1(numel(figurex1)+1)=maxX(1); %figurex1(Numel (figurex1)+1) =maxX(2); figurex3(numel(figurex3)+1)=maxX(3); figurex4(numel(figurex4)+1)=maxX(4); figurex5(numel(figurex5)+1)=maxX(5); figurex6(numel(figurex6)+1)=maxX(6); figurex7(numel(figurex7)+1)=maxX(7); figurex8(numel(figurex8)+1)=maxX(8); figurex9(numel(figurex9)+1)=maxX(9); figurex10(numel(figurex10)+1)=maxX(10); figurex11(numel(figurex11)+1)=maxX(11); figurex12(numel(figurex12)+1)=maxX(12); figurez(numel(figurez)+1)=maxY; % function Max KKK =0; For p=1:3 while(k<m) for I =1:N % One fish at a time XX=[X(i,1),X(i,2),X(i,3),X(i,4),X(i,5),X(i,6),X(i,7),X(i,8),X(i,9),X(i,10),X(i,11),X(i,12)]; nf=0; Xc=0; For j = 1: N = % cluster behavior began to XXX [X (j, 1), X (j, 2), X (j, 3), X (j, 4), X (j, 5), (6) j, X and X (j, 7), X (j, 8), X (j, 9), X (j, 10), X (j, 11), X (j, 12)]; if(norm(XXX-XX)<Visual) nf=nf+1; Xc=Xc+XXX; end end Xc=Xc/nf; % Fish center position if((maxf(Xc))>maxf(XX)) XXnext1=XX+rand*Step*(xC-XX)/norm(xC-XX); XXnext1=xianzhi(XXnext1); else XXnext1=gmjprey(XX,Try_number,Visual,Step); Foraging XXnext1% = xianzhi (XXnext1); End %maxX=XX; % when the rear-end behavior starts, the initial position of the rear-end is xx and clustering, as in line 35 %maxY=maxf(xx); for j=1:Friend_number XXX=[X(j,1),X(j,2),X(j,3),X(j,4),X(j,5),X(j,6),X(j,7),X(j,8),X(j,9),X(j,10),X(j,11),X(j,12)]; if(norm(XXX-XX)<Visual & maxf(XXX)>maxY) maxX=XXX; maxY=maxf(XXX); End end if((maxY)>maxf(XX)) XXnext2=XX+rand*Step*(maxx-xx)/norm(maxx-xx); XXnext2=xianzhi(XXnext2); else XXnext2 =gmjprey(XX,Try_number,Visual,Step); Foraging XXnext2% = xianzhi (XXnext2); If (maxf(XXnext1)> MAXf (XXnext2))) % for j= 1:12x (I,j)=XXnext1(j); End %%%%%%%%%%%%%%%%% monthly inflow, wet year qwan=[313 363 587 493 263 309 699 1110 1134 808 486 325]; % qwan = [402352702457227432418104] 0795544373405; % qwan = [598.21, 699.12, 564.58, 667.52, 195.60, 195.60, 195.60, 946.89, 3235.13, 1505.35, 951.89, 730.58]. % % in a wet year qwan = [167.16, 176.81, 378.46, 317.67, 286.8, 286.8, 1061.56, 1312.18, 918.52, 768.25, 500.99, 250.13]. % % PingShuiNian qwan = [332.3, 295.18, 664.44, 365.42, 26.15, 45.32, 122.58, 950.26, 622.13, 141.65, 236.98, 334.18]. More or less the same % % % % % % % % % % % % % % % % monthly water, wet year of QWL =,0,0,0,0,0,0,0,0,0,0,0 [0]; % of upstream and downstream reservoir interval flow w represents Wan Jiazhai, l on behalf of longkou % % % % % % % % % % % % monthly t (1) = 31 * 24 hours; t(3)= t(1); t(5)= t(1); t(5)= t(1); t(7)= t(1); t(8)= t(1); t(10)= t(1); t(12)= t(1); t(2)=28*24; t(4)=30*24; t(6)= t(4); t(9)= t(4); t(11)= t(4); % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- for j = 1:12% % % % % % % water volume capacity of the if (j) < < = 952 x 955 Vw (j) = (4.508 + (x (j) - 952)/(955-952) * (4.548 4.508)) * 10 ^ 8; % vw (j) capacity of the upstream water level corresponding elseif (j) < < = 955 x 957 vw (j) = (4.548 + (x (j) - 955)/(957-955) * (4.739 4.548)) * 10 ^ 8; Elseif (j) < < = 957 x 960 vw (j) = (4.739 + (x (j) - 957)/(960-957) * (4.936 4.739)) * 10 ^ 8; Elseif (j) < < = 960 x 965 vw (j) = (4.936 + (x (j) - 960)/(965-960) * (5.546 4.936)) * 10 ^ 8; Elseif (j) < < = 965 x 970 vw (j) = (5.546 + (x (j) - 965)/(970-965) * (7.756 6.563)) * 10 ^ 8; Elseif < = 975 x (j) < 977.5 vw (j) = (7.756 + (x (j) - 975)/(977.5-975) * (8.35 7.756)) * 10 ^ 8; Elseif (j) < < = 977.5 x 980 vw (j) = (8.35 + (j) to 977.5 (x)/(980-977.5) * (8.962 8.35)) * 10 ^ 8; End end for j = 1:11% % % % % % % % % % % % % % % analyzed QXW push water level (j) = qwan (j) - (vw (j + 1) - vw (j))/(t (j) * 3600); % QXW (j) for outbound traffic end QXW (12) = qwan (12) - (vw (1) - vw (12))/(t (12) * 3600); % vw (13) = vw (1) % % % % % % % % % % % % % % % % % % % % % % % % % % of discharge water relations for j = 1:12 if 0 < = QXW (j) < 85 HXW (j) = 898 + (QXW (j) - 0)/(85-0) * (899-898); % of the downstream flow water level of the corresponding elseif < = 85 QXW (j) < 174 HXW (j) = 899 + (QXW (j) - 85)/(174-85), * (900-899); elseif 174<=qxw(i)<286 hxw(j)=900+(qxw(j)-174)/(286-174)*(901-900); elseif 286<=qxw(j)<571 hxw(j)=901+(qxw(j)-286)/(571-2860)*(902-901); elseif 571<=qxw(j)<878 hxw(j)=902+(qxw(j)-571)/(878-571)*(903-902); elseif 878<=qxw(j)<1320 hxw(j)=903+(qxw(j)-878)/(1320-878)*(904-903); elseif 1320<=qxw(j)<1860 hxw(j)=904+(qxw(j)-1320)/(1860-1320)*(905-904); elseif 1860<=qxw(j)<2480 hxw(j)=905+(qxw(j)-1860)/(2480-1860)*(906-905); endCopy the code

    3. Operation results

    Fourth, note

    Complete code or simulation consulting to add QQ1575304183