Skip to main content
. 2023 Jan 25;13(3):433. doi: 10.3390/diagnostics13030433
Algorithm 1 Binary Firefly Algorithm
  Input: Firefly population as in Table 5 (with their fitness function value calculated by Equation (1))
Output: Firefly (subset features) with maximum fitness function value
  while iteration < maximum iteration
    for i = 1 to n (n = number of fireflies)
      for j = 1 to n (n = number of fireflies)
        if fitfunci<fitfuncj
          move ith firefly towards jth firefly with the Equation (2)
          apply Equation (6)–(7)
        else
          move ith firefly randomly with the Equation (5)
          apply Equation (6)–(7)
        end if
        calculate new fitness function value of new ith firefly with the Equation (1)
      end for
    end for
    rank the fireflies (subset features) according to their fitness function values
  end while
  Obtain the firefly (subset features) which has the maximum fitness function value