
Source-code of EHO algorithm in C++ 155
44 % update e l e p h a n t s p o s i t i o n s ex c e p t b e s t and wors t e l e p h a n t s
45 pp_new( j , c )=pp ( j , c )+al p ha ∗ ( p b es t ( c )−pp ( j , c ) ) ∗rand ;
46 e l s e i f j==b e s t l o c
47 pp_center=mean( pp ( : , c ) ) ;
48 % update l e a d e r or mat riarc h as s u g g e s t e d
49 pp_new( j , c )=beta ∗ pp_center ;
50 e l s e i f j==w o r s t l o c
51 % update w orst e l ep h a n t as s u g g e s t e d
52 pp_new( j , c )=LB( c )+(UB( c )−LB( c ) +1)∗rand ;
53 end
54 end
55 % f i t n e s s c a l c u l a t i o n f o r new po p u la t i on
56 F i t n e s s ( j )=OF(pp_new ( j , : ) ) ;
57 end ...