AN IMPLEMENTATION OF BINARY AND FLOATING POINT CHROMOSOME REPRESENTATION IN GENETIC ALGORITHM Main Golub Faculty of Electical Engineeing and Computing, Univesity of Zageb Depatment of Electonics, Micoelectonics, Compute and Intelligent Systems Unska 3, Zageb, Coatia e-mail: golub@zemis.fe.h Abstact: This pape descibes the implementation details and compaes two methods fo optimisation of multi-dimensional cost functions. The implemented genetic algoithm uses two chomosome epesentations: binay and floating point. In both epesentations the algoithm is based on steady-state epoduction, oulette-wheel bad individuals selection and has the same paametes. Key wods: genetic algoithm, chomosome epesentation, steady-state epoduction. Intoduction Genetic algoithms ae vey pactical and obust optimisation methods [],[3],[6]. The geneal idea is the simulation of natual evolution in the seach fo the optimal solution of a given poblem. In natue individuals ae competing to suvive. In this competition, only the fittest individuals suvive and epoduce. Theefoe, the genes of the fittest suvive, while the genes of weake individuals die out. Genetic mateial is saved into the chomosomes. Paents genetic mateial is mixed duing epoduction and the offsping has genes of both paents. Also, an individual s genetic mateial can be changed by mutation. Mutation is a andom change of one o moe genes. Implementation of this natual pocess is suitable as an optimisation method. Figue shows the stuctue of a genetic algoithm and an evolution pogam in geneal. pocedue Evolution pogam initialize population while temination citeion is not eached evaluate population select individuals fo next population pefom cossove and mutation Figue : Stuctue of the genetic algoithm When we simulate the natual genetic algoithm, each individual (chomosome) epesents a potential solution of a given poblem. The GA sps most of the time on evaluating population. Theefoe,
the epesentation of chomosome is vey impotant: it could be an aay of bits, a numbe, an aay of numbes, a matix, a sting of chaactes o any othe data stuctue. A chomosome must satisfy given pecision and constaints [],[3],[5],[6]. And, of couse, it has to be suitable fo the implementation of genetic opeatos. In section the implemented genetic algoithm with steady-state epoduction is descibed. In sections 3 and 4 chomosome epesentations ae descibed. Test function and expeimental esults ae descibed in sections 5 and 6, espectively.. Implemented genetic algoithm In the binay and floating-point chomosome epesentation the implemented GA is the same and has the same paametes: the size of population, the numbe of eliminated individuals and the numbe of mutations pe geneation. The diffeence between the two methods is in chomosome epesentation and specific genetic opeatos. The initialisation pocess is vey simple: it ceates a population of POP_SIZE individuals (chomosomes), whee each chomosome is initialised andomly. Evaluation function eval is defined as the diffeence between function f and the minimal value of function f in cuent population: eval( x) f ( x) min { f ( xi )} =, i=,,...pop_size. This pocedue is called windowing [] whee minimum is equal to zeo (minimum evaluation value is zeo). It eliminates negative evaluation values and potects the algoithm fom becoming a andom seach pocess if all individuals have appoximately the same lage function values []. The selection pocess saves the best individual. Figue shows the steady-state epoduction with oulette-wheel bad individual selection. Steady-state epoduction eplaces only M individuals. On the othe hand, the geneation eplacement technique eplaces its entie set of paents by thei childen. Steady-state epoduction has one paamete: M - the numbe of new chomosomes to ceate [],[5]. i pocedue Genetic algoithm with steady-state epoduction initialize population while temination citeion is not eached calculate elimination pobability fo each individual tun oulette-wheel M times and each time delete chosen individual mate suvived individuals and substitute M eliminated individuals by thei childen Figue : Genetic algoithm with steady-state epoduction The elimination pobability p e is popotional to individual s elimination fitness: elimination_fitness { eval xi } = max ( ) eval( x ). Because the elimination pobability of the best i individual is zeo, that selection always saves the best individual.
Fo this paticula poblem the following paametes ae used: population size: POP_SIZE=,3,6,, numbe of eliminated individuals: M=POP_SIZE/ and numbe of mutations pe geneation: N_M POP_SIZE/3. Fo the one-dimensional poblem, numbe of populations (iteations) is set to 5, and fo two and ten-dimensional poblems it is set to. 3. The binay implementation In the binay implementation each chomosome consists of a binay vecto that epesents eal value of the vaiable x. If the poblem is multidimensional, the chomosome consists of an aay of binay vectos. The length n of the binay vecto deps on the equied pecision. The domain of the vaiable x is [LB,UB] whee LB,UB R. Vecto... (n bits and all bits ae set to zeo) epesents value LB and vecto... epesents value UB. Any othe binay vecto b n- b n-...b b b epesents value x with pecision x: n i λ bi i= x = LB + n ( UB LB) UB LB, x = n (),() The pecision of the binay epesentation can be exted by inceasing the numbe of bits pe chomosome, but this consideably slows down the algoithm [5]. We used unifom cossove: each bit of a new child is taken fom one of the paents andomly. Figue 3 shows unifom cossove pocedue. pocedue Unifom cossove fo i= to n child[bi]=choose_one_by_equal_chance(paent[bi],paent[bi]) Figue 3: Unifom cossove The mutation is a andom change of one bit. The mutation pobability of the best individual is zeo and fo the othe individuals it is: N M p = _ m, (3) POP_ SIZE * n ( ) whee N_M is the numbe of mutations and n is a numbe of bits. 4. The floating point implementation In the floating point implementation the chomosome consists of a floating point numbe. Of couse, if the given function has moe than one vaiable, then the chomosome consists of an aay of floating point numbes. The pecision of such an appoach deps on the floating point numbe implementation. The cossove opeato is defined as: x = and_ numbe_ in_ ange( x, x ) child paent paent.
The simple mutation opeato defined by: x = and _ numbe _ in_ ange( LB, UB) gives bad expeimental esults in fine local tuning. The eason of such behaviou of the algoithm with simple mutation opeato is the vey low pobability that afte mutation an element will fall within a small inteval δ of the domain ange [5]: whee δ <<(UB-LB) Τ p δ. p δ δ =, (4) UB LB The non-unifom mutation opeato deps on the time, that is, on the geneation numbe t. The pobability of mutation is constant, but mutation scope isn t and it changes with time. If chomosome x k is selected fo mutation then the new chomosome x k is calculated as: x k =and_numbe_in_ange(lbm,ubm) (5) { k } { k } whee LBM = max LB, x ( UB LB) ( t ), UBM = min UB, x + ( UB LB) ( t ), and b χ t χ T ρ ( t) = s, whee s is a andom numbe fom the inteval [,], b is a system paamete detemining the degee of depency on iteation numbe (we used b=5) and T is the maximal geneation numbe. This function enables deceasing the seach scope and the pocedue idea is boowed fom simulated annealing [4]. If t is small value, then the seach scope is a andom numbe between and UB-LB. At the othe hand, at the of time (t T) seach scope ts to zeo (seach scope ) [5]. 5. Test function.98.96.94.9.9 - -5 5.8.6.4 5-5. 5-5 - -5 5 Figue 4: D test function f ( x) = 5. sin ( x) 5. ( +. * x ) x [, ], Figue 5: Segment of D test function f ( x, y) = 5. sin x + y 5. [ +. ( x + y )] [ ] x, y,,
The test function [] in N-dimensional space is given as: sin xi 5. i= f ( x) = 5. N, υ ε +. λ xi i= υ The global maximum of the given poblem is f ( ) one and two dimensional space espectively. N λ x x υ ε x = ε ε... ε x N υ,,,..., [, ] x x x N =. Figue 4 and Figue 5 show function f ( x ) in 6. Expeimental Results Fo one and two-dimensional poblems both methods give vey simila esults, howeve, the GA with floating point epesentation is 6% faste then the GA with binay epesentation. The diffeences between two GA methods ae lage if the seach space is thee o moe dimensional. Fo the ten-dimensional poblem GA with floating point implementation gives slightly bette solutions in a thee times shote time than the GA with binay implementation. dimension of poblem D D D population size 3 6 numbe of iteations 5 5 numbe of expeiments chomosome epesentation Binay FP Binay FP Binay FP Binay FP each global optimum f(x)= 96.7% 98.% % % 6% 8% none none each fist local optimum f(x).99 3.3%.8% none none 84% 9% none none each othe local optimum whee f(x)>.8 none none none none none none 53% 76% d - aveage deviation 3.6E-4.96E-4 E-5 7.6E-5.83.89.7.67 σ - standad deviation.8.3.9e-4 6.65E-4.36.4.93.6 CPU time in seconds fo expeiments 68 3 43 69 85 87 3878 789 Table : Expeimental optimisation esults Deviation d is calculated fo each expeiment as: d = f ( ) f ( x ) max. Last ow in the table shows how much CPU-time a SUN SPARCstation (4/75) with 3 MB RAM sps fo expeiments. The paametes of GA wee not optimised. Fo a paticula set of paametes esults would be bette. We should expect bette esults if we shink the domain ange. Fo example, let it be: x, x,..., x N [, ]. Table shows esults of the optimisation of the same test function, but with a smalle domain ange. The GA with floating point chomosome epesentation almost becomes a andom seach pocess. The eason fo such algoithm behaviou lies in bad cossove opeato. If we choose any two chomosomes fom the domain ange (neithe of them is the global optimum), the defined cossove can t poduce the global optimum, because the global optimum is on the edge of the domain ange.
dimension of poblem D D population size 3 6 numbe of iteations 5 numbe of expeiments chomosome epesentation Binay FP Binay FP each global optimum f(x)= % 77% 3% none each fist local optimum f(x).99 none 3% 77% 74% each othe local optimum whee f(x)>.8 none none none 6% d - aveage deviation.5.75.35 σ - standad deviation.38.4.89 Table : Expeimental optimisation esults with smalle domain ange: x, x,..., [, ] x N 7. Conclusion The GA with floating point chomosome epesentation is simple fo implementation and it is faste than GA with binay epesentation. Thee ae two easons fo that: ) Fo the binay implementation, the algoithm must have a convesion mechanism that could convet a bit sting (chomosome) to the eal value. The floating point implementation does not need such a mechanism, because the chomosome is at the same time a eal value. ) Genetic opeatos cossove and mutation defined ove floating point values ae simple and faste than the unifom cossove and mutation ove bit stings. Fo multidimensional poblem the GA with floating point chomosome epesentation gives slightly bette esults then the GA with binay epesentation (Table ). The solution of the poblem of fine local tuning in floating point epesentation lies in non unifom mutation. On the othe hand, the GA with floating point chomosome epesentation almost becomes a andom seach pocess, if, fo a paticula poblem, the cossove opeato can t poduce the optimal solution (see esults in the Table ). Refeences: [] Davis, L. (99), Handbook of Genetic Algoithms, Van Nostand Reinhold, New Yok. [] Filhio, J.L.R., Teleaven, P.C., Alippi, C. (994), Genetic-Algoithm Pogamming Envionments, Compute, Vol. 7-6, pp. 8-43., June 994. [3] Goldbeg, D.E. (989), Genetic Algoithms in Seach, Optimization and Machine Leaning, Addison-Wesley. [4] Laahoven, P.J.M., Aats, E.H.L. (987), Simulated Annealing: Theoy and Applications, D. Reidel Publishing Company. [5] Michalewicz, Z. (994), Genetic Algoithms + Data Stuctues = Evolution Pogams, Spinge-Velag, Belin. [6] Sinivas, M., Patnaik, L.M. (994), Genetic Algoithms: A Suvey, Compute, Vol. 7-6, pp.7-6, June 994.