Research Article

Firefly Algorithm for Cardinality Constrained Mean-Variance Portfolio Optimization Problem with Entropy Diversity Constraint

Algorithm 3

Modified firefly algorithm.
Generate initial population of fireflies and ( ) by using (33) and (35)
Apply arrangement algorithm
Light intensity at point is defined by
Define light absorption coefficient
Define number of iterations IN
Calculate fitness and CV for all fireflies using (26) and (36)
Set initial values for
Set value to
while     do
for   to SN  do
  for   to   do
   if     then
    Move firefly towards firefly in dimension using (37) and (38)
    Attractiveness varies with distance via exp
    Evaluate new solution, replace worse with better solution
    using Deb’s method and update light intensity
    if  solution is not improved and   then
      increment by 1
    else
      set to 0
    end if
   end if
  end for
end for
if     then
  replace all agents whose UIC > AT with random agents using (33)
end if
 Apply arrangement algorithm
 Rank all fireflies and find the current best
 Recalculate values for using (39)
end while