
170 Firefly Algorithm
83 {
84 f o r ( i nt j =0; j<d ; j ++)
85 {
86 i f ( ns [ i ] [ j ]<Lb [ j ] ) {ns [ i ] [ j ]=Lb [ j ] ; }
87 i f ( ns [ i ] [ j ]>Ub[ j ] ) {ns [ i ] [ j ]=Ub [ j ] ; }
88 }
89 }
90 // Ranking f i r e f l i e s by t h e i r l i g h t i n t e n s i t y / o b j e c t i v e s
91 f o r ( int i =0; i<n ; i ++)
92 {
93 f o r ( i nt j =0; j<d ; j ++)
94 {
95 ns_tmp [ i ] [ j ]= ns [ i ] [ j ] ;
96 }
97 Lightn_tmp [ i ]= Li ght n [ i ] ;
98 }
99 f l o a t wo r s t _ f i t =∗max_element ( Lightn_tmp , Lightn_tmp+d ) +1;
100 f o r ( i n t i =0; i <n ; i ++)
101 {
102 i n t b e s t _ f i t=min_element ( Lightn_tmp , Lightn_tmp+d )−Lightn_tmp ;
103