Skip to main content
. 2023 May 9;8(2):197. doi: 10.3390/biomimetics8020197
Algorithm 4: Two-step QABC clustering
Input: D dataset contains best feature values fbest,i for each URLi
Fitness Function “Sensitivity”
Output: Best solution of final cluster center (Cbest,j) j = 1, 2
Begin
Initialization phase.
  • -

    Important QABC settings are determined by the user, including particle population size, optimization variable bounds, modification rate (MR), tuning vector (μ), and stopping criterion (t_max).

  • -

    Use a uniform probability distribution function to seed an initial population (array) of food sources with placements across the n-dimensional space.

For i = 1:SN/* SN is the total number of food sources (number of clusters) */
Initialize the food source within the boundary of given dataset in random order;
Apply the K-means algorithm
Send the employed bees to the food sources; /* Computed centers */
End For
Iteration = 0;
Do While (the termination condition is not met)
For (each employed bee)/* Employed bee’s phase */
For i = 1:SN
  • -

    Update the positions of the employed bees using vij=xij+ijxijxkj,ij[1,1], then evaluate their fitness using Equation (3)

  • -

    A greedy selection is made between the old and new food source and keep the best one;

End For
For i = 1:SN
Compute the probability value associated with each food source.
 End For
For i = 1:SN /* Start the onlooker bees phase*/
 If (rand ( ) < Pri) /* Pri the probability associated with ith food source */
  • -

    Generate a new position for each onlooker using Equation (15) then evaluate the fitness

  • -

    A greedy selection is made between the old and new food source and keep the best one;

Else
i = i + 1;
End If
End For
If (any employed bee becomes scout bee)/* Scout bee’s phase */
Send the scout bee to a randomly produced to food source;
End if
Memorize the best solution achieved
Iteration = iteration + 1
End While
Obtain final cluster Center
End