Initialization(1)Initialize the number of clusters and number of iterations.(2)Initialize , sc, fc, numSuccess = 0, and numFailures = 0.(3)Define a fitness function.
Clustering(4)Find the fitness value for each particle.(5)Update the local best solution obtained so far.(6)Repeat steps 4 and 5 for the predefined number of iterations.(7)Update velocity and position of each particle for the current global best particle.
Selection step(8)Execute the selection operator.(9)If any local best position yi has changed, perform the clustering algorithm. Otherwise, end the algorithm.