A Competitive Swarm Optimizer-Based Technoeconomic Optimization with Appliance Scheduling in Domestic PV-Battery Hybrid Systems
Algorithm 1
Pseudo code of the CSO algorithm.
Definition:
x: the particle;
P: the swarm;
: the swarm size, i.e., the number of particles;
G: number of iterations;
and l: the indices of winner and loser particles;
: the fitness function, assuming that this is a minimization problem;
Terminal condition: the maximum number of iteration is reached;(1)Begin(2) Initialize population with particles;(3)while do(4) P(G + 1) = ;(5)while do(6) Generate two random indices and from ;(7)if then(8);(9)else(10);(11)end if(12) put into ;(13) If x is coded as continuous variables, update with (23) and (22);(14) If x is coded as discrete variables, update with (24);(15) If x contains both continuous and discrete parts, update the two parts separately;(16) put the updated loser particle into ;(17) remove particles and from ;(18)end while(19)G = G + 1;(20)end while(21) choose the particle with the best fitness from ;(22)Return ;(23)End