Particle swarm optimization (PSO) is derived from Complex Adaptive System (CAS). CAS theory was formally proposed in 1994, and the members of CAS are called subjects. For example, when studying bird systems, each bird in this system is called a principal. The subject is adaptable, it can communicate with the environment and other subjects, and according to the process of communication “learn” or “accumulate experience” to change its own structure and behavior. The evolution or evolution of the whole system includes: the creation of new levels (the birth of birds); The emergence of differentiation and diversity (the birds in a flock split into many smaller groups); The emergence of new themes (birds constantly find new food as they search for food). Therefore, the subject in CAS system has four basic characteristics (these characteristics are the basis for the development and change of PARTICLE swarm optimization algorithm) : First, the subject is active and active. Subject interacts with environment and other subjects, which is the main driving force for the development and change of the system. The influence of environment is macro, and the influence between subjects is micro. Macro and micro should be organically combined. Finally, the whole system may be affected by some random factors. Particle swarm optimization algorithm is a CAS system – the social system of birds. Particle Swarm Optimization (PSO) was first proposed by Eberhart and Kennedy in 1995, and its basic concept was derived from the study of bird foraging behavior. Consider this: a group of birds are randomly searching for food. There is only one piece of food in the area. None of the birds know where the food is, but they know how far away the food is from their current location. So what’s the optimal strategy for finding food? The simplest and most effective is to search the area around the bird that is currently closest to the food. PSO algorithm is inspired from the behavior characteristics of the biological population and used to solve optimization problems. In PSO, the potential solution of each optimization problem can be imagined as a point in the D-dimensional search space, which is called “Particle”. All particles have a Fitness Value determined by the objective function, and each Particle also has a speed that determines the direction and distance of their flight. The particles then search the solution space following the current optimal particle. Reynolds’ study of bird flight found that. The bird is only tracking a limited number of its neighbors but the overall result is that the entire flock seems to be under the control of one center. That complex global behavior is caused by the interaction of simple rules. Ii. Source code

Clear all CLC % OPT calculated correlation M=20; % number of particles I=4; % Number of hydropower stations T=24; % K = 400; % Number of iterations lamda=100; % Penalty function penalty factor error=0.01; % Error accuracy winI =0.9; Wend = 0.4; c1=2; c2=2; % Particle swarm optimization algorithm inertia factor and learning factor x= Zeros (I,T,M); % particle position v= Zeros (I,T,M); Vmax =zeros(I,1); % particle maximum velocity alpha=60; Beta = 1.355; Gama = 0.0105; Yeta = 0.4968; Deta = 0.01925; % e=zeros(M,1); % particle fit value pbest= Zeros (I,T,M); Epbest =zeros(M,1); % individual best fit value gbest=ones(1,1); % global best serial number as=5000; Bs = 19.2; Cs = 0.002; % Coal consumption cost coefficient F =0; % coal consumption cost % Load correlation Pd=[1370 1390 1360 1290 1290 1410 1650 2000 2240 2320 2230 2310 2230 2200 2130 2070 2130 2140 2240 2280 2240, 2120, 1850, 1590]; %24 hours load power % power station correlation Ps= Zeros (1,T); % Thermal power output Psmax=2500; % Maximum power output Psmin=500; Psbest= Zeros (1,T); % Power station correlation Vh= Zeros (I,T); % storage capacity Vhmax=[150 120 240 160]; % Maximum storage capacity Vhmin=[80 60 100 70]; % Minimum storage capacity Vhini=[100 80 170 120]; % Initial value of storage capacity Vhend=[120 70 170 140]; Vhx=ones(I,1); The difference between the calculated value and the final value Vhbest= Zeros (I,T); Optimal solution of storage capacity of hydropower station Qh= Zeros (I,T); % generation flow Qhmax=[15 15 30 25]; % maximum generating flow Qhmin=[5 6 10 13]; Qhbest= Zeros (I,T); % generation flow Ph= Zeros (I,T); % hydropower output power Phsum= Zeros (1,T); % Total output power of hydropower Phmax=500; % Maximum output power of hydropower Phmin=0; Phbest= Zeros (I,T); Phsumbest= Zeros (1,T); % The sum of optimal solutions of hydropower output power Ih=[10 9 8 7 6 7 8 9 10 11 12 10 11 12 11 10 9 7 6 7 8 8 9 10; 8 8 9 9 8 7 7 8 9 9 8 8 9 9 7 6 7 7 8 8 9 9 9 8 8; 8.1 8.2 4 2, 3, 4, 3 2 1 1 1 2 3 4 1 2 3 2 2 2 1 2 1 0; 2.8 2.4 1.6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % Hydropower station runoff C =[-0.0042-0.42 0.030 0.90 10.0-50; -0.0040-0.30 0.015 1.14 9.5-70; -0.0016-0.30 0.014 0.55 5.5-40; -0.0030-0.31 0.027 1.44 14.0-90]; % output power coefficient tao=[2 340]; Function [Qh,Pst,Vh,Ph]=adjust(Qh) %opt % Number of hydropower stations T=24; % time Tadjust = round (rand () * (T - 2)) + 1; Error =[0.001 0.001 0.001 0.001 0.001]; % Accuracy error s=0; Smax =20; % Adjustment Max. % Load correlation Pd=[750 780 700 650 670 800 950 1010 1090 1080 1100 1150 1110 1030 1010 1060 1050 1120 1070 1050 910 860 850, 800]; %24 hours load power % power station correlation Pst= ZerOS (3,T); % thermal power output Psmax=[175 300 500]; % thermal power output maximum power Psmin=[20 40 50]; Vh= Zeros (I,T); % storage capacity Vhini=[100 80 170 120]; % Initial value of storage capacity Vhend=[120 70 170 140]; Vhx=ones(I,1); % when the generating flow Qh is adjusted, the difference between the calculated value and the final value Qhmax=[15 15 30 25]; % maximum generating flow Qhmin=[5 6 10 13]; % Generation flow minimum Ph= Zeros (I,T); % Hydropower output power Phmin=0; % Minimum water and electricity output power Ih=[10 9 8 7 6 7 8 9 10 11 12 10 11 12 11 10 9 7 6 7 8 8 9 10; 8 8 9 9 8 7 7 8 9 9 9 8 7 7 7 8 9 9 8 9 9 8 7 7 7 8 8 9 9 9 9 8 8; 8.1 8.2 4 2, 3, 4, 3 2 1 1 1 2 3 4 1 2 3 2 2 2 1 2 1 0; 2.8 2.4 1.6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % Hydropower station runoff C =[-0.0042-0.42 0.030 0.90 10.0-50; -0.0040-0.30 0.015 1.14 9.5-70; -0.0016-0.30 0.014 0.55 5.5-40; -0.0030-0.31 0.027 1.44 14.0-90]; % output power coefficient tao=[2 340]; % % water delay coefficient calculation Vh for I = 1: I for t = 1: t if t = = 1 Vh (I, t) = Vhini (I) + Ih (I, t) - Qh (I, t); else Vh(i,t)=Vh(i,t-1)+Ih(i,t)-Qh(i,t); end if i==3 if t>tao(1) Vh(i,t)=Vh(i,t)+Qh(1,t-tao(1)); end if t>tao(2) Vh(i,t)=Vh(i,t)+Qh(2,t-tao(2)); end end if i==4 if t>tao(3) Vh(i,t)=Vh(i,t)+Qh(3,t-tao(3)); end end end Vhx(i)=Vhend(i)-Vh(i,T); For I =1:I while abs(Vhx(I))>error(I) for t=Tadjust: t Qh(I,t)=Qh(I,t) -vhx (I)/(T-Tadjust)/50; if Qh(i,t)>Qhmax(i) Qh(i,t)=Qhmax(i); end if Qh(i,t)<Qhmin(i) Qh(i,t)=Qhmin(i); end end for t=Tadjust:T if t==1 Vh(i,t)=Vhini(i)+Ih(i,t)-Qh(i,t); else Vh(i,t)=Vh(i,t-1)+Ih(i,t)-Qh(i,t); end if i==3 if t>tao(1) Vh(i,t)=Vh(i,t)+Qh(1,t-tao(1)); end if t>tao(2) Vh(i,t)=Vh(i,t)+Qh(2,t-tao(2)); end end if i==4 if t>tao(3) Vh(i,t)=Vh(i,t)+Qh(3,t-tao(3)); end end end Vhx(i)=Vhend(i)-Vh(i,T); s=s+1; % if s>smax s=0; Tadjust=round(rand()*(T-2))+1; End end end % Calculate the Ph Ph(i,t)=c(i,1)*Vh(i,t)*Vh(i,t)+c(i,2)*Qh(i,t)*Qh(i,t)+c(i,3)*Vh(i,t)*Qh(i,t)+c(i,4)*Vh(i,t)+c(i,5)*Qh(i,t)+c(i,6); if Ph(i,t)<Phmin Ph(i,t)=Phmin; Phsum=zeros(1,T); for t=1:T for i=1:I Phsum(1,t)=Phsum(1,t)+Ph(i,t); End end % Ps Psum=zeros(1,T); for t=1:T for i=1:2 Ps(t)=Pd(t)-Phsum(t); Pst(i,t)=Psmin(i)+rand()*(Psmax(i)-Psmin(i)); Psum(1,t)=Psum(1,t)+Pst(i,t); end Pst(3,t)=Ps(t)-Psum(1,t); if Pst<0 Pst(3,t)=0; end if Pst(3,t)<Psmin(3) Pst(3,t)=0; Pst(1,t)=Pst(1,t)+ Pst(3,t)./2; Pst(2,t)=Pst(2,t)+ Pst(3,t)./2; end endCopy the code

Third, the operation result Fourth, noteVersion: 2014 a