Professional Documents
Culture Documents
GALOPPS
The "Gen e t i c ALgori t h m Opti m i z e d for Port a b i i t ! and Para e i " m " S! " t e m
#c$ %ichi g a n Sta t e Uni& er " i t ! ' () ) * ' () ) + ' () ) , ' () ) - .
9/R/DIT< GALOPPS i" a di" t a n t d e " c e n d a n t of@ SGA4 C' &(. ( ' m o difi c a t i o n " b! 1eff /aric7 " o n ' =o ei n g Com p a n ! ' A hic h A a " ba " e d on SGA4 C' b! Rob e r t /. Smit h ' Uni&. of A ab a m a ' A hic h A a " ba " e d on SGA #in Pa " c a $ ' #c$ Da&i d /. Go d b e r g () 8 - ' A Righ t " Re " e r & e d ' a" d e " c ri b e d in GOLD=/RG' Da&i d /.' Gen e t i c A g orit h m " in S e ar c h ' Optim i z a t i o n ' an d %achi n e Learni n g ' Addi " o n 4 6e " e ! ' Rea d i n g ' %a" " a c h 2 " e t t " ' USA' () 8 ) .
GALOPPS The "Gen e tic ALgorith m Optimiz e d for Portability and Parallelism " Syst e m Erik D Good m a n !"# "opyrigh t$ %&&'$ %&& ($ %&&)$ *oard of Tr+st e e s $ ,ichiga n Stat e -ni.esit y East Lansing$ ,ichiga n '// 0 ' -SA ESGA12PGA S3STE, !on 4hich GALOPPS 2S *ASED# The E5ten d e d SGA and 2sland Parallel Gen e tic Algorith m Syst e m Erik D Good m a n !"# "opyrigh t$ %&&6$ %&& '$ *oard of Tr+st e e s $ ,ichiga n Stat e -ni.ersity East Lansing$ ,ichiga n '// 0 ' -SA
ii
SGA4 C NOTIC/ #Co& e ri n g th e "of t A a r e from A hic h th e /SGA5IPGA S! " t e m ' an d th e n e& e n t 2 a ! ' th e GALOPP S! " t e m ' A a " origi n a ! d eri& e d $ NO 6ARRANT<
*E"A-SE SGAA" 2S L2"E9SED ;8EE O; "7A8GE$ =E P8O:2DE A*SOL-TEL3 9O =A88A9T3$ TO T7E E>TE9T PE8,2TTED *3 APPL2"A*LE STATE LA= E>"EPT =7E9 OT7E8=2SE STATED 29 =82T29G$ T7E A-T7O8S O; SGAA" P8O:2DE SGAA" "AS 2S" =2T7O-T =A88A9T3 O; A93 ?29D$ E2T7E8 E>P8ESSED O8 2,PL2ED$ 29"L-D29G$ *-T 9OT L2,2TED TO$ T7E 2,PL2ED =A88A9T2ES O; ,E8"7A9TA*2L2T3 A9D ;2T9ESS ;O8 A PA8T2"-LA8 P-8POSE T7E E9T28E 82S? AS TO T7E @-AL2T3 A9D PE8;O8,A9"E O; T7E P8OG8A, 2S =2T7 3OS7O-LD T7E SGAA" P8OG8A, P8O:E DE;E"T2:E$ 3O- ASS-,E T7E "OST O; ALL 9E"ESSA83 SE8:2"29G$ 8EPA28 O8 "O88E"T2O9 29 9O E:E9T -9LESS 8E@-28ED *3 APPL2"A*LE LA= =2LL T7E A-T7O8S O; SGAA"$ A9D1O8 A93 OT7E8 PA8T3 =7O ,A3 ,OD2;3 A9D 8ED2ST82*-TE SGAA" AS PE8,2TTED A*O:E$ *E L2A*LE TO 3O- ;O8 DA,AGES$ 29"L-D29G A93 LOST P8O;2TS$ LOST ,O92ES$ O8 OT7E8 SPE"2AL$ 29"2DE9TAL O8 "O9SE@-E9T2AL DA,AGES A82S29G O-T O; T7E -SE O8 29A*2L2T3 TO -SE !29"L-D29G *-T 9OT L2,2TED TO LOSS O; DATA O8 DATA *E29G 8E9DE8ED 29A""-8ATE O8 LOSSES S-STA29ED *3 T728D PA8T2ES O8 A ;A2L-8E O; T7E P8OG8A, TO OPE8ATE =2T7 P8OG8A,S 9OT D2ST82*-TED *3 ;8EE SO;T=A8E ;O-9DAT2O9$ 29" # T7E P8OG8A,$ E:E9 2; 3O- 7A:E *EE9 AD:2SED O; T7E POSS2*2L2T3 O; S-"7 DA,AGES$ O8 ;O8 A93 "LA2, *3 A93 OT7E8 PA8T3
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
iii
i.
0-
Opti o n a A2t o m a t i c a ! Contr o e d S e e c t i o n ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0; >a 7 e n a 2 e r F " Gro2 pi n g Gen e t i c A gori t h m Repr e " e n t a t i o n an d Op er a t o r " #GGA$ .. 08 Thre a d e d GALOPPS .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 08 S2 b p o p 2 a t i o n 4 Le& e In& er " i o n Op er a t o r an d Re a t e d S2 p p o r t .... . . . . . . . . . . . . . . . . . . . . . . . . 08 %2 tip e Repr e " e n t a t i o n " 44 Diff er e n t Rep for /ach S2 b p o p 2 a t i o n . . . . . . . . . . . . . . . . . . . . . . . *3 Com m a n d Line Para m e t e r O&erri d e " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *3 Addi ti o n a S e e c t i o n %et h o d " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *( Sto c h a " t i c Uni& e r " a Sa m p i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *( Line ar Ran7i n g ' >o o A e d b! SUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *( Repr e " e n t i n g Non 4 =in ar! Chro m o " o m e " #A p h a b e t Siz e G 0$. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *0 Re " tr 2 c t 2 r i n g an d Addi ti o n of %ore Cro" " o & e r Op er a t o r " for "?a 2 e4 =a" e d " Prob e m " .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ** SiE Op er a t o r " an d Oth er Too " Add e d for So 2 ti o n of Ord er4 =a" e d #or Per m 2 t a t i o n 4 T!p e $ Prob e m " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ** B2i e t %od e ' for Red 2 c e d O2tp 2 t 2n d e r App Contr o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *+ Ne A >itn e " " Sca i n g %et h o d " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *+ 6ind o A Sca i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *+ Line ar Sca i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ** Si g m a Tr2n c a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *+ Opti o n a / iti" m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *, Too " for %oni t o ri n g Con& e r g e n c e of Pop 2 a t i o n " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *, Perc e n t a g e of On e " at /ach Loc2 " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *, %ea " 2 r e m e n t of Re" e m b a n c e to =e " t Indi&i d 2 a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *, De1on g 4 St! e CroA d i n g ' ... Rep a c e m e n t ' Nich e >or m a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *Inc e " t Red 2 c t i o n 44 A >or m of %ati n g Re " tri c ti o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */nrich e d App i c a t i o n 4 De p e n d e n t Ca b a c 7 >2n c ti o n " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *; .i
Op er a t o r U"a g e A2t o m a t i c a ! Doc 2 m e n t e d to O2tp 2 t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *; U" er4 S2 p p i e d Initia iz a ti o n of Pop 2 a t i o n " an d Po " t 4 Initi a iz a ti o n "C ea n 2 p" S2 p p o r t e d ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *; Opti o n to Co2 n t an d Red 2 c e ObHe c ti & e >2n c ti o n Ca ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *; %igra ti o n Cap a b i i ti e " Sig n i fi c a n t ! /nh a n c e d an d %2 tip e Repr e " e n t a t i o n " S2 p p o r t e d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *8 Che c 7 p o i n t an d Re " t a r t Cap a b i i t ! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *) N/6 >OR%AT >OR INPUT >IL/S... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sa m p e of Opti o n a Inp2 t >i e >or m a t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sp e c i fi c a t i o n " for Inp2 t >i e " 44 for On e p o p an d %an ! p o p " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . /Ep a n a t i o n of Inp2 t for a %an ! p o p " R2n.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . *) +3 +( +*
ISLAND PARALL/LIS% 44 GALOPPS5%AN<PO PS >OR SI%ULATION O> %ULTIPL/ SU=PO PULATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ++ Prin ci p e " of GALOPPS5% a n ! p o p " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +, Gen e r a >or m a t for a %a" t e r >i e. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +RUNNING %AN<POPS ON %ULTIPL/ PROC/S SORS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +; N/6 /IA%PL/ PRO=L/% >IL/S... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +8 Appro ! r d . c 44 9o an d J " Ro!a Roa d Prob e m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +8 App 3 t o ) . c 44 A Non4 =in ar! A ph a b e t De m o n " t r a t i o n Prob e m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +) App b t " p . c 44 = ind Tra& e i n g Sa e " m a n Prob e m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +) App d e m o i . c 44 De m o Pro b e m for In&er " i o n Op er a t o r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +) App difr p . c 44 De m o Prob e m for Diff er e n t Repr e " e n t a t i o n " an d InHec ti o n Archit e c t 2 r e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +) App b p p . c 44 De m o of GGA Repr e " e n t a t i o n for =in Pac7i n g Prob e m .... . . . . . . . . . . . . . . . . . . +) App E E E E E . c 44 "= an7" Te m p a t e for De& e o p m e n t
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
.ii
,3
CONT/NTS O> US/RJS APPLICATION4 SP/CI>IC >IL/ #APPE E E E E .C $ . . . . . . . . . . . . . . . . . . . ,3 COD/ DISTRI=UTION >OR%AT.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ,8 9oA to Pre p a r e th e GALOPP S! " t e m for So &i n g <OUR Prob e m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -3 Comp i i n g 5Li n 7i n g th e S! " t e m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -( %od 2 e " to Comp i e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -( UPDAT/S AND =UG R/PORTING.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -*
APP/NDIC/S
APP/NDII ON/ 44 AUIILIAR< >IL/S Li"ti n g of A A2Ei iar! >i e " Pro&i d e d Aith th e GALOPP S! " t e m ' Re e a " e *. 3 ' b! th e Prob e m >i e " The! Acc o m p a n ! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-+
APP/NDII T6O 44 CONT/NTS O> T9/ >IL/ T<P/S 6RITT/N =< GALOPPS . . . -8 APP/NDII T9R// 44 /IC/RPTS >RO% SGA4 C ?(. ( R/L/AS/ DOCU%/NT.. . . . . . ;+
.iii
AN INTRODUCTION TO GALOPPS
The "Gen e t i c ALgorit h m Opti m i z e d for Port a b i i t ! an d Para e i " m " S! " t e m
DISCLAI%/R NOTIC/@
,odification s$ e5t e n si o n s$ enh a n c e m e n t s $ reim pl e m e n t a t i o n s $ etc $ of all prec e di n g cod e from 4hich this syst e m is deri.e d are the sole resp o n si bility of Erik D Good m a n $ Profess o r and Director$ "ase "ent er for "om p +t e rA Aided Engin e e ri n g and ,an+fa ct +ri n g$ and m e m b e r of the Gen etic Algorith m s 8ese a r c h and Application s Gro+p$ ,ichiga n Stat e -ni.ersit yB and absol +t el y no claim is m a d e as to the correct n e s s $ fitnes s or merc h a n t a b ility of this cod e or the code on 4hich it is bas e d $ or the acc+r a c y of the acco m p a n yi n g doc+ m e n t a t i o n $ for any p+rpo s e s 4hat s o e . e r =hile the a+t h or 4ill be plea s e d to rec ei. e inform a tio n rega r di n g any b+gs disco. e r e d $ and ma y$ at his option$ choos e to rele a s e re.is e d .ersion s of the cod e rep airin g s+ch b+gs$ no promi s e or 4arra n t y is m a d e that s+ch b+gs 4ill be fi5ed A 2" e of thi " co d e an d do c 2 m e n t a t i o n i" at th e "o e ri"7 of th e 2" e r . This code$ like the original SGAA"$ is distrib+t e d +nd er the term s describ e d in the acco m p a n yi n g file "9O=A88A9"$ in accord a n c e 4ith the g+id elin e s of the G9- Gen er al P+blic Licens e That m e a n " th a t thi " co d e ha " ab " o 2 t e ! NO 6ARRANT< imp i e d or gi& e n ' an d th a t th e a2 t h o r a" " 2 m e " no iabi it! for an ! da m a g e re " 2 ti n g fro m it" 2" e or mi " 2 " e . The cont e n t s of the 9O=A88A9 files for bot h GALOPPS and the origin al SGAA" cod e are also print e d for yo+r con. e ni e n c e on the seco n d pag e of this doc+ m e n t A copy of the G9- P+blic Licens e is a.ailabl e in s+b dire ct o r y docs$ in file "licen s e " This 6ARNING is inten d e d to be 8EALC the ma n y feat +r e s of GALOPPS m e a n s that ther e are m a n y possi bl e com bi n a ti o n s of feat +r e s 4hich m ay ne. er ha. e be e n test e d$ or 4hich m ay cont ai n b+gs 4hich 4ere not disco. er e d e.e n tho+ g h they affect e d test r+ns At eac h ne4 rele a s e $ b+gs in form er rele a s e s ha. e bee n fo+nd !and correct e d #$ and the "last" b+g 4ill prob a bl y ne. er be fo+nd As 4ith any GA cod e$ the things can ap p e a r to 4ork 4hile doing som e t hi n g D+it e differe n t from 4hat 4as inten d e d *efore in.estin g large am o + n t s of tim e and1or reso+r c e s in application s bas e d on this !or$ the a+t hor belie. e s$ A93# GA code$ the +ser sho+l d :E82;3 the correct n e s s of the oper a ti o n s 4ith the feat +r e s select e d The a+t h or fo+nd se. er al significan t b+gs$ for e5a m pl e$ in the origin al SGAA" cod e from 4hich this soft4ar e 4as initiat e d $ e.e n tho+ g h that cod e has be e n a.ailabl e for se. er al year s
ACCNO6L/DG%/NTS@
The a+t h or 4ish e s to ackno4l e d g e the contrib+tio n s of ,r =ang Gang$ gra d + a t e st+d e n t $ *eiEing -ni.ersit y of Aeron a + ti cs and Astron a + tic s$ to the 4riting of the F"F cod e for som e of the modificatio n s and e5t e n si o n s of this syst e m $ and tha nk s him for help in deb + g gi n g of som e of the a+t h orF s code$ as 4ell$ thro+ g h 8ele a s e 0 G( of the ESGA12PGA syst e m The a+t h or 4o+ld like to tha nk Prof Hohn 7olland for introd+ ci n g him to the conc e p t s of gen e ti c algorit h m s $ in the Logic of "om p +t e r s Gro+p at the -ni.ersit y of ,ichiga n$ %&)/ A %&I %$ and for s+cc e s sf +lly introd + ci n g gen e tic algorith m s to the 4orld The a+t h or is grat ef+l to *eiEing -ni.ersit y of Aeron a + ti cs and Astron a + tic s$ *eiEing$ "hina$ and to Prof Li =ei and oth er fac+lty m e m b e r s of the Depart m e n t of "omp + t e r Scienc e for pro.idin g him an e5cell en t en.iron m e n t and facilities for +se d+ring his sab b a ti c al lea. e$ Sept e m b e r $ %&&6 A ;ebr+ a r y$ %&&'$ d+ring 4hich tim e he beg a n the de. el o p m e n t of this
syst e m Speci al tha nk s are d+e to the a+t h orF s collea g + e and friend$ Prof Pei ,in$ "ollege of A+tom a ti o n Engine e ri n g$ *eiEing -nion -ni.ersit y$ for his gre a t help in makin g the stay in "hina both prod+ c ti. e and enEoya bl e The a+t h or thank s the me m b e r s of ,S-Fs Gen e tic Algorith m s 8ese a r c h and Application s Gro+p !GA8AGe#$ and esp e ci ally *ill P+nch$ Assoc Prof$ "om p +t e r Scienc e $ and "oA Direct or of the GA8AGe$ for ad.ic e and assist a n c e
4ith the pack a gi n g$ benc h m a r ki n g$ profiling$ and other impro. e m e n t s m a d e in :ersion s 0 G( and beyo n d *ill<s persist e n c e in gettin g the dEgp p <"< com pil er pack a g e d +p for distrib+tion 4ith P" .ersion s of GALOPPS and lilgp has bee n a gre a t help The a+t h or also appr e ci a t e s the helpf+l s+gg e s t i o n s m a d e by m e m b e r s of "om p +t e r Scienc e &'% !Gen e tic Algorith m s# ta+g h t by *ill P +nch in the fall se m e s t e r $ %&& '$ and esp e ci ally thank s Dan H+dd$ 4ho f+rnish e d cod e for fo+r of DeHong<s classic al GA test f+nction s and report e d se. er al b+gs The a+t h or thank s Prof 8ich Enbod y !"om p + t e r Scienc e # and his class$ 4ho did P:, par allel imple m e n t a t i o n s of GALOPPS and 4rot e -ni5A bas e d gra p hi c al +ser interfac e s for the syst e m in fall se m e s t e r $ %&&'B Prof Enbod y and :era *akic $ 4ho de. elo p e d a P:, imple m e n t a t i o n of GALOPPS6 G for a ,PP !or distrib+t e d 4orkst a ti o n net4ork# The a+t hor is grat ef +l to *rian J+la4inski$ 4ho acti.ely e5plor e d and e5t e n d e d GALOPPS in the are a s of sch e d +lin g !and bin packin g#$ and imple m e n t e d the GGA !in.e nt e d by Ema n + el ;alken a + e r # +nd e r GALOPPS The a+t h or thank s Leslie Thom a s =all 7opp e n s t e a d t $ 4ho gre a tl y impro. e d the checkp oi nt file han dlin g proc e s s in 8elea s e 6 G$ and 4ho b+ilt in the com m a n d line para m e t e r o.errid e s $ +sing cod e 4ritt e n origin ally for lilgp !anot h e r prod+ c t of the ,S- GA8AGe# by Do+g Jongk e r Leslie 7opp e n s t e a d t also re.is e d m+c h of the code for readi n g inp+t s 3izhen g ;eng$ 4ith the assist a n c e of Prof ,in Pei$ 4rot e the ne4 Tcl1TkA bas e d Graphic al -ser 2nterfac e for GALOPPS 6 0 !-ni5 distrib+tion#
=ACCGROUND IN>OR%ATION@
This soft4ar e 4as de. el o p e d from the startin g fram e 4 o rk of the Simple Gen e tic Algorith m !SGA# syst e m describ e d in Da.id Goldb er gF s book$ Genetic Algorithms in Search, Optimization, and Machine Learning$ AddisonA =esley$ 8eadin g$ ,ass $ -SA$ %&/ & This 4as don e in order that the begin n e r to gen e tic algorith m s can rea d Goldb er gF s s+p er b description of the theor y and orga niz a ti on of a gen e ti c algorit h m $ and +nd e r s t a n d the cod e in his book$ as a ste p pi n g ston e to +nd er s t a n d i n g the mor e com pl e5 and po4erf+l str+ct +r e of the GALOPP Syst e m The code has be e n e5t e n d e d m a n y fold from the origin al SGA4 C #d o c 2 m e n t e d in
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
App e n d i E Thre e of thi " ma n 2 a $ $ and ma n y section s ha. e be e n re4ritt e n for gre a t e r efficienc y !spe e d #$ b+t the orga niz a ti on of the core GA is par allel to that of the origin al SGA in m a n y resp e c t s ,any of the oper a t o r s$ me a s + r e s $ conc e p t s $ etc $ +se d here and 9OT incl+d e d in SGAA" are define d in "hapt e r s %A ' of Goldb er g<s book 2deas and algorith m s defin e d ther e are 9OT$ in gen e r al$ rep e a t e d in det ail in this g+ide$ so the +ser sho+l d refer to Goldb er g<s book for ans4 e r s to D+e s tion s not fo+nd her e The best 4ay to beco m e familiar 4ith gen e ti c algorit h m s in gen e r al$ and 4ith the SGA orga niz a ti on in partic+l ar$ is to rea d "hapt e r s %A ' of Goldb er gF s book$ perh a p s alon g 4ith se. er al chap t e r s of 7ollan dF s pione e ri n g 4ork$ Adapt a tio n in 9at+r al and Artificial Syst e m s !-, Press$ %&I($ or ,2T Press$ %&&G# !"opies of bot h of the s e books$ and se. er al oth er books and confer e n c e proc e e di n g s $ as 4ell$ are f+rnish e d to all +ni.er sitie s Eoining the 8+ssia n1Am e ric a n Hoint Ed+c ation18 e s e a r c h "onsorti+ m for 2ntellige n t "AD1"A,1"AE and Gen etic Algorith m s !the "2"AD1GA "onsorti+ m "# and to the +ni.er sitie s in "hina collabor a ti n g 4ith the Gen e tic Algorith m s 8ese a r c h and Application s Gro+p of ,ichiga n Stat e -ni.ersity# !All 8+ssi a n m e m b e r s of the GA8AGe also belon g to the 2"AD1GA "onsorti+ m $ b+t not all m e m b e r s of the 2"AD1GA "onsorti+ m are f+nd e d to cond + c t res e a r c h as m e m b e r s of the GA8AGe # The pros p e c ti. e +ser might also 4ant to cons +lt the SGA4 C doc 2 m e n t a t i o n inc 2 d e d a" App e n d i E Thre e of this doc+ m e n t $ in order to se e 4hat 4as don e in transl a ti n g the syst e m from Pasc al to F"F All later enh a n c e m e n t s and e5t e n si o n s are thos e of the a+t h or$ and are describ e d belo4 2n addition to bein g a.ailabl e for anon ym o + s ftp and 4orld4id e 4eb distrib+tion$ this rele a s e is being distrib+t e d to t4o gro+p s of +ni.ersiti esC !%# the 8+ssi a n1Am e ric a n Hoint Ed+ca tio n18 e s e a r c h "onsorti+ m for 2ntellige n t "AD1"A,1"AE and Gen etic Algorith m s$ incl+ding m e m b e r s at ,osco4 Stat e *a+ m a n Techn olo gic al -ni.ersity$ ,osco4 A.iation 2nstit+t e$ 9izhny 9o.goro d Stat e -ni.ersity$ Penz a Stat e -ni.ersity$ the 2nstit+t e of "omp + t a t i o n of the 8+ssia n Acad e m y of Scienc e s$ and Taga nr o g Stat e -ni.ersit y of 8adioe n gi n e e ri n g$ and !0# a consorti+ m of "hine s e +ni.er sitie s cond + c ti n g Eoint res e a r c h on gen e tic algorith m s 4ith the a+t h or and his collea g + e s at ,ichiga n Stat e -ni.ersit y$ incl+ding the *eiEing -ni.ersity of Aeron a + tic s and Astron a + ti cs$ Tsingh + a -ni.ersit y$ JheEian g -ni.ersity$ the Acad e m i a Sinica !"hine s e Acad e m y of Scienc e s#$ and *eiEing -nion -ni.ersit y The soft4ar e is a.aila bl e to oth ers +pon reD+ e s t $ or .ia ano n y m o + s ftp from the archi.e ser. er in the Gen e tic Algorith m s 8ese a r c h and Application s Gro+p !GA8AGe#$ ,ichiga n Stat e -ni.ersity !ftp to isl m s+ e d + $ look in s+bdir ec t or y p+b1GA for the lates t GALOPPS rele a s e in bot h gzipp e d tar form a t and as a direct or y of files =eb +ser s ma y +se 11isl m s + e d + ;or mor e inform a tio n$ cont a c t the a+t h or by em ailC good m a n M e g r m s + e d + The "ase "ent erF s Sist er "ent er in ,osco4$ and 8+ssia n he a d D + a r t e r s for the GA8AGe$ is the A21"AD Labora t or y of ,osco4 Stat e *a+ m a n Techn olo gic al -ni.ersity$ : L -sko.$ Director !em ail +sko.M aic a d i srir m sk s +# Dr -sko. can also pro.id e assist a n c e to +sers or oth er inter e s t e d parti es in 8+ssia and the "2S 8+ssia nA lang+ a g e .ersion s of GALOPPS are also a.aila bl e from the 8+ssia n GA8AGe$ b+t are +s+ ally one rele a s e del aye d from the EnglishA lang+ a g e .ersion
'
P?% GALOPPS Re e a " e *. ( co n ti n 2 e " to b e c2rr e n t DAGA0 44 a 04 e& e ""h or t !". GA ba " e d on GALOPPS 44 Ai b e a& ai a b e
DAGA0 do e " ON4 LIN/ co m p e t i t i o n am o n g m2 ti p e "2 b p o p 2 a t i o n " "o &i n g a prob e m ' 2"i n g diff er e n t cro " " o & e r ' m2 t a t i o n ' " e e c t i o n op e r a t o r " ' diff er e n t repr e " e n t a t i o n " ' diff er e n t op e r a t o r pro b a b i i ti e " ' para m e t e r " ' et c . It 2" e " PROGR/SS in "o &i n g th e prob e m a" th e "fitn e " " f2n c ti o n " for ea c h "2 b p o p 2 a t i o n ' an d g o o d co m b i n a t i o n " of op e r a t o r " ' repr e " e n t a t i o n " ' para m e t e r " ' et c . ' "pr e a d thro 2 g h th e " e t of "2 b p o p 2 a t i o n " &ia g e n e t i c op e r a t i o n " #cro " " o & e r ' m2 t a t i o n ' " e e c t i o n $ tre a ti n g "2 b p o p 2 a t i o n " a" indi&i d 2 a " . DAGA0 can d!n a m i c a ! trac 7 th e "o 2 t i o n pro c e " " ' ch a n g i n g op e r a t o r " an d rat e " a" th e prob e m "o 2 ti o n pro g r e " " e " .
R/L/AS/ 9ISTOR< AND =UG >II/S #/SGA5IPGA 0. 3 3 44G GALOPPS *. 0 $@ GALOPPS *. 0 ' 12 ! (,' () ) Thi" i" a m aHor n e A re e a " e ' Aith " e & e r a ad d e d ca p a b i i ti e " ' an d m a n ! min or impro & e m e n t " to I5O' co m p e t e n e " " of inf or m a t i o n rep or t e d ' an d do c 2 m e n t a t i o n . Prim ar ! n e A ca p a b i i ti e " ar e@ A GRAP9ICAL US/R INT/R>AC/ for UniE 2" e r " ' im p e m e n t e d in Tc 5T7' A hic h a o A " ea " ! ' form 4 fi 4 in dri&in g of On e p o p an d %an ! p o p " ' an d pro&i d e " GRAP9ICAL o2 t p 2 t of 7e! &aria b e " 2n d e r 2" e r con tr o . It a " o a o A " gra p h i c a inp 2 t of migr a t i o n re a ti o n " h i p " in %an ! p o p " ' an d Arit e " 5 r e a d " inp 2 t fi e " co m p a t i b e Aith th e ""ta n d a r d"' no n 4 gra p h i c a 2" e r int erf a c e . S e e th e GARAGe A e b pa g e #ht t p @55i " . m " 2 . e d 2 5 GA $ to do A n o a d it. >2 do c 2 m e n t a t i o n for th e GUI i" "ti in pre p a r a t i o n . A oA i n g 2" e r to d efi n e diff er e n t ALP9A=/T SIL/S #car d i n a i ti e " $ for diff er e n t fie d " ' an d a2 t o m a t i c a ! tre a t i n g th e m corr e c t ! #cro " " o & e r on ! at fie d bo 2 n d a r i e " ' m2 t a t i o n on ! to a o A a b e &a 2 e " $ ' e& e n if "2 b p o p 2 a t i o n 4 e& e in& er " i o n i" in 2" e . To 2" e
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
diff er e n t a p h a b e t "iz e " ' " e t alp h a_ s i z e M ( in th e inp 2 t fi e ' an d "2 p p ! &a 2 e " for arra! fie dN " i z e " O P in f2n c t i o n ap pN " e t N fi e dN " i z e " # $ in th e ap p E E E E E . c fi e . GALOPPS a2 t o m a t i c a ! d e c o d e " th e chro m o " o m e prop e r ! ' an d rem a p " &aria b e 4 en g t h fie d " 2n d e r an in& e r " i o n op e r a t i o n ' an d tran " f o r m " migr a n t " int o th e corr e c t in& e r " i o n pat t e r n #an d fie d bo 2 n d a r i e " $ for th e rec e i & i n g "2 b p o p 2 a t i o n . #Intro d 2 c e d at 2" e r reQ 2 e " t 44 th a n 7 " to Dra g a n Sa&i c at Uni& e r " i t ! of /Ee t e r . $ Intro d 2 c t i o n of a n e A %ULTIN>I/LD %UTATION OP/RATOR. Sin g e fie d #or "in g e 4 bit' for bin ar ! rep " $ m 2 t a t i o n i" &er! in ef f e c t i & e for prob e m " Aith m2 c h "dec e p t i o n" ' an d a "p a t i a ! corr e a t e d m 2 t a t i o n op e r a t o r ' A hic h ca n ch a n g e " e & e r a adHa c e n t fie d " at on c e ' ca n b e h e p f 2 . U" er "p e c i f i e " #in th e inp 2 t fi e $ th e fre Q 2 e n c ! of "2 bH e c t i n g a chro m o " o m e to a m2 ti4 fie d m 2 t a t i o n #pro b a b i i t ! p er chro m o " o m e $ an d #in f2n c ti o n ap pN " e t N o p t i o n " # $ $ th e eEp e c t e d &a 2 e of n2 m b e r of fie d " po " " i b ! a t er e d #thi " m 2 t a t i o n ch a n g e " at RANDO% " o m e fie d " in a co m p 2 t e d ran g e of oci' b2t " o m e m a ! NOT b e a t er e d $ . Intro d 2 c t i o n of =OLTL%ANN SCALING for co n tr o of " e e c t i o n &ia a "in g e para m e t e r ' b e t a . S e t ti n g b e t a to 3. m a7 e " a indi&i d 2 a " eQ 2 a ! i7e ! to b e ch o " e n ' A hi e arg e b e t a " #*' for eE a m p e $ gi& e a m o " t a pro b a b i i t ! of " e e c t i o n to th e m o " t fit indi&i d 2 a . =et A e e n th e eEtr e m e " ' an ! d e " ir e d e& e of " e e c t i o n pre " " 2 r e ca n b e achi e & e d . Optio n a AUTO%ATICALL< CONTROLL/D S/L/CTION. The pio n e e r i n g th e o r e t i c a A or7 in ap p ! i n g "t a t i " t i c a m e c h a n i c " #or m aEi m 2 m en tr o p ! a" " 2 m p t i o n $ to GAF" #" e e Sh a p ir o an d Pr2 e g e 4 =en n e t ' for eE a m p e $ ha " prod 2 c e d a m e t h o d for d! n a m i c a ! con tr o i n g " e e c t i o n " o a" to achi e & e re a ti & e ! hig h rat e " of im pr o & e m e n t of m e a n fitn e " " Aith o 2 t "tr o n g ! red 2 c i n g th e di& e r " i t ! of th e po p 2 a t i o n . A m e t h o d for co n tr o of " e e c t i o n ' 2"i n g d! n a m i c a ! a t er e d =o tz m a n n "c a i n g ' i" pro&i d e d in GALOPPS *. 0 . Intro d 2 c t i o n to GALOPPS of a "p e c i a i z e d repr e " e n t a t i o n an d op e r a t o r " for m a ni p 2 a t i n g it' th e GROUPING G/N/TIC ALGORIT9%. Thi" GGA repr e " e n t a t i o n ' d e & e o p e d b! /man 2 e >a 7 e n a 2 e r ' gr e a t ! en h a n c e " p erf or m a n c e of a GA for att a c 7 i n g m a n ! gro 2 p i n g an d gro 2 p i n g 4 re a t e d pro b e m " ' a" ar e fre Q 2 e n t ! fo2 n d in "c h e d 2 i n g ' partiti o n i n g ' pac7i n g ' an d "im i ar pro b e m " . A prob e m dire c t o r ! ha " an eE a m p e of a GGA prob e m " #for bin pac7i n g $ to g e t h e r Aith th e "p e c i a i z e d
)
Erik D Goodm a n $ GA8AGe$ ,ichiga n State -ni.ersity
op e r a t o r " an d en c o d i n g 5 d e c o d i n g ro2 ti n e " to 2" e th e repr e " e n t a t i o n . It "h o 2 d b e re g a r d e d a" a p h a 4 te " t #e E p e r i m e n t a $ co d e ' b2t i" inc 2 d e d b e c a 2 " e of int e r e " t to " o m e 2" e r " Impro & e d R/PORTING of inp 2 t co n fi g 2 r a t i o n an d int er n a para m e t e r " e t t i n g " ' p 2 " m or e co n & e n i e n t #an d op ti o n a $ prin ti n g of int e g e r fie d " for non 4 bin ar ! pro b e m " . A T9R/AD/D &er " i o n of GALOPPS ' en a b i n g 2" e r " on m 2 ti pr o c e " " o r "! " t e m " to "p e e d 2p th e r2n ni n g of eit h e r On e p o p or %an ! p o p " r2n " ' 2"in g th e p& m "! " t e m ' Aith o 2 t 2" e r int e r & e n t i o n . GALOPPS *. 0 fiEe " a b2 g #in *. 3 an d b e ! o n d $ A hic h did not a o A th e 2" e r to "p e c i f ! an o2 t p 2 t fi e na m e Aith o 2 t a " o "p e c i f ! i n g an inp 2 t fi e na m e . 6hi e thi " m a! repr e " e n t an 2n 2 " 2 a m e t h o d of 2" a g e ' it no A A or7 " corr e c t ! . GALOPPS * . 0 fiEe " a b2 g #in *. 3 an d b e ! o n d $ in th e d e m o i n & eE a m p e ' re " t o ri n g co d e in ap p d e m o i . c A hic h A a " ina d & e r t e n t ! d e e t e d an d A hic h d ef e a t e d th e " e c o n d 4 ord e r " e e c t i o n m e c h a n i " m A hic h th e eE a m p e A a " to d e m o n " t r a t e . GALOPPS *. 3 ( ' *. 3 0 ' A2g 2 " t (' () ) ,
This is a minor b+gAfi5 and doc+mentation impro.ement release The ne4 checkpoint file ro+tines introd+ced in 6 G 4ere fo+nd to interfere 4ith E>TE9D29G of checkpointed Onepop r+ns$ and that is no4 fi5ed in file mainone c 8elease 6 GFs makefiles sho4ed an error !on some systems# beca+se file master c 4as accidentally incl+ded in the compilation 4hen "make Onepop" is typed That has been fi5ed in all of the makefiles in 6 G% A fe4 e5amples of e5tending r+ns ha.e been added to s+bdirectories 4ork and e5amples1app A comment in many of the app files might ha.e misled the +ser into thinking the +ser needed to malloc +tility fields +sed by +serFs application$ so that has been corrected to indicate that GALOPPS a+tomatically mallocs the +tility fields$ so long as the +ser specifies a nonAzero length !bytes# in ro+tine Get-tilitySize!# !in +serFs app55555 c file# The man+al$ g+ide6G% ps$ has been +pdated to incl+de these changes$ and the section on getting started 4ith GALOPPS and 4riting yo+r o4n GALOPPS application ha.e been e5tended and impro.ed 8elease 6 G0 4as a repackaging for P" +sers$ 4ith no e5tended capabilities GALOPPS 6 G is distrib+ted in a ne4 form$ as a directory galopps6 G$ 4ith se.eral s+bdirectories -ni5 +sers may load the tarred$ compressed file P" +sers may +se that if they 4ish$ b+t an !other4ise identical# form is a.ailable 4ith the DOSAtype endAofAline terminations$ 4hich is necessary for some compilers P" !DOS or =indo4s# +sers 4ho 4ant to r+n problems reD+iring more than )'G?*8A, sho+ld also do4nload the dEgpp <"KK< compiler$ a P" port of the G9- gKK compiler$ pro.iding +p to %0/,* of "flat" 8A, and +p to %0/,* of paging disk !4hate.er is a.ailable on yo+r machine# ,akefiles 4hich are +sable by dEgpp are also incl+ded !in both .ersions# !See directions for +se belo4 # 7o4e.er$ for deb+gging ne4 applications$ the +ser may 4ant to +se his1her "+s+al" tools ;or *orland <"< +sers$ some e5ample " prE" files are pro.ided !in the 4orkN s+bdirectory and the e5amplesNappN s+bdirectory *efore compiling 4ith *orland <"<$ be s+re to specify +nder "options" that incl+de files are also located +nder s+bdirectory <galopps6 GNincl+de<$ and 4hen making a ne4 proEect$ the +ser m+st add in the so+rce files from s+bdirectory <galopps6 GNsrc< Specify the problem file<s s+bdirectory as the place to p+t compiled obEects !o+tp+t from compiler#
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
The *eiEing 0 G rele a s e of the ESGA12PGA syst e m $ distrib+t e d on Han+ary 6%$ %&& '$ 4as pre p a r e d d+ring Octob er$ %&& 6 A Han+ar y$ %&& '$ 4hile the a+t h or 4as cond + c ti n g res e a r c h and teac hi n g a gra d + a t e A le.el co+rs e on gen e ti c algorit h m s d+ring his sab b a ti c al lea. e at *eiEing -ni.ersit y of Aeron a + ti cs and Astron a + tic s$ *eiEing$ "hina St+d e n t s in the class +se d part s of this code for sol+tion of probl e m s $ b+t no largeA scal e$ com pr e h e n s i . e test progr a m 4as +nd e rt a k e n Se.er al b+gs 4ere fo+nd and rep air e d in the SGAA" cod e 4hich ser. e d as the startin g point for this de. el o p m e n t !a "st+ck at" fa+lt in the initialization of chro m o s o m e s $ impro p e r rat e and co+ntin g of m+t a tio n s$ and errors in ithr+E0int for readi n g of inte g e r fields from chro m o s o m e s 4ere partic+l arly significan t errors# The *eiEing 0 G% 8elea s e of ESGA12PGA !;ebr+ a r y %)$ %&&'# correct e d not only the b+gs disco. er e d in the origin al SGAA"$ b+t also se. er al b+gs in earlier alph a test rele a s e s of the code from 9o.e m b e r $ %&& 6 A Han+ar y$ %&& ' 2t add e d a print of the rand o m n+ m b e r se e d to the progr a m o+tp +t $ gen e r aliz e d e5a m pl e probl e m app % p e r m c$ and add e d an addition al e5a m pl e probl e m ,od+le s +pd a t e d incl+d e d gen e r a t e c $ report c$ tsel ect c$ mi5e dr e p c$ m as t e r c$ +tility c$ start + p c$ inits+b p c$ rand o m c$ app % p e r m c $ and sgaf+ n c h The e5a m pl e mak efiles for the mi5ed repre s e n t a t i o n files 4ere also modified The ne4 e5 a m pl e file add e d 4as called app % b o t h c 8elea s e 0 G( of ESGA12PGA !s+bs e D + e n t l y ren a m e d GALOPPS 0 G(# correct e d a .ery fe4 addition al b+gs$ m a d e the inp+t file 21O code mor e port a bl e$ pro.id e d som e addition al tools for 4orking on hybrid probl e m s !reord e ri n g1 p a r a m e t e r .al+ e probl e m s #$ and add e d a ne4 m a n +f a c t + ri n g seD + e n ci n g e5 a m pl e probl e m *eside s additions$ se. er al o+t p+ t form a t s 4ere chan g e d in 8elea s e 0 G( 8o+tin e s alter e d incl+d e d C mainp g a c$ mi5t+t or c$ statisti c$ and appr ally c Also$ a ne4 callback !appOn e 4O glob alOb e s tOr e p o r t!## 4as add e d to e.ery appA typ e file and tem pl a t e This 4as inten d e d to mak e it easi er for the +ser to t+rn on "D+iet" mod e$ partic+l arly for par all el r+ns$ and se e o+tp + t only 4hen ne4 glob al best indi.id+ al s are fo+nd$ b+t to be abl e to print o+t 4hat e . e r inform a tio n is desire d !from the ne4 callback# at that tim e$ e.e n if in D+iet mod e GALOPPS0 0G correct e d a se. er e b+g in the option al cro4din g mec h a ni s m 4hich 4as introd + c e d earlier "ro4din g had not be e n test e d e5t e n si. el y$ and did not 4ork prop erl y befor e 8elea s e 0 0G All 21O file form a t s cha n g e d in 0 0G$ d+e to the m a n y addition al feat +r e s introd+ c e d !se e 9e4 ;eat +r e s belo4# GALOPPS0 0( correct e d a serio+ s b+g in migr atio n am o n g s+b p o p +l a ti o n s -sers +sing par all el s+bp o p +l a ti o n s at all 4ere +rge d to go to 0 0($ as the 0 0G .ersion had a serio+ s b+g in migr atio n of indi.id+ al s am o n g s+bp o p +l a ti o n s GALOPPS0 6G incl+d e d se. er al b+g fi5es to the 0 0( rele a s e $ incl+ding a b+g fi5ed in +niform cross o. e r GALOPPS0 6% differe d from 0 6G only in that an addition al +ser callback f+nction$ appOaft e rOra n d o m Oi nit!# 4as add e d to eac h application file$ called from start + p c !Onep o p # and inits+ b p c !,anyp o p s # The +ser 4ho had alre a d y cre at e d ne4 application f+nction s E+st ne e d e d to add a blank !d+m m y# callback to their app c file$ as ill+stra t e d in any of the app files acco m p a n yi n g 0 6% GALOPPS0 60 differe d from 0 6% only in the re4riting of files app m a n s D c to +se a+t o m i5$ and of app m a t c h c and app a + t m 5 c to impro. e their +nd e r s t a n d a b ility Their inp+t files 4ere also a+g m e n t e d 4ith com m e n t s abo+ t the a+to mi 5 r+ns 4hich sho+l d prec e d e the m On Oct 0)$ /pm $ 8elea s e 0 60 4as +pd a t e d slightly 4ith correction s to the g+id e s$ slightly impro. e d logic for the "D+iet" mod e printing !at +ser reD+ e s t #$ and correct e d com m e n t s and bett er inp+t files for 6 hybridA type e5 a m pl e files$ app % p e r m c $ app % p o s n c$ and app % b o t h c -sers prep a ri n g their o4n applicatio n files sho+ld not ha. e bee n affect e d by /
Erik D Goodm a n $ GA8AGe$ ,ichiga n State -ni.ersity
any of the s e cha n g e s $ e5c e p t to se e slightly mor e o+tp +t than befor e 4he n "D+iet" is set to % or 0 2n GALOPPS0 6($ a b+g in cross o. e r rat e$ 4he n cro4ding is +se d$ 4as fi5ed Se.er al oth er sm all probl e m s 4ere rem e di e d $ in files m ain m a n y c$ check4t c$ checkrd c$ gen e r a t e c$ rand o m c$ sga p + r e h $ and 0'int o / m s t Progr a m inp+t 4as reorg a niz e d The seD + e n c e in 4hich inp+t s are reD+ e s t e d $ by bot h Onepo p and ,anypo p s$ 4as orga niz e d mor e ration ally Especi ally in ,anyp o p s $ any inp+t s 4hich can n o t differ am o n g s+b p o p +l a ti o n s are no4 reD+ e s t e d only once$ and +se d for all s+b p o p +l a tio n s "o4n e d" by the proc e s s The entry of rand o m n+ m b e r se e d s for the seco n d and later s+bp o p +l a ti o n s $ 4hich 4ere not$ in fact$ +se d$ is no longer nec e s s a r y This reorg a ni z a tio n allo4e d a ne4$ sim pl er description of the inp+t files !in inte m pl a o n e and inte m pl a m a n # $ b+t alter e d ALL sa m pl e inp+t files$ the " h" files$ and all sa m pl e applicatio n files$ as 4ell as the cont e n t s 4ritt e n to the check p oi n t he a d e r file "heckp oi nt hea d e r files 4ritt e n by older .ersion s of GALOPPS can n o t be read by 8elea s e 0 6( 2n GALOPPS0 6($ +serA cre at e d app files reD+ir e alter a tio n of only the initialization portions !addition of a par a m e t e r to appOinit!#$ and addi n g of "blank" f+nction s appO+s e rOinitOpop!# and appOaft erOr a n d o m Oi nit!# to the app files# GALOPPS0 6) fi5ed a sm all n+ m b e r of b+gs fo+nd in 0 6($ ha.in g to do 4ith +niform cross o. e r e.al + a ti o n co+nti n g$ crosso . e r rat e s 4hen cro4din g 4as +se d$ a bad .al+e in an e5a m pl e mst file$ and som e irreg+l aritie s 4ith glob al par a m e t e r s +nd er cert ai n rest a rt condition s$ 4hich reD+ire d a sm all chan g e to the check p oi nt he a d e r files ! ckp# Therefor e$ pre.io+ s checkp oi nt files are not com p a ti bl e 4ith thos e of 8elea s e 0 6) and beyo n d GALOPPS0 6I cont ai n e d a fe4 b+g fi5es to 8ele a s e 0 6)$ incl+din g t4o to the appO+s e rOinitOpop feat +r e add e d at 8elea s e 0 6($ one in.ol.ing file locking 4he n m+ltiple proc e s s e s or m ac hi n e s are +se d$ one som e ti m e s ca+si n g fa+lty initialization of the glob al stt file$ and one affecting dyn a m i c resizing of pop+l atio n s The order of readi n g checkp oi ntfilepr efi5 and rest a rtfilepr efi5 in Onepo p has be e n re.ise d to m at c h that of ,anypo p s 8elea s e 6 G cont ai n s m a n y enh a n c e m e n t s ;ile locking has bee n gre a tly sim plified from the +ser pers p e c ti. eC only the glob al statistics file still has a com p a ni o n locking file$ z stt The ckp and ind files are no4 "selfA locking"$ and m+ltiA pop +l a tion r+ns on m+ltiple proc e s s o r s ma y be r+n 4itho+t the progr a m crea ti n g m a n y z lock files The str+ct +r e of the com m a n d line in.oking the progr a m has be e n enh a n c e d The !option al# inp+t file na m e is no4 prec e d e d by Ai $ o+t p+ t file na m e by Ao $ etc Other para m e t e r s ma y no4 be O:E882DDE9 for the r+n by specifyin g their .al+e s !for all s+b p o p s or only one# on the com m a n d line !se e description of this feat +r e# The addition of option al in.ersion for +se 4ith all b+t per m + t a t i o n repre s e n t a t i o n s me a n s that if <per m p r o bl e m < is false$ the inp+t file m+st cont ai n the prob a bility !per gen e r a ti o n# of in.ersion$ as describ e d belo4 +nd e r 9e4 ;eat +r e s ,+ltiple s+bp o p +l a ti o n r+ns !on O9E proc e s s o r or on ma n y# no4 allo4 eac h s+b p o p +l a tio n to +se a differe n t repr e s e n t a t i o n for the probl e m sol+tionsB the +ser m+st only s+p ply <"< cod e to m a p from thos e repre s e n t a t i o n s to the "sta n d a r d " one +se d in the fitne s s f+nction$ and to m a p migr a n t s from one repr e s e n t a t i o n to any oth er to 4hich migr atio n 4ill occ+r Since n+m b e r of fields$ alph aOsiz e$ and choice of rando m or s+p e r + nifor m initialization m ay no4 cha n g e from one s+b p o p +l a tio n to anot h e r !e.e n 4ithin the sa m e proc e s s #$ the order of the inp+t inform a ti o n had to be chan g e d $ so all in files 4ere re.is e d to reflect this chan g e !a t5t file in the distrib+tion tells ho4 to +pd a t e any e5isting application s yo+ m ay ha. e 4ritt en to com ply 4ith the ne4 inp+t file str+ct +r e # Doc+ m e n t a t i o n in the code is impro. e d$ as is this +ser g+ide The -SE8$ in the app code$ m+st pro.id e any "met aA le.el" cod e to control the in.ersion rat e$ in order$ for e5a m pl e$ to allo4 com p e t ition am o n g s+b p o p +l a tio n s +sing
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
&
differe n t in.ersion patt er n s A simpl e e5a m pl e of a met h o d to do that is pro.id e d in direct ory e5a m pl e s 1 d e m o i n . If yo u ha v e b e g u n usi n g an y of th e ea rli e r rel e a s e s $ the a+t h or +rge s yo+ to con. ert to the lates t rele a s e The ne4 e s t rele a s e has bee n test e d more thoro + g hl y tha n any of the early rele a s e s $ som e of 4hich 4ere interi m de. el o p m e n t rele a s e s only The cap a bilities of 8elea s e 6 G and beyo n d $ and their le.el of syst e m inde p e n d e n c e and testin g$ are m+c h bett e r than early rele a s e s "on.er sion from a rece n t rele a s e sho+l d in.ol.e only ,29O8 cha n g e s in +serA 4ritt en cod e AA in any app files the +ser has 4ritt en The easi e s t 4ay to find the chan g e s to be m a d e is prob a bl y to diff the app55 555 c file yo+ +se d in crea ti n g yo+r application 4ith the app5 5555 c file in the ne4 rele a s e $ and then m ak e corre s p o n di n g cha n g e s in 3O-8 app file 7o4e. er$ an addition al file$ cha n g e s t 5 t$ doc+ m e n t s the chan g e s to be ma d e in a +ser<s app file from relea s e 6 G5 to 6 0 8elea s e 6 G%$ A+g+st %$ %&&($ is a minor b+gA fi5 relea s e of 6 G$ to rem e d y a probl e m introd + c e d 4hen the 21O syst e m 4as impro. e d The probl e m occ+rr e d if a +ser tried to E>TE9D !rest ar t# a r+n don e +nd e r Onep o p$ and did not occ+r on eith er ordinar y r+ns or +sing e5t e n si o n of ,anyp o p s r+ns An error for com piling Onepo p in the m ak efiles in the e5a m pl e s s+b dire ct o ri e s and 4ork direct ory 4as also correct e d !file m as t e r c sho+ld 9OT be linked for com piling Onep o p $ to a.oid a m+ltipl e definition error# -sers not +sing Onep o p ne e d not inst all 8ele a s e 6 G%$ altho+ g h it doe s also incl+d e thre e addition al e5a m pl e inp+t files ill+stra tin g e5t e n si o n s of r+ns$ and a fe4 minor correctio n s in this +ser<s m a n + al 2t also clarifies in the com m e n t s in the appP PPPP c files that the +ser nee d 9OT malloc +tility fields they are m alloc<d a+t o m a t i c ally by the syst e m $ +sing the lengt h inform a tio n pro.id e d in the +ser callback Get-tilitySiz e!#
%G
N/6 AND /N9ANC/D CAPA=ILITI/S O> GALOPPS *. 3 >RO% GOLD=/RGFS RSI%PL/ G/N/TIC ALGORIT9%S IN =RI/>@ #NOT/@ >or infor m a t i o n on ho A to g e t "t ar t e d r2nni n g GALOPPS ' " e e th e ne E t " e c t i o n " ' "9oA to Get Start e d R2n ni n g GALOPPS" and "6ritin g <o2r OA n App ic a t i o n ." $ #>or m or e D/TAIL/D de " c r i p t i o n " of th e ne A fe a t 2 r e " cit e d be o A ' " e e th e " e c t i o n "Additi o n a Too " for Traditi o n a Prob e m " " #p. EE$ #>or m or e D/TAIL/D eE p a n a t i o n " of par a e op e r a t i o n #on on e co m p 2 t e r or on m a n ! $ ' " e e th e " e c t i o n " "O&er&i e A of GALOPPS *. 3F " I" an d #Coar " e 4 Grain$ Para e Capa b i iti e " '" ">i e " U" e d in GALOPPS'" an d ">i e " Crea t e d b! GALOPP S! " t e m D2rin g /Eec 2 t i o n" $ . A ter n a t i & e ! ' UniE 2" e r " m a ! " e e th e " e p a r a t e do c 2 m e n t a t i o n an d co d e for P?% GALOPPS or Thre a d e d GALOPPS #on th e GARAGe A e b "it e ' htt p @55i " . m " 2 . e d 2 5 G A $ .
GALOPPS 4as initiat e d from the Simpl e Gen etic Algorith m as describ e d in Goldb er g<s book$ and inherit s som e of its char a c t e ri stics AA for e5a m pl e$ it is g e n e r a t i o n a !i e $ the ne5t gen e r a ti o n is calc+l at e d entirely from the c+rre n t gen e r a ti o n 4itho+t dra4ing indi.id+ al s for bre e di n g from am o n g ne4ly gen e r a t e d offspring# rath er tha n "t e a d ! 4 "t a t e 7o4e. er$ in m a n y oth er 4ays$ it has bee n e5t e n d e d to allo4 "7O2"ES$ som e of 4hich differ from the singl e possi bilities offere d by the original SGA ;or e5 a m pl e $ offspring nee d not replac e only their o4n pare n t s$ etc The +ser sho+l d be familiar 4ith gen e ti c algorit h m s befor e +sing GALOPPS !or any oth er GA 4hich offers ma n y choice s of par a m e t e r s $ m et h o d s $ etc #$ bec a + s e the probl e m A sol.ing ability of the GA often dep e n d s ST8O9GL3 on appro p ri a t e selectio n of$ and har m o niz a tio n am o n g$ the ma n y possibl e repre s e n t a t i o n s $ oper a t o r s$ selectio n m et h o d s $ repl ac e m e n t strat e gi e s $ par a m e t e r setting s$ etc The 2" e r i" co2 n " e e d NOT to 2" e op ti o n a fea t 2 r e " b e ! o n d th e Si m p e GA #for eE a m p e ' cro A d i n g ' inc e " t red 2 c t i o n ' "i g m a tr2 n c a t i o n ' mi gr a t i o n cro A d i n g ' ran74 ba " e d " e e c t i o n ' et c . $ Ait h o 2 t 2n d e r " t a n d i n g Ah a t th e ! do an d Ah e t h e r or not th e ! are ap pr o p ri a t e for th e prob e m th e 2" e r i" "o &i n g . An inap p r o p r i a t e ch oi c e %A<
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
%%
ma 7 e th e "o 2 ti o n m2 c h mor e diffic 2 t ' rath e r th a n ea " i e r . GALOPPS does not decid e on appro pri at e par a m e t e r setting s or oper a t o r s for a partic+l ar config+r a ti o n AA that is +p to the +ser The sa m pl e applicatio n s m er el y 2LL-ST8ATE the +se of .ario+ s feat +r e s $ and A8E 9OT OPT2,2JED for best perfor m a n c e AA rath e r$ +se of .ario+ s feat +r e s is sprinkle d am o n g sa m pl e applicatio n s largel y bas e d on 4hen the feat +r e and the applicatio n 4ere de. el o p e d and +nd e r g oi n g test The a+t h or had no int er e " t in p2r " 2 i n g op ti m a t2ni n g of any partic+l ar sa m pl e application$ b+t rath e r so+ gh t to ill+strat e 4ays in 4hich GALOPPS m ay be +se d ,aEor 4ays in 4hich the c+rre n t syst e m has bee n e5t e n d e d or impro. e d from the SGA as doc+ m e n t e d in Goldb er gF s book !and from the SGAA" .% % .ersion# incl+d e !QQQ indicat e s a cap a bility 9E= in 8ele a s e 6 G A 6 0 0 0( # Other item s 4ere ne4 in 8elea s e s 0 G A
QQQ Added a G8AP72"AL -SE8 29TE8;A"E for -ni5 +ser s$ imple m e n t e d in T"L1T?$ 4hich allo4s eas y$ formA fillAin dri.ing of Onepo p and ,anypo p s$ and pro.id e s G8AP72"AL o+t p+ t of key .aria bl e s +nd er +ser control 2t also allo4s gra p hic al inp+t of migr atio n relation s hi p s in ,anyp o p s $ and 4rites1r e a d s inp+t files com p a ti bl e 4ith the "stan d a r d "$ nonA gra p hi c al +ser interfac e As soon as +sers of oth er syst e m s ha. e tcl1tk a.ailabl e on their syst e m s $ they ma y begin +sing this ne4 G-2 QQQ Allo4ing +ser to define differe n t ALP7A*ET S2JES !cardin alities# for differe n t fields$ and a+to m a t i c ally tre ati n g the m correctly !cross o. e r only at field bo+ n d a ri e s$ m+t a ti o n only to allo4a bl e .al+ e s#$ e.e n if s+bp o p +l a ti o nA le.el in.ersion is in +se GALOPPS a+to m a t i c ally rem a p s .ariabl eA lengt h fields +nd e r an in.ersion oper a ti o n$ and tran sfor m s migra n t s into the correct in.ersion patt e r n !and field bo+n d a ri e s # for the rec ei.in g s+b p o p +l a ti o n To +se differe n tA lengt h fields$ simply inp+t alph aOsiz e as % !a flag#$ and specify the desire d alph a b e t size for eac h field in array fieldOsiz esRS$ fo+nd in f+nction appOs e tOfieldOsiz e s!# in all applicatio n !app c$ app % c$ app55 555 c$ etc # files GALOPPS 4ill han dl e the fields a+t o m a t i c ally$ e.e n if they are s+bs e D + e n t l y resh +ffle d by a s+b p o p +l a ti o nA 4ide in.ersion oper a ti o n ,igrating indi.id+ al s are a+t o m a t i c ally tran sl at e d into the form a t of the recei.ing s+b p o p +l a tio n QQQ 2ntrod + cti on of a ne4 ,-LT2O;2ELD ,-TAT2O9 OPE8ATO8 Single field !or singleA bit$ for binary reps# m+t a tio n is .ery ineffecti. e for probl e m s 4ith any "dec e p ti o n"$ and a spati ally correl at e d m+t a tio n oper a t o r$ 4hich can chan g e se. er al adEac e n t fields at once$ can be helpf+l -ser specifies freD+ e n c y of s+bE ectin g a chro m o s o m e to a m+ltiA field m+t a tio n !prob a bility per chro m o s o m e # and the e5p e c t e d .al+e of n+ m b e r of fields possi bly alter e d !this m+t a ti o n cha n g e s at 8A9DO, fields in a com p + t e d rang e of loci$ b+t som e ma y 9OT be alter e d# "+rre ntly$ this oper a t o r is +se d by s+bstit +tin g "m+ltim +t c" for "bitm +t a t c" in the mak efile in the 14ork or 1e5a m pl e s 1P P P direct or y 2n a f+t+re rele a s e $ all oper a t or s 4ill be load e d at com pil e tim e$ and the +ser 4ill select am o n g the m d+ring the r+n$ so that bot h sorts of m+t a tio n co+ld be in +se sim +lt a n e o + s l y Once m+ltim + t c is load e d$ the +ser specifies the a.er a g e 4idth !n+m b e r of fields# to be m+t a t e d at rando m !.al+ e ma y ret+r n to c+rre n t .al+e# as a.gO m + tO4idt h$ a global in appOs e tOo ption a !# in the +ser<s app file The prob a bility of doing a m+ltiA m+t a tio n is specified PE8 "78O,OSO,E$ c+rre n tl y as "pm + t a ti o n" in the norm al inp+t file$ 4hich m+lti m + t c kno4s to interpr e t as a per chro m o s o m e $ not per field$ rat e QQQ 2ntrod + cti on of *OLTJ,A99 S"AL29G for control of selection .ia a single par a m e t e r $ bet a Settin g bet a to G mak e s all indi.id+ al s eD+ ally likely to be chos e n$ 4hile large %0
Erik D Goodm a n $ GA8AGe$ ,ichiga n State -ni.ersity
bet a s !6$ for e5a m pl e# gi.e alm os t all prob a bility of selection to the most fit indi.id+ al *et4e e n the e5tre m e s $ any desire d le.el of selection pres s + r e can be achi e. e d QQQ Option al A-TO,AT2"ALL3 "O9T8OLLED SELE"T2O9 The pion e e ri n g theor e tic al 4ork in applying statistic al m ec h a ni c s !or ma5i m + m entro p y ass+ m p t i o n# to GA<s !see Shapiro and Pr+e g elA *enn e t $ for e5 a m pl e # has prod +c e d a m et h o d for dyn a m i c ally controlling selection so as to achi e. e relati.ely high rat e s of impro. e m e n t of m e a n fitne s s 4itho+t stron gl y red+ci n g the di.ersity of the pop+l a tion A m et h o d for control of selection$ +sing dyn a m i c ally alter e d *oltzm a n n scaling$ is pro.id e d in GALOPPS 6 0 QQQ 2ntrod + cti on of a speci aliz e d repr e s e n t a t i o n and oper a t or s for m a ni p +l a ti n g it$ the G8O-P29G GE9ET2" ALGO82T7, This GGA repr e s e n t a t i o n$ de. el o p e d by Ema n + el ;alken a + e r $ gre a tl y enh a n c e s perfor m a n c e of a GA for att ackin g m a n y gro+pi n g and gro+pi n gA relat e d probl e m s $ as are freD+ e n t l y fo+nd in sch e d +lin g$ partitionin g$ packing$ and similar probl e m s S+bdir ec t or y 1e5a m pl e s 1 GGA has an e5a m pl e of GGA probl e m s !app b p p c for bin packing# toge t h e r 4ith the speci aliz e d oper a t or s and enco di n g1 d e c o di n g ro+tin e s to +se the repr e s e n t a t i o n 2t sho+l d be rega r d e d as alph aA test !e5p e ri m e n t al # code$ b+t is incl+d e d bec a + s e of inter e s t to som e +sers QQQ A T78EADED .ersion of GALOPPS$ en a bling +sers on m+ltiproc e s s o r syst e m s to spe e d +p the r+nnin g of eith er Onep o p or ,anyp o p s r+ns$ +sing the p.m syst e m $ 4itho+t +ser inter. e n ti o n QQQ Setting flag differe n tOr e p s no4 allo4s the +ser to +tilize D2;;E8E9T 8EP8ESE9TAT2O9S of the probl e m in differe n t s+bp o p +l a ti o n s $ by filling in one <"< callback ro+tin e to m a p a chro m o s o m e from an arbitrar y s+b p o p +l a ti o n<s rep to the "sta n d a r d " rep +se d in the obEecti.e !fitnes s# f+nction$ and one ro+tin e to m a p a chro m o s o m e from any s+bp o p +l a ti o n<s rep to any other s+b p o p +l a tio n<s rep to 4hich indi.id+ al s 4ill migr at e !Adde d in 8ele a s e 6 G # QQQ ,igration of indi.id+ al s am o n g s+b p o p +l a ti o n s incl+d e s ma n y options$ incl+din g cro4ding .ers+ s the rec ei.in g pop +l a tion$ incest red+c tion from the donor pop +l a tion agai n st the best indi.id+ al of the rec ei.in g pop +l a tion$ +serA 4ritt en migr atio n code$ and tran sfor m a t i o n of migra n t s from one repr e s e n t a t i o n to anot h e r$ allo4ing the +ser to +se a differe n t repr e s e n t a t i o n for eac h s+b p o p +l a tio n$ if desire d This cap a bility rea dily allo4s for s+ch parallel archit e c t + r e s as the "inEection archit e c t +r e " describ e d in the rec e n t p+blication s of ,S-<s GA8AGe 2t allo4s for incre a si n gl y refine d repr e s e n t a t i o n s on lo4er le.els of a tree of s+b p o p +l a tio n s$ and also allo4s for in.ersio n on the s+b p o p +l a ti o n le.el$ for e5a m pl e QQQ "om m a n d line o.errid e s of all inp+t par a m e t e r s are no4 allo4e d$ m aking it easi er to cond + c t m a n y replicat e d e5p e ri m e n t s chan gi n g only one or a fe4 para m e t e r s or rand o m se e d bet4 e e n r+ns$ 4itho+t ha.in g to gen e r a t e and kee p ma n y differe n t inp+t files QQQ The prelimin ar y checkp oi nt files !s+ffi5es ne4 and ne+# +se d in earlier rele a s e s for locking and sync hro niz a tio n p+rpo s e s are no longer ne e d e d They are replac e d by ne4 ckp and ind files 4hich em ploy alter n a ti n g b+ffers$ and are read14ritt e n 4ith care to pres e r . e file consist e n c y ,+ltipleA proc e s s statistics ! stt# files contin+ e to +se the old locking sch e m e $ as they ha. e m+ltipl e 4riters
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
%6
QQQ 2n.ersion oper a t o r s and asso ci a t e d s+p p ort for in.ersion of entire s+b p o p +l a tio n s are pro.id e d in 6 G !See Addition al Tools for Tradition al Proble m s for more description# QQQ 8epr e s e n t a t i o n of probl e m s in.ol.ing nonA binary alph a b e t s $ +sing ne4 cross o. e r and m+t a tio n oper a t o r s restrict e d to gen e r a ti n g only legal .al+ e s !m+t a ti o n# and crossin g o.er only at bo+n d a ri e s bet4 e e n fields$ and a ne4 initialization ro+tin e to gen e r a t e only legal .al+ e s in s+ch fields Sol+tion of orderA bas e d !per m + t a t i o nA type# probl e m s "ap a bility for sim +l atio n !on one com p + t e r# of inter a c ti n g$ "island" parallel s+b p o p +l a tio n s$ 4ith m a n y met h o d s for interch a n g e migr a n t s "ap a bility for r+nnin g island parallel s+b p o p +l a tio n s on ,-LT2PLE proc e s s o r s !4orkst a tio n s or P"Fs#$ 4ith migr atio n am o n g the s+bp o p +l a ti o n s in the .ario+ s proc e s s o r s $ so long as proc e s s o r s can read14rit e from a com m o n file syst e m "ap a bility for r+nnin g island parallel s+b p o p +l a tio n s +sing ,-LT2PLE proc e s s e s on a singl e 4orkst a tio n$ 4ith migr atio n am o n g the s+b p o p +l a tio n s controlled by the .ario+ s proc e s s e s "om pl et e re4rite s of bitA byA bit m+t a tio n and of +nifor m rando m initialization of binary chro m o s o m e s $ red+ cin g e5ec + tio n tim e s of the s e ro+tin e s %GA 6G fold from SGAA"$ partic+l arly 4he n hard4 a r e floating point is not a.aila bl e 2mpro. e d cap a bility for +serA s+p plied initialization of the pop +l a tion Option al S7O8T form of the "m as t e r" file$ 55555555 m s t $ 4hich specifies for eac h s+b p o p +l a tio n of a ,anypo p s r+n 4hich type s of indi.id+ al are to migra t e in from 4hich oth er s+bp o p +l a ti o n s 2f this migra tion patt er n is to be the SA,E !relati.e to the positions of neigh b or s# for all s+b p o p +l a ti o n s $ then the +ser ma y no4 specify it only for s+bp o p +l a ti o n G$ and the progr a m 4ill do corre s p o n di n g migra tion s for all other s+b p o p +l a tio n s Perform a n c e me a s + r e s C onA line$ offA line$ c+rre n t best and best e.er$ all m e a s + r a b l e 4ithin a singl e s+bp o p +l a ti o n$ 4ithin a singl e cycle on one proc e s s o r !or proc e s s $ in a 4orkst a tio n#$ and l+mp e d for all s+b p o p +l a tio n s of a probl e m "on.er g e n c e me a s + ri n g tools$ incl+ding "lost" and "con. er g e d " loci and "perc e n t con. er g e d " for all loci$ pl+s callback f+nction s for ter mi n a ti n g a r+n or reinitializing all or part of a pop+l a tion or s+bp o p +l a ti o n bas e d on its perfor m a n c e or con. er g e n c e me a s + r e s A nonA stan d a r d m e a s + r e of con. er g e n c e bas e d on perc e n t a g e of "good" !abo. e som e sta n d a r dA de.i atio nA bas e d fitnes s c+toff# 4hich are closer to som e other "good" indi.id+ al tha n to the c+rre n t opti m + m indi.id+ al "heckpoi nt and rest a rt cap a bility A A for one pop +l a tion and for m+ltipl e s+bp o p +l a ti o n s Onep o p<s checkp oi ntin g 4as e5t e n d e d in 8ele a s e 6 G to allo4 checkp oi ntin g e.ery k gen e r a ti o n s$ rath er tha n E+st at the end !m a5 g e n # specified by the +ser T4o addition al selectio n m et h o d s C stoch a s tic +ni.ers al sa m plin g$ s+s el e c t c !see *aker$ Proc Seco n d 2"GA#B and linear ranking !se e =hitley# follo4e d by stoch a s ti c +ni.er s al sa m plin g of the res+lting prob a bility distrib+tion
%'
Addition of m a n y more gen e ti c oper a t o r s$ incl+din g t4oA point cross o. e r$ +niform cross o. e r$ +niform orderA bas e d cross o. e r$ cycle crosso . e r$ order cross o. e r$ parti ally m at c h e d crosso . e r !pm5#$ rand o m s+blist scra m bl e m+t a tio n$ t4oA field s4ap m+t a tio n$ and GGA cross o. e r and m+t a tio n The nonA per m + t a ti o n oper a t o r s oper a t e on binary or larger alph a b e t s S+p er + nifor m initialization !option al#$ 4hich !for binary repr e s e n t a t i o n s$ only# g+ar a n t e e s that a pop+l atio n initially cont ai n s ALL of the possi bl e com bi n a ti o n s of lengt h less tha n or eD+ al log 0 !pop+lation size# QQQ A richer callback str+ct +r e for defining +ser applicatio n s 4itho+t nee di n g to alter any of the ro+tin e s of the GALOPPS syst e m $ in the sa m e spirit as the origin al SGA An option al DeHong cro4din gA typ e repl ac e m e n t cap a bility Settin g cro4dingOfact or inp+t toC G in.oke s "kid replac e s par e n t " as in SGAB % ca+ s e s kids to replac e pop+l atio n me m b e r s select e d at +niform rand o m from am o n g thos e alre a d y select e d accor din g to fitnes s for repro d + c tio n and1or s+r.i.al into the ne5t gen e r a ti o n$ and cfT % ca+ s e s kids to replac e most similar !7am mi n g dist a n c e # of cf rand o m l y select e d indi.id+ al s from am o n g thos e alre a d y select e d accor din g to fitnes s for reprod + c tio n and1 or s+r.i.al into the ne5t gen e r a t i o n !DeHong cro4din g# QQQ Option al 2ncest 8ed+ction !only 4hen also +sing DeHongA style cro4din g# helps to pair for crosso . e r chro m o s o m e s 4hich differ significan tly from eac h other$ pres e r .i n g di.ersity$ red+ cin g "4ast e d " crosso . e r s am o n g ne arly identical m at e s $ and helpin g to com bi n e b+ilding blocks for bett e r glob al searc h Option al "elitism" Se.er al fitnes s scaling met h o d s 2mpro. e d "@+iet" mod e oper a tio n$ for red+c e d o+t p+ t +nd e r app control -ser can set "D+iet" inp+t to G !f+ll o+tp +t #$ % !most o+tp +t s+p pr e s s e d #$ 0 !only "milest o n e " o+t p+ t s record e d #$ or 6 !no o+t p +t e5ce p t sa.in g of pop+l atio n s$ statistics in checkp oi nt files# ,any ne4 sa m pl e application s An impro. e d form a t for inp+t of probl e m s from files 8elea s e 0 G and beyo n d allo4e d for an option al key4or d on eac h line in an inp+t file$ allo4ing eas y checkin g for correct n e s s and a+t o m a t i c reportin g of 4hat par a m e t e r the progr a m e5p e c t e d and 4hat it fo+nd 2n 8elea s e 0 0G$ a S7O8T form is also add e d for inp+t to ,anypo p s r+ns$ if the para m e t e r s for all s+b p o p +l a tio n s to be calc+l at e d by one proc e s s !or proc e s s o r# are to be identic al 2n that cas e$ the +ser specifies the m for one pop +l a tion$ and thos e .al+ e s are +se d for all s+b p o p +l a tio n s Only one rand o m n+ m b e r se e d is +se d$ and rand o m n+ m b e r s contin + e in the seD + e n c e det er m i n e d by that se e d thro+ g h o + t all s+bp o p +l a ti o n s han dl e d by the proc e s s A limited cap a bility for "see di n g" of pop+l atio n s !see check p oi n t1r e s t a r t # 9e4 feat +r e s are describ e d in more det ail in later section s of this ma n + al
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
%(
syst e m< s so+rc e cod e lines 4hile deb + g gi n g yo+r application$ t+rn off opti miz ation and t+rn O9 deb + g !Ag option on som e com pil ers$ for e5a m pl e# E5it the m ak efile and type "mak e" This 4ill +se m ak efile to com pile !b+t not link# all of the "core" <"< so+rc e files +se d by GALOPPS applicatio n s Som e com pilers com pl ai n abo+ t not ha.in g linked the progr a m AA T7AT 2S 9O8,AL$ as linking is not desire d as part of the m ak e in 1src ' Select a sa m pl e probl e m !obEecti.e f+nction definition$ etc # to r+n !e5a m pl e probl e m s all ha. e file na m e s 4hich begin 4ith "app" and end in " c"# The tabl e in Appe n di5 One describ e s 4hich inp+t files are to be +se d 4ith 4hich application s$ and specifies any a+5iliary progr a m s 4hich m+st first be b+ilt and r+n to crea t e sa m pl e files specifying probl e m par a m e t e r s and dat a$ etc !if nee d e d # 2nform a ti o n abo+ t .al+ e s to specify 4he n r+nnin g thos e a+5iliary progr a m s for dat a crea tion for the e5 a m pl e inp+t files is in com m e n t s at the top of the inp+t files or in Appen di5 One ( "han g e to direct or y galop p s 6 01 e 5 a m p l e s 1 !4 h a t e . e rO e 5 a m p l eO yo +O4 a n t #1 Edit the option s indicat e d in the m ak efile ther e E+st as abo. e$ and$ if ne e d e d or desire d$ yo+ m ay alter the choice of selection m et h o d$ crosso . e r type$ in.ersio n type$ and m+t a tio n typ e$ to ones also appro pri at e for the probl e m at han d !9ote AA yo+ specify an in.ersio n type in the mak efile e.e n if in.ersio n 4ill not be +se d$ to a.oid a linking probl e m # ) -se "m ak e Onep o p" to com pil e and link the cod e for a singleA pop+l atio n r+n$ prod+ ci n g an mod +l e Onep o p$ or +se "m ak e ,anypo p s" or sim ply "m ak e" to crea t e mod +l e ,anypo p s -sers of dEgp p m+st perfor m an addition al stepC coff0e5 e ,anypo p s or coff0e5 e Onepo p $ 4hich con. ert the o+tp + t of dEgp p into a e5 e file !Altern a ti. el y$ the dEgp p +ser m ay do deb + g gi n g$ etc $ +sing anot h e r dEgpp +tility$ r+n6 0$ 4hich is describ e d in the doc+ m e n t a t i o n incl+d e d 4ith dEgpp # NOT/@ If !o2 Ai r2n GALOPPS fro m th e n e A Grap hi c a U" er Interf a c e #GUI$' !o2 "h o 2 d ha& e do A n o a d e d th e UniE for m of Re e a " e *. 0 an d "h o 2 d fo o A th e in" tr 2 c t i o n " for co m p i i n g an d in& o 7i n g th e GUI at thi " poi n t #" e e fi e Rre a d m e . g 2 i S inc 2 d e d Aith th a t re e a " e $ . It Ai he p !o2 to cre a t e n e A .m " t fi e " for mi gr a ti o n ' d efi n e pro p e r ! for m a t t e d inp 2 t fi e " ' an d Aat c h th e o2 t p 2 t a" !o2 r GALOPPS pro b e m r2n " . I 2f r+nnin g ,anypo p s$ yo+ sho+ld alre a d y ha. e crea t e d a !or +se an e5isting# m as t e r file$ 4ith e5t e n si o n mst !G-2 +ser s are help e d to cre at e it # 2t 4ill tell eac h s+b p o p +l a tio n 4hat its neigh b or s are$ and 4hat to rea d from eac h at the begi n ni n g of eac h cycle ;orm a t of the ma st e r file is describ e d in the section "Gen er al ;orm a t ;or ,ast er ;ile" in this ma n + al / 8+n the e5ec + t a bl e $ 4hich 4ill be called Onepo p or ,anypo p s !;or a listing of com m a n d A line options$ type$ for e5 a m pl e $ an illegal field$ s+ch as ,anypo p s 5$ and the progr a m 4ill echo the legal par a m e t e r s # & Ans4er the D+e s ti on s as they app e a r on the scre e n !At first$ yo+ m ay 4ant to +se sa m pl e inp+t files$ and to look at the o+t p +t in a file See ne5t para gr a p h # ;or det ails on the m e a ni n g s of par a m e t e r s $ cons +lt this ma n + al as nee d e d !se e section "E5plan a ti o n of Para m e t e r s for a ,anyp o p s 8+n$" for e5a m pl e# 2f yo+ are not E>TE9D29G a r+n alre a d y com pl e t e d $ yo+ ma y lea. e rest a rtfilepr efi5 blank !E+st "ret +rn"# 2f yo+ 4ant to pres e r . e the check p oi n tfiles at the end of the r+n$ it is best to specify a prefi5 for their na m e s !a checkp tfilepr efi5$ +p to ) char a c t e r s #
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
%I
!2f desire d$ yo+ m ay rea d the inp+t from a file and record the o+tp +t to a file$ by +sing the "A i inp+tfilen a m e " and1 or "Ao o+t p+ tfilen a m e " options on the line in.oking the progr a m See the section on "9e4 ;orm a t for 2np+t ;iles" for det ails on inp+t$ or sim ply record the inter a c ti. e proce s s to g+ide yo+ in gen e r a ti n g an inp+t file 2f yo+ sprcify the par a m e t e r na m e s in the file$ as reco m m e n d e d !so that a typical line is of the form "pm +t a ti o n W G G("$ for e5 a m pl e #$ then if the progr a m finds som e par a m e t e r na m e other than 4hat it e5p e c t s$ it 4ill tell yo+ 4hat it fo+nd and 4hat it e5p e c t e d $ m aking it ea s y to correct the file 9OTEC 2n GALOPPS 8elea s e 6 G and beyo n d $ 2; 3O- A8E 8EAD29G 29P-T PA8A,ETE8S ;8O, A ;2LE$ yo+ m ay also specify on the com m a n d line the .al+e s of para m e t e r s in the file to be O:E882DDE9 for this r+n GALOPPS 4ill the n ignor e the corres p o n di n g .al+e s in the inp+t file$ and 4ill +se the .al+e s gi.en on the com m a n d line The O-TP-T file 4ill prop e rly doc+ m e n t the act+ al .al+e s +se d ;or the form a t of the com m a n d line$ sim ply type Onep o p AP or ,anyp o p s AP$ and the form a t specificatio n 4ill be echo e d for yo+ The Graphic al -ser 2nterfac e for GALOPPS6 0 elimin a t e s the nee d to crea t e inp+t files and m as t e r files ma n + ally$ allo4ing yo+ inst e a d to fill o+t a form for to specify the inp+t and to m ak e a gra p h specifyin g the e5ch a n g e protoc ol Then the G-2 cre at e s prop e rly form a t t e d inp+t and m as t e r files com p a ti bl e 4ith the e5 a m pl e s incl+d e d here 9OTEC the .al+e s for GA para m e t e r s in the sa m pl e inp+t files are 9OT s+gg e s t e d settin gs for yo+ to +se They m ay not al4ays e.e n be appro p ri a t e for the applicatio n being r+n$ b+t are sim ply choice s 4hich are acc e p t a bl e to the progr a m -se$ for e5a m pl e$ the sch e m a theor e m $ Goldb er g<s rec e n t res+lt s on pop+l atio n sizing$ Sha piro<s res+lt s on selectio n pres s + r e $ yo+r probl e m A specific kno4le d g e $ and testin g to det e r m i n e rea s o n a b l e setting s for the par a m e t e r s 8egar di n g com m + ni c a ti o n s topology for par allel s+bp o p +l a ti o n s $ 2<d reco m m e n d keepi n g the migr atio n rat e s lo4$ bal an ci n g pre m a t + r e "cont a m i n a t i o n" of all s+b p o p +l a tio n s 4ith nonA glob allyA optim al immigr a n t s !red +ci n g glob al searc h effecti. e n e s s AA all s+bp o p +l a ti o n s ten din g to se arc h the sa m e spac e # agai n s t lack of reco m bi n a ti o n of good s+bo p ti m al indi.id+ al s 7ierarc hic al or "tre eA like" com m + ni c a ti o n s$ in 4hich som e "donor" s+bp o p +l a ti o n s recei. e 9O immigr a n t s$ b+t f+rnish "+ncon t a m i n a t e d " migra n t s to other s+b p o p +l a tio n s to4ard the root of the tree$ ha. e be e n fo+nd to be .ery effecti.e for m a n y probl e m s -se yo+r int+ition and obs er. a ti o n of res+lts DonF t +se in.ersio n +nles s yo+ see a clear E+stification for it 2f yo+ +se in.ersion$ yo+ ,-ST s+pply in callback s the logic for selectin g ;O8 or AGA29ST partic+l ar in.ersion ma p s the "bas e " logic E+st keep s in.ertin g s+b p o p +l a tio n s 4ith the specified freD+ e n c y$ rega r dl e s s of ho4 4ell any partic+l ar m a p aids the searc h proc e s s # See e5a m pl e de m oi n. for idea s of ho4 selectio n o.er in.ersion m a p s might be imple m e n t e d 9OTEC GALOPPS< ,A93POPS m ay be r+n on O9E or ,A93 proce s s o r s !4orkst a tio n s$ P"<s$ etc # ;or mor e det ails on r+nnin g ,A93POPS on ,O8E T7A9 O9E P8O"ESSO8$ See the section U8+nnin g ,anypo p s on ,+ltiple Proce s s o r s V
a# ! alpha_siz e W W 0$ per m pro bl e m W W n# A string of nu m fi el d s *2TS$ 4hich the +ser ma y interpr e t in A93 ,A99E8 desire d ! alpha_siz e is set to 0 for binary$ and nu m fi el d s is the n+ m b e r of bits repr e s e n t e d The +ser m ay +se any s+bs e t of the bits to enco d e any .ariabl e desire d$ and the appro pri at e oper a t o r s are oneA point cross o. e r$ t4oA point cross o. e r$ or +nifor m crosso . e r$ and and eith er bit4ise m+t a ti o n or a spati ally correl a t e d m+ltiA bit m+t a ti o n oper a t o r !m+lti m +t c# Any of the ro+tin e s AA ithr+E0int !for se. er al contig+ o + s bits#$ getfield !for any one bit#$ or chro m t oi nt a r r a y !for all of the bits into an array of ints$ one bit per int field# AA ma y be +se d to get the .al+e s from the chro m o s o m e b# ! alpha_siz e T 0$ per m pr o bl e m W W n# A set of nu m fi el d s eD+ alA lengt h integ e r fields$ eac h ran gin g in .al+ e from G to ! alpha_siz e A%#$ eac h of 4hich repr e s e n t s $ directly or indirectly$ the :AL-E of som e .aria bl e Thes e ma y be fetch e d as ints from the chro m o s o m e one at a tim e !+sing getfield# or all at once !+sing chro m t oi n t a r r a y# Addition al f+nction s in file +tility c !for e5 a m pl e $ inde5 t oflo at !## m ay be +se d to con. er t som e or all of the ints into a discre tiz e d set of real n+ m b e r s $ for e5 a m pl e ;or this m et h o d AA that is$ 4he n e . e r alpha_siz e T 0 AA the cross o. e r oper a t o r s 4ill only oper a t e at the bo+n d a ri e s *ET=EE9 fields$ and the m+t a ti o n oper a t or s 4ill gen e r a t e only ints less tha n alpha_siz e The sa m e oper a t o r s as abo. e !one p t 5 c$ t4opt5 c$ or +nif5 cB and bitm + t a t c or m+ltim + t c# are a.aila bl e in GALOPPS for this type of probl e m c# ! alpha_siz e X 0 !typic ally %$ b+t imm a t e ri al#$ per m pro bl e m W W n# !9e4 in GALOPPS 6 0# A set of nu m fi el d s notA nec e s s a rilyA eD+ alA lengt h integ e r fields$ field i rangi n g in .al+ e from G to ! field_size s[i] A %# Each repr e s e n t s $ directly or indirectly$ the :AL-E of som e .aria bl e Their resp e c ti. e sizes !cardin alitie s# are defin e d by the +ser in f+nction appOs e tOfieldOsiz e s!# in the +ser<s app55 555 c file They m ay be fetch e d e5actly as 4he n all are the sa m e lengt h$ one at a tim e !+sing getfield# or all at onc e !+sing chro m t oi n t a r r a y# Addition al f+nctions in file +tility c !for e5a m pl e$ inde5 t oflo at !## m ay be +se d to con. ert som e or all of the ints into a discr etiz e d set of real n+m b e r s $ for e5a m pl e ;or this m et h o d AA that is$ 4he n e . e r alpha_siz e YW 0 AA the cross o. e r oper a t o r s 4ill only oper a t e at the bo+ n d a ri e s *ET=EE9 fields$ and the m+t a tio n oper a t o r s acting on field i 4ill gen e r a t e only ints less than field_size s[i]. The sa m e oper a t o r s as abo. e !one p t 5 c$ t4opt5 c$ or +nif5 cB and bitm + t a t c or m+ltim + t c# are a.aila bl e in GALOPPS for this type of probl e m d# ! per m pr o bl e m W W y# Each of the nu m fi el d s ints in the rang e RG$ nu m fi el d s A%S app e a r s e5actly O9"E on eac h chro m o s o m e $ in any of the nu m fi el d s Y possi bl e arra n g e m e n t s The probl e m is to find 4hich per m + t a t i o n of thes e nu m fi el d s fields prod+ c e s the opti m al .al+ e of the fitne s s f+nction Thes e .al+ e s are con. e ni e n tl y fetch e d eith er one at a tim e !getfield# or all at onc e !chro m t oi nt a rr a y# The appro p ri a t e oper a t o r s to +se for thes e per m + t a t i o nA type or reord e ri n g probl e m s areC one of Z+o b5 c$ pm5 c$ c5 c$ o5 c[ and one of Zs4 a p c$ scra m bl e c [ !all are describ e d in Goldb e r g<s book or in Da.is<s Handb o o k of Gen e tic Algorith m s # Thes e oper a t or s all gen e r a t e only legitim a t e per m + t a ti o n s of the original set of n+ m b e r s RG$ nu m fi el d s A%S 9OTEC 29:E8S2O9 cann o t be +se d for per m + t a t i o n probl e m s $ as it is for rearr a n gi n g chro m o s o m e s in 4hich the order of app e a r a n c e of .al+ e s on the string can be cha n g e d wi t h o u t aff e c t i n g th e fit n e s s Th+s$ per m pr o bl e m W W y defe a t s in.ersion !b+t an in.ersion oper a t o r m+st still be load e d in the mak efile$ in order to satisfy the +n+s e d call in the code# ONC/ <OU 9A?/ D/CID/D 69AT >OR% O> C9RO%OSO%AL R/PR/S/NTATION TO US/' <OU S9OULD@
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
%&
%# "opy the "blank" te m pl a t e app55 555 c in direct or y galop p s 6 01 4 ork to a ne4 filen a m e c of yo+r choice !for e5 a m pl e $ app mi n e c# 0# "reat e a ne4 m ak efile !copyin g an old one$ and insertin g the na m e of the app file to be com pile d and linked on the line begin ni n g "APP W "# for com piling yo+r probl e m 2n the m ak efile$ choos e the type of crosso . e r$ m+t a ti o n$ selection$ and in.ersion oper a t o r s for yo+r probl e m and the repr e s e n t a t i o n yo+ ha. e chos e n 6# Edit yo+r ne4 file$ app mi n e c are to The only things yo+ abs ol+t el y ,-ST do$ for A93 probl e m $
A# specify in f+nction obEf+nc!# 7O= T7E ;2T9ESS is to be calc+l at e d That is$ yo+ m+st m ak e obEf+nc!# into a f+nction 4hich has as dom ai n the chro m o s o m e of an indi.id+ al !"critt erA Tc hro m " is a point er to the chro m o s o m e # $ and as rang e $ its fitne s s !a field called critt erA TinitOfitn e s s in GALOPPS# 2n oth er 4ords$ GALOPPS pass e s to the +ser$ in obEf+nc$ a point er !critter# to the str+ct +r e "indi.id+ al" 4hich defin e s the indi.id+ al to be e.al+ a t e d One field of the indi.id+ al is a point er to its chro m o s o m e The chro m o s o m e is a set of contig+ o + s +nsign e d integ e r s $ the first of 4hich is point e d to by critt erA Tc hr o m !critt er is the local na m e for the indi.id+ al in the pop+l atio n 4hos e fitnes s is no4 being e.al+ a t e d # To defin e this m a p pi n g$ the GALOPP Syst e m incl+d e s se. er al ro+tin e s to help yo+ to "deco d e " the chro m o s o m e into its constit + e n t fields !chro m t oi n t a rr a y$ getfield$ and ithr+E0int AA se e belo4# A of th e " e f2n c ti o n " are in a fi e ca e d 2ti it! . c ' in th e 5"rc dire c t o r ! . 9OTEC 2f yo+ are +sing in.ersio n !pin.ersion T G #$ yo+ "A9 2G9O8E that fact in defining the fitne s s f+nction AA all chro m o s o m e s are te m p or a rily "re m a p p e d " to the "stan d a r d " order +se d in the fitne s s f+nction !as define d a+t o m a t i c ally in the arra yC thisOpo pO m a pOt oOst d# *E;O8E they are pass e d to the fitnes s f+nction obEf+nc!# *# "hoos e the appro p ri a t e or desire d option s for the probl e m $ in f+nction appOs e tOo pti on s!# Thos e incl+d e s+ch flags as 4het h e r the fitne s s f+nction is stoch a s ti c !differe n t .al+ e s 4hen called agai n 4ith sa m e chro m o s o m e # $ 4het h e r yo+ are s+pplyin g yo+r o4n code for migr atio n or for initialization of ne4 indi.id+ al s$ 4het h e r yo+ 4ill +se in.ersion d+ring the r+n$ 4het h e r all s+b p o p +l a tio n s in a ,anypo p s r+n +se the sa m e repr e s e n t a t i o n$ etc 2f yo+ +se .ariabl eA lengt h fields$ yo+ m+st also set fieldOsiz esRS in f+nction appOs e tOfieldOlen g t h s RS *riefly spe a ki n g$ ther e are 6 "families" of ro+tin e s in +tility c a.ailabl e to help yo+ DE"ODE the chro m o s o m e into the set of .aria bl e s it repr e s e n t s for +se in the fitnes s f+nction !and any +serA defin e d o+tp +t f+nctions$ if nee d e d # AA eac h ro+tin e<s "in.ers e " is also pres e n t $ in cas e yo+ also ne e d to "m an +f a c t + r e " chro m o s o m e s 4ith partic+l ar .al+e s ALT/RNATI?/L< $ yo+ m ay "tell" GALOPPS in yo+r inp+t that the chro m o s o m e is E+st a string of nu m fi el d s bits$ and the n +se yo+r O=9 ro+tin e s called from obEf+nc!# to deco d e the chro m o s o m e ho4e. e r yo+ 4ant !9OTEC 9e4 in GALOPPS6 0 AA m a n y of thes e ro+tin e s also e5ist in a seco n d form$ for +se 4hen alpha_siz e X 0 !in this cas e$ the +serA specified field_size s RS !in appOs e tOfieldOsiz e s!## is +se d to det e r m i n e field_len g t h s RS !in bits#$ and the n field_e n d s RS$ the endi n g bit position s of eac h field on the chro m o s o m e # Then$ sinc e the +ser m ay also be +sing in.ersion$ or anot h e r repre s e n t a t i o n in 4hich the fields app e a r in differe n t plac e s or ha. e differe n t lengt h s in differe n t s+bp o p +l a ti o n s $ the +ser m+st also be able to pas s the APP8OP82ATE field_en d s RS array for the s+b p o p +l a tio n in 4hich the indi.id+ al origina t e s to the deco di n g ro+tin e s !getfield$ chro m t oi nt a rr a y# ;or that speci al cas e !4he n differe n tOr e p s is T8-E#$ the +ser sho+l d call$ inst e a d $
0G
getfieldO+n e DOflds!# or chro m t oi nt a r r a yO + n e D Oflds!#$ as ill+strat e d in the e5a m pl e probl e m s diffreps or de m oi n. Thos e ro+tin e s acc e p t a field_e n d s RS array !4hich GALOPPS a+t o m a t i c ally +pd a t e s # for eac h indi.id+ al 4ho is migr ati n g$ and the +ser pro.id e s the cod e to tran sfor m migr a n t s in appOtra n sf or m O mi gr a n t s 4he n e . e r differe n t reps is T8-E b+t -S29GO29:E8S2O9 is ;ALSE !GALOPPS han dl e s the in.ersion cas e a+to m a t i c ally# # The thre e chro m o s o m e deco di n g families "b+ilt in"$ from the most "ato mi c" to the most com p a c t $ areC ithr2H 0i n t #i n t i' int E' 2n "i g n e d int T from $ C Treat s the seD + e n c e of bits in bit positions i thro+ g h E !4her e bits are n+m b e r e d in rang e R%$ lchro m # of the chro m o s o m e point e d to$ as a non n e g a t i . e binary integ e r and p+t s it into an int .ariabl e -sing this f+nction$ the +ser can "deco d e " arbitrary binary strings of .aryin g lengt h s into int .aria bl e s$ any of 4hich ma y then be ma p p e d into real !float or do+bl e# .ariabl e s o.er arbitrary rang e s $ if desire d$ +sing a fe4 lines of <"< code !or pro.id e d f+nction s like inde5 t oflo at !# in file +tility c# -sing this lo4est le.el deco di n g f+nction$ the +ser has ess e n ti ally com pl et e control o.er the deco di n g of the chro m o s o m e at the bit le.el This form of deco di n g is +s+ ally +se d only 4ith "binary" chro m o s o m e s AA i e $ 4he n the inp+t alpha_siz e is set to 0 This ro+tin e is +se d in all thre e of the e5 a m pl e s from Goldb er g<s book$ in s+b dire ct o ri e s app$ app %$ and app 0 /Ea m p e @ int int.alB int.al W ithr+E0int!%$% G$ critt erA Tc hro m #B !This cod e 4o+ld take the .al+ e in bits %A %G of the chro m o s o m e critt erA Tc hro m and p+t it into int.al # g e t f i e d # i n t n ' int nbroffields ' 2n "i g n e d T chro m $ C The chro m o s o m e is al4ays defin e d as a set of n+mfield s fields !binary or larger#$ 4het h e r or not they all ha. e the sa m e lengt h$ and this f+nction m ay be +se d to fetch the cont e n t s of the nth field !G X n X nu m fi el d s #$ 4ith one e5ce p ti o n AA see E>"EPT2O9 in ne5t para gr a p h The +ser specifies nu m fi el d s !and alpha_siz e $ for nonA per m + t a ti o n probl e m s # to GALOPPS as part of the inp+t stre a m $ and then pass e s to getfield!# par a m e t e r s nu m fi el d s and the n+ m b e r of the field 4ant e d$ toget h e r 4ith the point er to the chro m o s o m e !Of co+rs e$ for per m + t a t i o n probl e m s $ nu m fi el d s also det er m i n e s the rang e !and ther efor e size# of eac h field$ sinc e the fields m+st cont ai n all inte g e r s in RG$ nu m fi el d s A%S # 9ote that 4hen e . e r alpha_siz e YW 0 or per m pro bl e m W W y !T8-E#$ GALOPPS cross o. e r oper a t o r s 4ill bre ak the chro m o s o m e only at field bo+ n d a ri e s$ and m+t a tio n s 4ill be perfor m e d so as to gen e r a t e only LEGAL .al+ e s !in rang e RG$ alpha_siz e A%S$ or$ 4hen alph aOsiz e X 0$ in ran g e RG$ field_size s[i] A %S# /Ea m p e @ int int.alB int.al W getfield!I$ n+mfield s$ critterA Tc hr o m # !This cod e 4ill fetch the .al+ e in field I !of nu m fi el d s total# from critt erA Tc hro m $ placing it in int.al # E>"EPT2O9C getfield!# fetch e s fields +sing the glob al arra y field_en d s defin e d for the c+rre n t pop+l atio n !4hich is calc+l at e d by GALOPPS bas e d on +ser inp+t# 7o4e. er$ if the chro m o s o m e to be deco d e d is comin g into this s+b p o p +l a ti o n from anot h e r one or is a sa. e d "best" indi.id+ al$ then if flag differe n t_re p s is set$ the n the array field_e n d s m ay not mat c h the array in +se 4hen the chro m o s o m e 4as e.al+ a t e d To assist 4ith this sit+ atio n$ GALOPPS 6 0 pro.id e s t4o thingsC %# it
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
0%
sa. e s the field_e n d s array 4ith the indi.id+ al s record e d as "best s"$ and 0# it sen d s the field_en d s arra y for the sen di n g pop+l atio n along 4ith any migra n t s sent to anot h e r s+b p o p +l a ti o n 7o4e. er$ to +se that inform a tio n$ the +ser m+st call a s+bstit +t e for getfields!#$ called getfieldsO+n e DOfi elds!#$ +sing the follo4ing formC getfieldsO+ n e DOfield s! n, nu m fi el d s, critter- >chro m , prop er_field_e n d s #B 4her e proper_field_e n d s is repl ac e d by the na m e of the field_en d s arra y in +se !pass e d alon g# 4hen the chro m o s o m e 4as e.al+ a t e d This inform a ti o n$ toget h e r 4ith the store d ma p_t o_st a n d ar d arra y pre. ailing 4hen the chro m o s o m e 4as first e.al+ a t e d $ allo4s a correct interpr e t a t i o n of the chro m o s o m e at a later tim e or 4he n it ent e r s anot h e r s+bp o p +l a ti o n chro m t o i n t a r r a ! # i n t T intarr a y ' 2n "i g n e d T chro m $ C 2f the +ser 4ant s to "+nloa d" the chro m o s o m e into a set of int fields$ the n rath e r than fetchin g eac h field oneA atA aA tim e$ the +ser can pro.id e an array of ints$ and chro m t oi n t a rr a y!# 4ill fill the array 4ith the int .al+ e s cod e d by the fields on the chro m o s o m e 2f alpha_siz e W W 0$ then eac h int 4ill cont ai n G or %B if alpha_siz e T 0$ then the ints 4ill be in the ran g e RG$ alpha_siz e A%S =hen alpha_siz e X 0$ eac h field has its o4n +pp er limit$ field_size s[i]. /Ea m p e @ int arrayR % GSB chro m t oi nt a rr a y! arra , critter- >chro m #B !This cod e plac e s all of the int .al+ e s of critter- >chro m into arra $ con. erti n g the chro m o s o m e $ ess e n ti ally$ from a string of adEac e n t bit fields 4ithin a set of contig+ o + s +nsign e d ints into an arra y of int .al+ e s$ 4hich are easily m a ni p +l a t e d in calc+l ati n g the fitnes s # 9OTEC There is a corre s p o n di n g f+nction$ chro m t oi n t a r r a yO + n e DOfi el ds! arra , critter>chro m , proper_field_e n d s # for +se 4hen alpha_siz e X 0 and differe n t_re p s W W y is in +se 2t perfor m s an al o go + sl y to f+nction getfieldsO+n e DOfi elds!# de5crib e d abo. e <OURNO6NNCOD/#$@ #Ariti n g !o 2r oA n de c o d e r ' if !o2 pref e r $ Tell GALOPPS alpha_siz e is 0 !binary#$ and the chro m o s o m e is nu m fi el d s *2TS long Then yo+ m ay s+p ply yo+r o4n cod e for deco di n g the chro m o s o m e from its set of +nsign e d s into yo+r fields$ or +se any of the thre e calls abo. e to copy the chro m o s o m e into inter m e d i a t e int str+ct +r e s yo+ defin e A93 O; T7E A*O:E ;-9"T2O9S 2S T3P2"ALL3 -SED TO "DE"ODE" T7E "78O,OSO,E ;28ST 29TO A SET O; 29T :A82A*LES T7E9 T7E -SE8 T8A9S;O8,S T7E, 29TO =7ATE:E8 ;O8, 2S 9EEDED 29 T7E ;2T9ESS ;-9"T2O9 !29T$ ;LOAT$ *OOL$ DO-*LE$ O8 =7ATE:E8 2S APP8OP82ATE# 2T 2S -S-ALL3 *EST TO DE"LA8E A93 :A82A*LES 3O- =2LL 9EED TO -SE 29 "AL"-LAT29G ;2T9ESS O8 ;O8 7OLD29G O-TP-T 29;O8,AT2O9 TO *E STAT2" :A82A*LES AT T7E TOP O; 3O-8 APP>>>>> " ;2LE$ O-TS2DE A93 ;-9"T2O9 DE;292T2O9S$ SO T7E3 ,A3 *E -SED ;8O, A93=7E8E =2T729 T7AT ;2LE$ *-T "A99OT 29TE8;E8E =2T7 S2,2LA8L3A9A,ED :A82A*LES ELSE=7E8E 29 GALOPPS SEE )# *ELO= ;O8 ,ET7ODS TO 8EAD 29 APPL2"AT2O9ASPE"2;2" PA8A,ETE8S$ ET" # 9OTE on deco di n g ints to float or do+ bl e .ariabl e sC ther e are m+ltiple 4ays to do this$ and the +ser m ay easily bias the res+lting float .aria bl e$ or ca+ s e the midA rang e .al+ e to be +nat t ai n a bl e $ for e5a m pl e$ if care is not gi.e n rega r di n g the desire d ma p pi n g of bot h end p oi nt s$ 4het h e r the rang e sho+l d ha. e an e.e n or odd n+m b e r of discr et e .al+ e s$ etc The inter e s t e d +ser is referr e d to the disc+ s si o n in the GA Digest d+ring April$ %&&) !appro5 # on this topic
00
'# -sing the deco d e d .ariabl e s$ calc+l at e the fitne s s of this chro m o s o m e $ and plac e that .al+ e in the indi.id+ al<s critt erA TinitOfitne s s This is the "ra4" or "+nsc al e d " fitnes s$ and GALOPPS 4ill +se it to calc+l at e critterA Tfitn e s s $ the "scal e d" fitnes s +se d in selection$ accordi n g to the scaling option s yo+ select in the inp+t file (# Then e5a mi n e the "control .aria bl e s" in f+nction appOs e tOo ption s!# the follo4ingC Ther e$ yo+ select
the e5p e c t e d !a.er a g e # n+m b e r of adEac e n t fields to be set at rando m 4hen m+ltim + t is don e on a chro m o s o m e !occ+rs 4ith prob a bility pm u t a ti o n PE8 "78O,OSO,E 4hen m+ltim + t c is linked in the m ak efile#$ 4het h e r or not to +se elitism !al4ays keep the singl e best indi.id+ al fo+nd#$ 4het h e r or not the fitnes s f+nction is stoch a s tic !or dyn a m i c AA has differe n t .al+e s if called more tha n onc e 4ith the sa m e geno t yp e # !if so$ chro m o s o m e s are reA e.al+ a t e d e.ery gen e r a t i o n$ to "sa m pl e" their a.er a g e .al+ e s#$ +serOs + p pli e dOinitialization !if %$ 3O- m+st s+pply cod e to initialize the pop+l a tion "legally" in ro+tin e appO+s e rOinitOpop!# belo4#$ callOappO+ s e rO do e sO m i gr a ti o n !if %$ 3O- m+st s+p ply the code to migr at e an indi.id+ al am o n g s+b p o p +l a tio n s$ belo4$ in appO+ s e rOdo e sO m i gr a ti o n!##$ !+sing the syst e m A pro.id e d .ersion as a g+ide$ pres + m a b l y# +singOin. er si o n !if %$ the progr a m 4ill +se and report the in.ersio n m a p s$ e.e n if the prob a bility of in.ersion$ pin.ersion$ is c+rre n tly set to G GB if flag +singOin. er si o n is left at its defa +lt !G# .al+e$ it is set a+t o m a t i c ally if yo+ set pin.er sio n T G G at the start of a cycle# Allo4s 3O- to control the in.ersion proc e s s $ s+sp e n di n g in.ersio n in a s+bp o p +l a ti o n by settin g its pin.ersi on to G$ b+t still +sing its c+rre n t in.ersion m a p$ differe n tOr e p s AA a+to m a t i c ally set to % if yo+ are +singOin. er sio nB if yo+ are not +singOin. er si o n$ then 2; yo+ set differe n tOr e p s to %$ 3O- m+st s+pply the cod e to tran sfor m indi.id+ al s$ 4he n they migra t e $ from their repr e s e n t a t i o n in the donor pop +l a tion to their repre s e n t a t i o n in the recipie nt pop+l atio n$ in f+nction appOtra n sf or m O mi gr a n t !# belo4 2n that cas e$ yo+ m+st also s+pply cod e$ in appO+s e rOtr a n sfor mOt oOst d!# belo4$ to transfor m a chro m o s o m e from the c+rre n t s+b p o p +l a tio n<s repre s e n t a t i o n to the "sta n d a r d " repre s e n t a t i o n +se d by the obEecti. e f+nction$ obEf+nc!# 3o+ m ay also look thro+ g h the rem ai n d e r of the app55 555 c file to see som e of the other cap a bilities pro.id e d to yo+ by +se of the callback ro+tin e s 3o+ ma y "clea n +p" the pop +l a tion aft er an initialization$ 4atch for cert ai n criteri a and the n reinitialize or alter s+b p o p +l a tio n s$ o+t p+ t desire d inform a tio n 4he n ne4 glob al best indi.id+ al s are fo+nd$ do printing 4he n in D+iet T G mod e s $ and m a n y oth er things -nless yo+r application reD+ir e s inp+t$ o+t p+ t$ or trackin g of other .ariabl e s$ addition al glob als$ etc $ yo+ nee d not +se the s e other callback f+nction s 2f yo+ m+st do som e of yo+r o4n inp+t$ see )# belo4 2f yo+ 4ant to do som e applicatio nA specific o+tp +t $ see I# belo4 2f yo+r applicatio n m+st pres e r . e cert ai n applicationA specific .aria bl e s 4ith eac h indi.id+ al$ se e the inform a tio n on +sing the +tility field in Goldb er g<s book it is han dl e d similarly her e$ b+t a+t o m a t e d som e 4 h a t 3o+ sim ply ne e d to +se the callback ro+tin e s Get-tilitySize!# and Get,a5-tilitySize!# in yo+r
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
06
app file to tell GALOPPS the n+ m b e r of byt e s of +tility fields eac h indi.id+ al has$ so that it can sa. e the m Then yo+ can "c+t +p" thos e byt e s ho4e. e r yo+ like !+sing a str+ct$ or in som e other fashion# GALOPPS 4ill malloc the m $ record and restor e the m 4hen the pop +l a tion is check p oi n t e d $ etc $ a+to m a t i c ally !See e5a m pl e files app 0 c or appro yr d c for e5a m pl e s of the +se of +tility fields# Other4is e$ proc e e d to /# belo4 )# There are se. er al callback f+nction s in yo+r app c file from 4hich yo+ m ay do an ! inp 2 t of para m e t e r " or dat a yo+ reD+ir e for yo+r application$ dep e n di n g on 4he n yo+ 4ant to read the m in and 4het h e r they sho+ld be reA read 4he n a r+n is e5t e n d e d $ or record e d 4ith eac h s+bp o p +l a ti o n$ etc The most com m o n plac e s to do 21O are in appOre a dO p ro bO p a r a m s $ appOd a t a $ and appOinit Look at eac h for inform a ti o n on 4hich yo+ 4ant to +se !i e $ 4he n it is called# To keep yo+r inp+t consist e n t 4ith the rest of the GALOPPS 21O$ yo+ ma y call f+nction s ffsca nf!#$ in file ffscanf c$ to read one inp+t .al+ e per line 3o+ sho+l d call it to read from the stre a m infp$ 4hich is a+t o m a t i c ally redirect e d to be keyb o a r d or inp+t file$ dep e n di n g on 4hat yo+ specified on the com m a n d line in.oking the GALOPPS r+n See files m aino n e c or m ain m a n y c for e5a m pl e s of calls to ffsca nf!# *y +sing it$ yo+ are allo4e d to !option ally# incl+d e key4ord s on inp+t lines$ E+st as is don e in GALOPPS e5a m pl e inp+t files 3o+ ma y +se ffsca nf c to read float s$ ints$ do+bl e s$ strings$ etc $ E+st as yo+ nor m ally 4o+ld +se fsca nf to do 2f yo+ 4ill do e5t e n si . e inp+t of tab+l ar dat a$ then rea di n g the dat a directly from a dat a file !4ith file na m e rea d +sing ffscanf!#$ for e5a m pl e# is s+gg e s t e d $ as is don e in ma n y e5 a m pl e GALOPPS probl e m s 6h er e to do !o 2r inp 2 t C ap pNr e a d N p r o b N p a r a m " # $ @ This is called onc e$ at the begi n ni n g of any r+n !4het h e r starting a ne4 r+n only from inp+t dat a or e5t e n di n g a pre.io+ s r+n from sa. e d check p oi n t !rest a rt # files 2t is called before the "stan d a r d " inp+t s like nu m fi el d s $ alpha_siz e $ etc $ are read Therefor e$ the +ser can n o t +se this callback to rea d inform a tio n 4hich dep e n d s on thos e .al+e s 2t is +sef+l for rea di n g in tabl e s of para m e t e r s defining the probl e m $ etc 2f Onep o p is +se d$ this ro+tin e is called at the begi n ni n g of eac h 8-9 !One p o p allo4s m+ltipl e r+ns in one "Eob "# -serA define d .al+e s rea d here are +s+ ally define d as static .ariabl e s at the top of the application file$ so their .al+ e s$ onc e rea d in$ are a.ailabl e to all the +serA s+ppli ed ro+tin e s in the file 9ote that they apply to ALL s+b p o p +l a tio n s in ,anyp o p s So long as they are rea d in this callback$ they 4ill be read e.e n 4he n a r+n is E>TE9DED by initiatin g GALOPPS and s+p plyin g sa. e d check p oi nt !rest a rt# files Ther efor e$ par a m e t e r .al+ e s read her e nee d 9OT be 4ritt en to any checkp oi nt file for rest a rti n g 7O=E:E8$ if the +ser 4ant s to SA:E .al+ e s of any of the s e .ariabl e s !if$ for e5 a m pl e they cha n g e d+ring a r+n and capt +r e the STATE of a r+n#$ they can be 4ritt e n to checkp oi nt files cre at e d by eac h s+b p o p +l a ti o n$ by incl+din g 4rites and read s in appO4rit eOckpOh dr!# and appOr e a dOck pOh d r!# Then they 4ill be restor e d by eac h s+b p o p +l a tio n !e.e n D-829G a r+n# at the begi n ni n g of eac h cycle$ to their .al+e s at the end of the pre.io+ s cycle ;O8 T7AT S-*POP-LAT2O9 ap pNd a t a # R/?ISING$@ This is called !perh a p s m+ltipl e tim e s# from t4o plac e s in files inits+ b p c !,anypo p s# or start + p c !One p o p#C 4he n a r+n is initiat e d from the begi n ni n g !no rest a rtfilepr efi5 is gi.en#$ O8 if the +ser E>TE9DS a pre.io+ s r+n$ gi.ing a rest ar tfilepr efi5$ A9D ans4 e r s <y< to the D+e s ti on abo +t re.ising par a m e t e r s This callback is called onc e for EA"7 s+b p o p +l a ti o n$ +nles s the +ser says "y" to the D+e s tion "allOs+b p o p sO + s eO s a m e O p a r a m e t e r s P " 2n that cas e$ it is
0'
called only onc e at the begin ni n g of a r+n !or 4he n a r+n is being E>TE9DED# %# s+bp o pO d a t a calls it 4he n the progr a m is start e d "from scrat c h" 4ith flag 8E:2S29G set to ;ALSE$ telling it that the +ser E+st finishe d s+p plyin g the par a m e t e r s !cross o. e r rat e$ etc # for this s+bp o p +l a ti o n$ and the +ser m ay set any addition al +serA defin e d one s desire d 0# s+bp o pO d a t a calls it 4he n a r+n is being E>TE9DED$ 4ith flag 8E:2S29G set to T8-E$ telling it that the +ser has E+st finish e d re.ising the norm al par a m e t e r s !cross o. e r rat e$ etc # for this s+bp o p +l a ti o n$ and the +ser ,A3 re.is e any addition al ones desire d The +s+ al co+rs e$ +nles s +ser 4ill really cha n g e the m $ is to +se the defa +lt logicC if !8E:2S29G# ret+rnB to a.oid reA rea di n g +serA pro.id e d para m e t e r files$ etc 7O=E:E8$ if the +ser E>TE9Ds a r+n$ s+pplyin g a nonA blank rest a rtfilepr efi5$ and doe s 9OT choos e to re.is e the GA para m e t e r s $ then this is ro+tin e is 9OT called$ SO it is not a good plac e to do inp+t of .aria bl e s that are 9OT pres e r . e d in a checkp oi nt file !se e appOinit belo4$ or appOre a dO p ro bO p a r a m s abo. e for possi bl e plac e s to do the inp+t# ap pNini t # $@ This ro+tin e is called by initialize!# !in file inits+ b p c or start + p c# for EA"7 s+b p o p +l a tio n EA"7 "3"LE$ 4het h e r a ne4 r+n is being start e d $ or e5t e n d e d $ or E+st contin+i n g from the rest a rtfiles$ and 4het h e r allOs+b p o p sO + s eO s a m e O p a r a m e t e r s is T8-E or ;ALSE 2t is called A;TE8 indi.id+ al s are mallocFd and aft er indi.id+ al s are read from the ind file !on a rest ar t#$ b+t befor e rand o m initialization of all indi.id+ al s !if initial start# or of indi.id+ al s 9OT rea d !if rest ar tin g# 2f doing 21O that ne e d s to be don e only O9"E 4he n GALOPPS is start e d !from begi n ni n g1E>TE9D29G or rest ar t#$ the n +ser m ay +se the "firstcall" logic in this ro+tin e to e5ec + t e the inp+t !or other# code only once Other4is e$ it 4ill be don e eac h tim e EA"7 S-*POP-LAT2O9 is initialized or is reloa d e d from its checkp oi nt e d stat e in EA"7 "3"LE I# O+tp+ t m ay be don e +nd e r .aryin g circ+ m s t a n c e s from a n+m b e r of callback ro+tin e s in yo+r app file See thos e callbacks for description s of 4he n they are called 3o+ sho+l d prob a bl y 4rite most o+tp +t +sing file point er o+tfp$ 4hich is the global o+t p +t file descript or +se d by GALOPPS$ 4hich is a+t o m a t i c ally redirect e d if an o+tp +t file na m e is specified on the com m a n d line in.oking GALOPPS /# 2f yo+ +se +tility fields to stor e probl e m A specific addition al inform a ti o n abo+ t eac h indi.id+ al in the pop+l atio n !see Goldb er g<s book for description of this cap a bility$ and application royalrd for an e5a m pl e#$ yo+ m+st also fill in the ro+tin e s Get-tilitySiz e!# and Get,a5-tilitySiz e!# in yo+r app file$ so that the syst e m can m alloc and rea d1 4rit e the correct n+m b e r of byt e s for 4hat e . e r dat a yo+ are storing in the +tility fields &# 2f yo+r probl e m or appro a c h reD+ir e s yo+ to perfor m any oper a ti o n s 9OT pro.id e d in GALOPPS$ or yo+ 4ish to control the r+n a+to m a t i c ally by monitorin g cert ai n par a m e t e r s $ and taking partic+l ar actions 4hen partic+l ar thre s h ol d s are reac h e d $ etc $ it is EAS3 to do =2T7O-T modifyin g the GALOPPS code$ by +sing the m a n y a.ailabl e +ser callback f+nction s in yo+r app file !4hich yo+ m a d e from app55 555 c$ for e5a m pl e# Som e e5 a m pl e s are pro.id e d in the file !com m e n t e d o+t#$ and som e sa m pl e application s cont ai n e5 a m pl e s of the +se of som e of the s e callbacks 3o+ ma y also constr + ct yo+r o4n oper a t or s !crosso . e r$ selection$ m+t a tio n$ in.ersion$ etc # by +sing the "sta n d a r d " oper a t o r s as an
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
0(
e5a m pl e and repl aci n g the m 4ith yo+r o4n file cont ai nin g an oper a t o r 4ith the sa m e calling str+ct +r e %G# "ompile$ link$ and r+n yo+r progr a m $ E+st as yo+ do the e5a m pl e probl e m s %%# /IT/NDING a GALOPPS r2n@ Any GALOPPS r+n !Onep o p or ,anyp o p s # 4hich has termi n a t e d norm ally$ or has com pl et e d ckptfre D gen e r a ti o n s !One p o p# or at least one cycle !,anyp o p s # m ay be E>TE9DED by rest ar tin g GALOPPS and specifying as rest ar tfilepr efi5 the prefi5 +se d as check ptfilepr efi5 d+ring the r+n com pl et e d or interr+ p t e d ;or s+ch a r+n$ the +ser ma y rest a rt 29TE8A"T2:EL3 by typing Onepo p or ,anypo p s$ or ma y s+pply a simpl e inp+t file cont ai nin g the sa m e inform a ti o n "om m a n d A line par a m e t e r setting s can be +se d to o.errid e the inp+t .al+ e s in an inp+t file$ b+t an inp+t file O8 inter a c ti. e inp+t s m+st al4ays be pro.id e d The dat a for the pop +l a tion !or for eac h s+b p o p +l a tio n# is 8ESTO8ED from the rest ar tfiles ! ckp and ind s+ffi5es#$ and$ +nles s modified ne4 com m a n d A line .al+ e s or by ne4 +serA s+p plied inp+t s !if otherOch a n g e s W W yes in the inp+t file or inter a c ti. e dialog#$ the pre.io+ s .al+ e s are +se d 9OTEC it does not m at t e r 4he n in the cycle a r+n is interr+ p t e d AA GALOPPS 4ill al4ays begi n e5t e n di n g the r+n from the last ;-LL "3"LE "O,PLETED !,anyp o p s# or last set of ckptfre D gen e r a t i o n s com pl et e d !One p o p#
specified file 4ith s+ffi5 mst#$ it rea d s one or more indi.id+ al s from eac h of its decl ar e d neigh b o ri n g s+b p o p +l a ti o n s The freD+ e n c y of this interch a n g e is entirely +nd e r +ser control !det e r m i n e d by the n+m b e r of gen e r a t i o n s per cycle$ inde p e n d e n t l y sett a bl e for eac h s+b p o p +l a ti o n# All oth er GAArelat e d inp+t par a m e t e r s !pop +l a tion size$ cross o. e r rat e$ etc # can also be inde p e n d e n t am o n g the .ario+ s s+bp o p +l a ti o n s AA only the com pil eA tim e option s are const r ai n e d to be the sa m e !of co+rs e# in all s+bp o p +l a ti o n s 0# %2 ti p e 4 proc e " " "i m 2 a t e d para e i " m C On a singl e -ni5 4orkst a tio n$ or on any oth er syst e m 4hich allo4s the +ser to r+n more tha n one copy of GALOPPS1,anyp o p s at the sa m e tim e$ 4ith acc e s s to the sa m e file direct ory$ the +ser m ay r+n any n+ m b e r of copie s of GALOPPS at the sa m e tim e$ eac h as a sep a r a t e +ser proc e s s This is partic+l arly +sef+l for deb + g gi n g1 t e s ti n g cod e 4hich 4ill +ltim at el y be r+n on m+ltipl e proc e s s o r s !see belo4# 2t also allo4s differe n t set s of s+b p o p +l a tio n s !o4ne d by differe n t proc e s s e s # to +se differe n t com pileA tim e option s !oper a t o r s$ selection m et h o d s $ etc # AA the +ser ne e d only retitle differe n t U.ersion s V of ,anyp o p s to oth er na m e s before in.oking the m All copie s shar e the +se of a singl e ,ASTE8 file !s+ffi5 mst#$ 4hich tells all the proc e s s e s 4hat m+st be com m + ni c a t e d am o n g the s+b p o p +l a tio n s$ 4het h e r they are 4ithin a proce s s or in sep a r a t e proc e s s e s Each proc e s s$ in the inp+t file it read s$ is told =72"7 S-*POP-LAT2O9S !by n+ m b e r# 2T is respo n si bl e for sim +l ati n g Then thes e proc e s s e s r+n in par allel !of co+rs e $ the OPE8AT29G S3STE, is no4 doing the "check p oi ntin g" or cont e 5 tA s4itching# The oper a ti o n of the s+bp o p +l a ti o n s is 9O LO9GE8 S39"78O9O-S am o n g proc e s s e s $ b+t GALOPPS 4as desi gn e d 4ith this async h r o n y in mind Sim+lt a n e o + s acc e s s to the sa m e file is controlle d by a sim pl e ;ile Locking protoc ol !differe n t from rele a s e s pre.io+ s to 6 G#$ 4hich controls file acce s s and pre. e n t s o.er4riting of inform a ti o n being rea d by anot h e r proc e s s 2n the e.e n t of ma n y cons e c + ti . e fail+res to gain acc e s s to a file to rea d som e t hi n g$ the proc e s s eith er contin+ e s !4ith a not ation to that effect# 4itho+t perfor mi n g that partic+l ar migr atio n !in the e.e n t of migra tion att e m p t s #$ or fails$ if it can n o t contin+ e 4itho+t the file !s+ch as a rest a rt file for one of its o4n s+b p o p +l a tio n s# The abortin g of one proc e s s typically res+lts in "freezin g" of the emigr a n t s it pro.id e s to its neigh b o r s$ b+t doe s not interr+ p t the contin + e d progr e s s of the rem ai ni n g proc e s s e s Acco+nti n g !e g $ reportin g the *EST indi.id+ al fo+nd in A93 s+bp o p +l a ti o n$ or trackin g the n+m b e r of e.al+ a ti o n s perfor m e d in ALL s+b p o p +l a ti o n s befor e a ne4 "best" indi.id+ al 4as fo+nd$ or the "onA line perfor m a n c e " acros s ALL s+b p o p +l a ti o n s $ etc # is mor e diffic+lt in this asyn c h r o n o + s en.iron m e n t GALOPPS doe s this !4hen e . e r a proc e s s does not control ALL of the s+b p o p +l a tio n s in +se# by m aint ai ni n g a file$ 4ith s+ffi5 stt$ 4hich is +pd a t e d by ALL proc e s s o r s and ALL proc e s s e s 4hich are r+nnin g one probl e m !i e $ from one file direct or y +sing one mst file# At the start of eac h cycle$ a proc e s s read s the c+rre n t "glob al" inform a ti o n from the stt file$ and the n +se s thos e .al+ e s for all reportin g it does d+ring the "3"LE !4hich ma y be as short or as long as the +ser set s it to be# Then$ at the end of the cycle$ it locks the stt file$ rea d s the !prob a bl y ne4$ +pd a t e d by oth er proce s s e s or proc e s s o r s# .al+ e s from the file$ +pd a t e s its local copie s$ and 4rites the ne4 "tot als" back to the stt file$ the n +nlocks it Th+s$ =2T729 A "3"LE$ a proc e s s is ignora n t of things 4hich hap p e n e d in OT7E8 proc e s s e s d+ring its cycle$ b+t "catc h e s +p" agai n at the end of the cycle$ and pro.id e s the inform a ti o n 4hich all OT7E8 proce s s e s 4ill nee d to "catc h +p" 4ith 2TS 4ork 4he n e . e r
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
0I
T7E3 ne5t com pl et e a cycle This reportin g is "asym p t o tic ally correct$" and the only impro. e m e n t possi bl e 4o+ld be to do this +pd a ti n g "mor e often$" b+t ho4 often it is don e is +nd er +ser control$ so sho+ld not be an iss+e The 2" e r m2 " t "t ar t th e proc e " " Ahi c h "i m 2 a t e " "2 b p o p 2 a t i o n 3 b ef o r e an ! ot h e r proc e " " e " to allo4 for prop e r zeroin g !at begi n ni n g of r+n# or loading !d+ring a r+n E>TE9S2O9# of the c+m +l a ti. e statistics file !4hich has s+ffi5 stt# 6# "TRU/" para e eE e c 2 t i o n @ Se.er al proc e s s o r s !com p + t e r s # eac h r+n their o4n copy !or copies$ +sing mod e 0# abo. e$ as 4ell# of GALOPPS1,anyp o p s $ eac h sim+l atin g as m a n y s+b p o p +l a tio n s as desire d GALOPPS1,anyp o p s allo4s sim +l atio n of A93 n+ m b e r of s+b p o p +l a tio n s on A93 n+m b e r of proc e s s o r s !act+ ally +p to &&$ 4ith defa +lt file na mi n g con. e n tio n s# Again$ all coop er a ti n g proc e s s o r s m+st shar e a com m o n file direct or y The ,ASTE8 file !s+ffi5 mst# det er m i n e s the neigh b o r s and migra tion s$ 4hich are cond + c t e d async h r o n o + sl y A collection of proc e s s o r s of differe n t spe e d s m ay be +se d$ 4ith the only effect being that the n+m b e r of e.al+ a ti o n s don e to find eac h emi gr a n t 4ill differ stron gly am o n g proc e s s o r s$ +nles s the +ser choos e s to "bal an c e " that by doing less freD+ e n t migra tion from proc e s s o r s 4hich r+n at slo4er spe e d s The glob al statistics file locking m ec h a ni s m 4as describ e d abo. e in 0#$ and is most import a n t 4hen m+ltiple proc e s s o r s are +tilized Acco+ntin g !for e5a m pl e$ n+m b e r of e.al+ a tio n s befor e a ne4 "best" indi.id+ al 4as fo+nd$ onA line perfor m a n c e $ etc # is also don e as describ e d in 0# abo. e Since the par all elis m of GALOPPS is acco m plish e d 4itho+t the ne e d for direct interA proc e s s com m + ni c a ti o n$ it is eas y to r+n tr+ly parallel s+b p o p +l a tio n s e.e n on a n+ m b e r of P"Fs linked by a typical P" net4ork !9o.ell net$ LA9tastic$ Path4orks$ =indo4s 9T$ etc #$ or to r+n sim +l at e d par all el s+b p o p +l a tio n s on a singl e mac hi n e 2t is the sim plicity of this sch e m e 4hich rend e r s it so port a bl e This port a bility 4as a key design goal$ since this soft4ar e 4as de. el o p e d to s+p p ort - S collabor a ti o n 4ith GA res e a r c h e r s in 8+ssia and "hina$ 4her e the typical hard4 a r e a.ailabl e is m+c h more likely to be indi.id+ al or net4ork e d P"<s The GALOPPS code is so port a bl e and syst e m A inde p e n d e n t that par all el s+b p o p +l a tio n s for a gi.en probl e m can be r+n on an arbitrar y mi5t+r e of P"Fs$ 4orkst a tio n s$ or any other com p + t e r sharin g a com m o n file syst e m $ so long as the 4ord lengt h s and byt e order s !bigA endi a n .s littleA endi a n# mat c h !this affect s the form a t of the files they read and 4rite# Any differe n c e s in m ac hi n e spe e d ma y be take n into acco + n t by the +ser$ if desire d$ by assigni n g proc e s s o r s differe n t n+ m b e r s of s+bp o p +l a ti o n s $ or differe n t s+b p o p +l a tio n sizes$ or oth er s+ch decision s$ so as to kee p the e.ol+tion am o n g the s+b p o p +l a tio n s "loosely" in synchr o niz a ti o nB ho4e. e r$ the oper a ti o n of the code doe s not reD+ire that to any e5t e n t The ration al e for doing it is to kee p from "o.er4h el m i n g" the searc h of slo4er proce s s o r s by introd + ci n g to the m "ad. a n c e d " indi.id+ al s from a fast er proc e s s o r$ ther e b y "poisoni n g" their o4n se arc h and likely leadin g to local pre m a t + r e con. er g e n c e 7o4e. er$ a ro+gh bala n ci n g is all that is ne e d e d $ and that can be achi e. e d
0/
#NOT/@ =hen GALOPPS !,anyp o p s # is r+n +sing more tha n O9E proc e s s $ then differe n c e s in timing of migra tion s$ etc $ from proc e s s to proc e s s$ m e a n that choosin g the sa m e SEED for the rand o m n+ m b e r gen e r a t o r 9O LO9GE8 g+ar a n t e e s that the res+lts 4ill be the sa m e This effect is e.e n mor e ob.io+ s 4hen m+ltiple proc e s s o r s are +se d on a singl e probl e m 7o4e. er$ r+nnin g m+ltiple s+b p o p +l a tio n s from a S29GLE proce s s still allo4s reprod + ci n g of the sa m e r+n if the sa m e rando m n+m b e r see d is +se d #
0#
6# '# (#
)#
One p o p @
D+ring e5ec + ti on$ GALOPPS1One p o p crea t e s only !at most# thre e filesC a# The o+t p+ t file specified in a UAo U field of the com m a n d in.oking the Onep o p cod e !if one is gi.e n# This na m e m ay be select e d by the +ser arbitr arily$ so long as it doe s not conflict 4ith any of the na mi n g con. e n tio n s !s+ffi5es# +se d by GALOPPS for other p+rpo s e s $ and so long as the oper a ti n g syst e m 4ill acc e p t it b# The checkp oi nt hea d e r file$ 4hich record s the stat e of the Onep o p progr a m 4hen the specified n+ m b e r of gen e r a ti o n s ha. e bee n com p + t e d 2t has the s+ffi5 " ckp"$
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
0&
c#
and the rest of the na m e is specified by the +ser at r+n tim e !or in the inp+t file$ if +se d$ in the "check ptfilepr efi5" field$ ma5i m + m of / char a c t e r s# The checkp oi nt indi.id+ al s file$ 4hich record s all indi.id+ al s in the pop +l a tion 4hen it is check p oi nt e d 2t has the s+ffi5 " ind"$ and the rest of the na m e is specified by the +ser at r+n tim e !or in the inp+t file$ if +se d$ in the "check ptfilepr efi5" field# Th+s$ for e5 a m pl e $ the +ser 4o+ld end +p 4ith a pair of files called "c%p6 0 0 ck p" and "c%p6 0 0 i n d"$ if the check ptfilepr efi5 "c%p 6 0 0 " 4as specified
*#
=hen e . e r more tha n one proc e s s is 4orking on the sa m e probl e m !i e $ finish po p n u m Astartpo p n u m YW pop no # ,anyp o p s also 4rites a single file called "555555& & s t t "$ 4her e 55555 is the checkp oi ntfilepr efi5 specified by the +ser 2t cont ai n s inform a tio n abo +t ALL s+b p o p +l a ti o n s in the ma st e r file$ regar dl e s s of 4hat proc e s s or proc e s s o r is doing their calc+l ation s 2t is the plac e in 4hich$ at the end of eac h cycle$ eac h proce s s! or# 8EADS the c+rre n t "allA pop+l atio n s" stat e$ incre m e n t s the .aria bl e s by the n+ m b e r s 2T calc+l at e d d+ring its E+stA com pl e t e d cycle$ and then =82TES *A"? to allOpops s t t the ne4 "allA pop +l a tion s" stat e 2nform a ti o n cont ai n e d in the stt file incl+d e s the ra4 tot als ne e d e d to calc+l at e onA line perfor m a n c e $ offAline perfor m a n c e $ and total n+ m b e r of e.al + a ti o n s perfor m e d to dat e$ as 4ell as the geno t yp e of the *EST 29D2:2D-AL fo+nd so far by A93 s+b p o p +l a tio n in any proc e s s! or# Since m+ltipl e proce s s e s are in +se$ this stt file is LO"?ED +sing an a+5iliary lock file$ z55555 && s t t $ 4hich is crea t e d a+t o m a t i c ally by the progr a m =hen a proc e s s 4ant s to +se file abcd ef G G s t t $ for e5a m pl e$ 4hich anot h e r proc e s s or proc e s s o r might also be +sing$ it first checks file zbcd efG G s t t$ a "com p a ni o n" file 2f the z file cont ai n s G$ the file is "+nlocke d " 2f the file cont ai n s anot h e r n+m b e r $ the proc e s s "backs off" a proc e s sA specific and .arying am o + n t of tim e before att e m p ti n g agai n to lock the file =hen trying to lock the file$ the proc e s s ope n s it$ read s it$ and if it is G$ re4inds it$ 4rites the proce s s F s +niD+ e n+ m b e r to it !act+ ally$ the lo4est n+m b e r s+b p o p +l a tio n it "o4ns"$ pl+s one#$ then 8EADS it back 2t perfor m s the read se. er al tim e s !E+st "killing tim e"#$ and if$ at the end$ the n+m b e r it rea d s ,AT"7ES the n+m b e r it =8OTE$ it concl+ d e s that it has "LO"?ED" the file 2t close s the z file$ then ope n s the file abcd ef G G s t t $ doe s any rea di n g or 4riting it likes$ the n close s it 2t ,-ST then -9LO"? the file by ope ni n g the z file and 4riting a G to it Ther e is som e com pl e 5it y in the initial crea tio n !or finding in e5ist e n c e # of the com p a ni o n lock file$ b+t that is han dl e d largely by trying to lock the file$ and if that fails initially$ concl+ din g that the com p a ni o n z file doe s not e5ist$ and crea ti n g it Of co+rs e $ later in the r+n$ the com p a ni o n file ,-ST alre a d y e5ist$ so a fail+re has a differe n t interpr e t a t i o n later in the r+n 2f the allOpops s t t file canFt be locke d for +pd a ti n g$ the +ser is 4arn e d !agai n$ in the o+t p +t stre a m # that all s+bs e D + e n t glob al statistics are prob a bl y corr+p t e d $ b+t the r+n contin+ e s ;or ob.io+s rea s o n s $ the +ser m+st a&oi d specifyin g any file prefi5 begin ni n g 4ith "z" to GALOPPS$ since files starting 4ith "z" cann o t be locke d !and 4ill be destro ye d # by GALOPPS
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
6%
Diff eri n g A ph a b e t Siz e " #>i e d Len g t h " $ @ 8elease 6 0 allo4s the +ser to define different alphabet sizes !cardinalities# for different fields$ and a+tomatically treats them correctly !crosso.er only at field bo+ndaries$ m+tation only to allo4able .al+es#$ e.en if s+bpop+lationA le.el in.ersion is in +se !Of co+rse$ permproblem m+st be \n< for this to be a.ailable # The +ser signals the +se of these +serAdefined field lengths by entering alpha_size as % !or any .al+e X 0# in the inp+t file The +se m+st then set the field sizes in f+nction appOsetOfieldOsizes!# in the +ser<s app55555 c file Then the +ser simply +ses the same tools as al4ays !getfields$ chromtointarray$ for e5ample# to decode the chromosome into integer .ariables$ and then treats these .aryingArange integers as desired to define the fitness f+nction The ne4 .ersions of getfields$ p+tfields$ chromtointarray$ etc $ all +se the array fieldOendsRS !calc+lated by the program from array fieldOsizesRS# to tell them 4here each field starts and ends$ so the +ser need not 4orry abo+t it Th+s$ for e5ample$ t4o fields may represent int .ariables 4ith ranges RG$(S and RG$%GGS$ respecti.ely$ 4hile ten others are +sed to map to floating point .ariables discretized to different resol+tions !(GG .al+es for some$ %GGG .al+es for others$ etc # 2f in.ersion is in +se$ GALOPPS a+tomatically remaps .ariableAlength fields +nder an in.ersion operation$ and transforms migrants into the correct in.ersion pattern !and field bo+ndaries# for the recei.ing s+bpop+lation To +se differentA length fields$ simply inp+t alphaOsize as % !a flag#$ and specify the desired alphabet size for each field in array fieldOsizesRS$ fo+nd in f+nction appOsetOfieldOsizes!# in all application !app c$ app% c$ app55555 c$ etc # files GALOPPS 4ill handle the fields a+tomatically$ e.en if they are s+bseD+ently resh+ffled by a s+bpop+lationA4ide in.ersion operation ,igrating indi.id+als are a+tomatically translated into the format of the recei.ing s+bpop+lation One complication arises 4hen the +ser +ses alpha_size WW % A9D +ses different representations in different s+bpop+lations !4hether in.ersion or +serAs+pplied differences# The ro+tines getfields or chromtointarray for decoding the chromosome !or corresponding ones for encoding a ne4 one$ if needed# m+st be replaced by ne4 ones 4hich can accept a fieldOendsRS array arg+ment as 4ell$ since the +ser may be decoding a chromosome 4hich has a different map than the one for the c+rrent s+bpop+lation !d+e to migration or to changes in a s+bpop<s representation after a UbestV indi.id+al 4as sa.ed# Therefore$ ne4 ro+tines$ getfieldsO+neDOfields!# and chromtointarrayO+neDOfields!# are s+pplied for that case The +ser is referred to e5ample s+bdirectory diffreps for an e5ample of their +se %2 tip e 4 >ie d %2ta ti o n Op er a t o r @ 8elease 6 0 incl+des a ne4 m+tation operator capable of making changes in se.eral nearby fields at once Single field !or singleAbit$ for binary reps# m+tation is .ery ineffecti.e for problems 4ith m+ch "deception"$ and a spatially correlated m+tation operator$ 4hich can change se.eral adEacent fields at once$ can be helpf+l The +ser specifies the freD+ency of s+bEecting a chromosome to a m+ltiAfield m+tation !probability per chromosome# in the inp+t file !or interacti.e inp+t#$ and the e5pected .al+e of n+mber of fields possibly altered !this m+tation sets to 8A9DO, .al+es all fields in a comp+ted range of loci$ b+t that means that some may 9OT be altered# The parameter go.erning the e5pected n+mber of fields to set at random is in the +ser<s app55555 c file$ in appOsetOoptions!#$ and is called a.gOm+tO4idth 2ts .al+e is the a.erage n+mber of adEacent ;2ELDS !bits$ if binary# to be set at random$ legal .al+es$ all at once The ne4 .al+e of some field!s# may be the same as the old .al+e AA in fact$ for binary fields$ the probability of no change to any one partic+lar loc+s is (G] As 4ith other operators$ this operator is chosen by linking "bitm+tat c" in the makefile in the 14ork or 1e5amples1PPP directory 2t may 9OT be +sed for perm+tationAtype problems !permproblem W \y<# 2n a f+t+re release$ all operators 4ill be loaded at compile time$ and the +ser 4ill select among them d+ring the r+n$ so that both sorts of m+tation co+ld be in +se sim+ltaneo+sly Once m+ltim+t c is loaded$ the +ser specifies the a.erage 4idth !n+mber of fields# to be m+tated at random !.al+e may ret+rn to c+rrent .al+e# as a.gOm+tO4idth$ a global in appOsetOoptiona!# in the +ser<s app file The probability of doing a m+ltiAm+tation is specified PE8 "78O,OSO,E$ c+rrently as "pm+tation" in the normal inp+t file$ 4hich m+ltim+t c kno4s to interpret as a per chromosome$ not per field$ rate =o tz m a n n Sca i n g of >itn e " " e " @ 8elease 6 0 allo4s the +ser to specify a beta .al+e$ the *oltzmann scaling constant$ and scaled fitnesses ! fitness terms# are calc+lated from ra4 fitnesses ! initOfitness fields$ really# +sing$ for indi.id+al RiSC fitnessRiS W e5p!beta Q initOfitnessRiS# 1 S+mOo.erOallOi!e5p! beta Q initOfitnessRiS## Setting beta to G makes all indi.id+als eD+ally likely to be chosen$ 4hile large betas !6$ for e5ample# gi.e almost all probability of selection to the most fit indi.id+al *et4een the e5tremes$ any desired le.el of selection press+re can be achie.ed This simple *oltzmann scaling by a constant beta is in.oked by selecting autocontrol_selection to \n< !off# in the inp+t$ and then specifying a n+merical .al+e for beta Opti o n a 60 A2t o m a t i c a ! Contr o e d S e e c t i o n @
Erik D Goodm a n $ GA8AGe$ ,ichiga n State -ni.ersity
The pioneering theoretical 4ork in applying statistical mechanics !or a ma5im+m entropy ass+mption# to analysis of GA performance !see Shapiro and Pr+egelA*ennet$ for e5ample# has prod+ced a method aimed at dynamically controlling selection so as to achie.e relati.ely high rates of impro.ement of mean fitness 4itho+t strongly red+cing the di.ersity of the pop+lation A method for control of selection$ +sing dynamically altered *oltzmann scaling$ is pro.ided in GALOPPS 6 0 This method has not yet been tested for effecti.eness on a 4ide range of problems$ b+t the +ser may find it interesting to e5plore GALOPPS 8elease 6 0 allo4s the +ser to elect "autocontrol_selection " in the inp+t stream !file or interacti.e inp+t# The +ser m+st then specify !or +se the a+tomatic defa+lt for# beta_s_tilde The a+tomatic defa+lt is based on the 4ork of Shapiro and Pr+egelA*ennett$ and is determined by +sing a recommended point on the graph of the ratio of the std de.iation of fitnesses !across one generation# .ers+s betaOs The .al+e of beta_s_tilde is obtained by m+ltiplying betaOs by sDrt!0 Q log popsize# ;rom beta_s_tilde $ beta is defined byC beta W beta_s_tilde 1 sDrt !std de. of scaled fitnesses# !eta$ calc+lated in this 4ay$ tends to keep selection press+re ro+ghly constant as the fitness distrib+tion changes 2f the s+ggested defa+lt for beta_s_tilde is accepted$ Shapiro and Pr+egelA*ennett s+ggest that it may tend to ma5imize the gain in mean fitness s+bEect to not sharply decreasing the di.ersity of the pop+lation Th+s$ if autocontrol_selection is y!es#$ GALOPPS calc+lates beta_s_tilde !based on popsize# once$ and then rescales beta from it at each generation$ +sing the c+rrent std de.iation of the scaled fitness distrib+tion !after any migrants ha.e entered the pop+lation# 2f autocontrol_selection is chosen$ the selection f+nction in s+select c m+st be compiled in That is Stochastic -ni.ersal Sampling$ 4hich then acts on the "optimally" *oltzmannAscaled .al+es to sample the pop+lation D+ite acc+rately according to the *oltzmannAscaled probabilities >a 7 e n a 2 e r F " Gro2 pi n g Gen e t i c A gori t h m Repr e " e n t a t i o n an d Op er a t o r " @ 8elease 6 0 incl+des as an e5ample an implementation !by *rian J+la4inski of the ,S- GA8AGe# of Eman+el ;alkena+er<s GGA !Gro+ping Genetic Algorithm# This GGA representation greatly enhances performance of a GA for attacking many gro+ping and gro+pingArelated problems$ as are freD+ently fo+nd in sched+ling$ partitioning$ packing$ and similar problems S+bdirectory 1e5amples1GGA has an e5ample of a GGA problem !appbpp c for bin packing# together 4ith the specialized operators and encoding1decoding ro+tines to +se the representation 2t sho+ld be regarded as alphaAtest !e5perimental# code$ b+t is incl+ded beca+se of interest to some +sers 8eading of one or more of ;alkena+er<s papers is s+ggested before attempting to +se the GGA pro.ided here Thre a d e d GALOPPS @ A T78EADED .ersion of GALOPPS$ 4ritten and tested on S+n 4orkstations$ enables +sers on m+ltiprocessor systems to speed +p the r+nning of either Onepop or ,anypops r+ns$ +sing the p.m system$ 4itho+t +ser inter.ention A.ailable as a separately do4nloadable mod+le on the GA8AGe 4eb site$ httpC11isl ms+ ed+1GA
8elea s e 6 G incl+d e d a m aEor addition of cap a bilities for sol+tion of the most diffic+lt probl e m s +sing .al+eA bas e d !i e $ 9OT per m + t a ti o nA bas e d# repr e s e n t a t i o n s 2n.ersion is introd + c e d $ 4ith a choice of t4o in.ersio n oper a t o r sC the "classic al" oper a t o r$ in 4hich a starting position and a !s+b s e D + e n t # endi n g position on the chro m o s o m e are select e d at rand o m $ and all fields bet4 e e n the m are re.ers e d in order$ and a "circ+lar" in.ersio n oper a t o r$ 4hich trea t s the chro m o s o m e as a ring$ and picks start and end position s at rand o m on the ring$ and re.er s e s the seg m e n t in the positi.e direction from start to end$ incl+ding passi n g "aro+ n d the end" of the chro m o s o m e 7o4e. er$ +nlike the .ario+ s reord e ri n g oper a t or s in GALOPPS for +se in sol.ing per m + t a ti o nA typ e probl e m s $ 4he n in.ersion occ+rs$ GALOPPS m ak e s the chan g e in order to ALL the chro m o s o m e s in the pop+l atio n !or in a single s+b p o p +l a tio n$ in the cas e of
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
66
,anypo p s# and tracks the location s of the rearr a n g e d fields relati.e to their position in the original "stan d a r d " repr e s e n t a t i o n +se d in the fitnes s f+nction$ so that the in.ersion s ma y be "+ndo n e " befor e chro m o s o m e s are act + ally e.al + a t e d in the fitnes s f+nction Th+s$ the +ser doe s 9OT ne e d to deal 4ith in.ert e d chro m o s o m e s in the fitne s s f+nction$ bec a + s e the chro m o s o m e is tran sfor m e d te m p o r a rily back to "st an d a r d " form befor e being pass e d to obEf+nc!# A m aEor diffic+lty 4ith the in.ersio n oper a t o r in the past for most GA applicatio n s has be e n that it is diffic+lt to m e a ni n gf +lly cross o. e r indi.id+ al s 4ith differe n t in.ersio n patt e r n s GALOPPS o.erco m e s this by doing in.ersion as an oper a ti o n on an entire pop+l atio n or s+b p o p +l a tio n Then all m ati n gs are don e 4ithin the sa m e repr e s e n t a t i o n $ a.ertin g the +s+ al probl e m s The only pot e n ti al probl e m is 4hat to do 4he n indi.id+ al s in ,anyp o p s migr at e from one s+b p o p +l a tio n to anot h e r !4hich m ay ha. e a differe n t in.ersion patt er n# GALOPPS han dl e s that by transfor mi n g migra tin g indi.id+ al s into the in.ersio n orderin g +se d in the recei.ing s+b p o p +l a tio n This is acco m plish e d by first tran sfor mi n g the migr ati n g chro m o s o m e back to "st an d a r d " form$ +sing the donor<s "m apOtoOst a n d a r d "$ then +sing the 29:E8SE of the recei.in g s+bp o p +l a ti o n<s "m apOtoOst a n d a r d " to ma p the chro m o s o m e ;8O, sta n d a r d to the recei.in g s+bp o p +l a ti o n<s c+rre n t repre s e n t a t i o n The prosp e c ti. e +ser of in.ersio n is "A-T2O9ED to rea d and +nd er s t a n d thoro+ g hl y the in.ersion oper a t o r before decidin g to +se it 2n m a n y cas e s $ +se of in.ersio n for simpl e f+nctionA opti miz atio n tasks 4ill O9L3 SLO= the searc h$ prod+ ci n g no ben efici al effect s 2t is +sef+l O9L3 for probl e m s in 4hich ther e is consid e r a bl e epist a tic !nonline a r# inter a c ti on am o n g .ariabl e s on the chro m o s o m e $ b+t the +ser doe s 9OT kno4 eno+ g h abo+ t the nat +r e of thos e inter a c ti on s to "preA arra n g e " the chro m o s o m e so that .ariabl e s relat e d to eac h other can be plac e d close to eac h oth er on the chro m o s o m e 2n that cas e$ in.ersio n m ay help spe e d the se arc h$ by !thro+ g h rando m cha n c e # placin g t4o !or mor e# .ariabl e s in close pro5i mit y to eac h oth er on the chro m o s o m e $ 4hich allo4s crosso . e r to e5ploit their relation s hi p mor e effecti.el y 9OTE that in.ersion is a "seco n dA le.el" oper a t o rC perfor mi n g in.ersion has 9O effect on the fitnes s of the indi.id+ al s in.ert e d $ b+t rath er affect s the prob a bility that .ario+ s "good" sch e m a t a 4hich ha. e a long defining lengt h in the "stan d a r d " repr e s e n t a t i o n !+se d by obEf+nc# 4ill beco m e short sch e m a t a in the in.ert e d repre s e n t a t i o n$ and th+s able to act as "*+ilding *locks " 2t is a corollary that the in.ersio n cap a bility pro.id e d by GALOPPS !and act+ ally$ the proc e s s itself$ the a+t h or post +l a t e s # is +sef+l only 4he n in.ersion patt er n s are E+dge d at a high e r !i e $ s+bp o p +l a ti o n# le.el !Therefor e$ +sing in.ersio n 4ith Onep o p is not reco m m e n d e d $ altho+ g h it is per mitt e d # GALOPPS per mit s this high e rA le.el control !s+bp o p +l a tio nA le.el selection on the in.ersion m a p# ea sily$ as sho4n in the de m o n s t r a ti o n file$ ap p d e m o i . c 2n that e5 a m pl e $ the in.ersion rat e is inde p e n d e n t l y controlle d for eac h s+bp o p +l a ti o n$ being chan g e d to G or a +serA inp+t .al+e$ bas e d on com p e ti tion am o n g the s+b p o p +l a tio n s That is$ the effecti. e n e s s of a s+b p o p +l a tio n<s in.ersion patt er n is E+dge d .isA aA .is the effecti.e n e s s of other s+b p o p +l a tio n s< patt e r n s by se ein g ho4 4ell the cross o. e rA dri.e n se arc h progr e s s e s 4ith eac h partic+l ar in.ersio n patt e r n $ and re4ar di n g GOOD in.ersion patt er n s 4ith a G G in.ersion rat e !i e $ ;2>29G the good patt e r n# so long as the s+b p o p +l a ti o n contin+ e s to o+t p e rfor m the other s+b p o p +l a ti o n s The +ser has a gre a t de al of fle5ibility in ho4 to control this$ and only a sim pl e e5 a m pl e is sho4n in the file app d e m o i c The start and end points for the seg m e n t to be in.ert e d by an in.ersio n oper a t o r are select e d at ;2ELD *O-9DA82ES$ not bet4 e e n any t4o pairs of bits 2f alph aOsiz e W W 0$ of co+rs e$ the n in.ersio n can start and end any4 h e r e $ b+t if alph a siz e W 0G$ for e5a m pl e$ then in.ersion s 4ill start and end at (A bit field bo+ n d a ri e s 2f yo+r probl e m is simpl e eno + g h that it can be sol.ed 4ithin a fe4 h+ndr e d gen e r a t i o n s $ the n it is -9L2?EL3 that yo+ 4ill ben efit from +sing in.ersion 7o4e. e r$ for probl e m s 4ith
6'
high degr e e s of nonlin e a r inter a c tion !epist a si s# am o n g .ariabl e s$ and no "nat +r al" arra n g e m e n t of the .ariabl e s$ then if the probl e m is long eno+ g h to reD+ir e ma n y h+ndr e d s or tho+s a n d s of gen e r a ti o n s to sol.e$ the in.ersion oper a t o r ,2G7T be +sef+l in achi e.in g s+cc e s s Pleas e not e also that 4hile in.ersio n is +sa bl e 4ith eith er oneA point or t4oA point cross o. e r$ it is literally +sel e s s !and a 4ast e of tim e# if +niform cross o. e r is +se d$ sinc e +niform cross o. e r trea t s fields for inherit a n c e 29DEPE9DE9T of their relati. e position s on the par e n t chro m o s o m e s !,any ha. e fo+nd that in.ersio n is mor e +sef+l for sol.ing prod+ c tio nA r+leA set probl e m s $ etc $ tha n for con. e n tio n al f+nction opti miz ation probl e m s 3o+ sho+l d det e r m i n e its efficac y before settling on the +se of in.ersion for any partic+l ar probl e m # 9oteC 2f yo+ begi n +sing in.ersion$ and s+bs e D + e n t l y set pin.er sio n !the prob a bility of in.ersion per gen e r a ti o n# to G $ the n yo+ ,-ST ALSO set the glob al .ariabl e "+singOin. er si o n" to % !T8-E#$ for e5a m pl e$ in appOs e tOop ti on s!# in yo+r app5 5555 c file This 4ill allo4 the migr atio n s am o n g s+b p o p +l a tio n s to proce e d correctly$ 4hile prod + ci n g no more 9E= in.ersion s of the s+b p o p +l a tio n s The "+singOin. er sio n" .ariabl e is a+to m a t i c ally set$ as is the .ariabl e "differe n tOr e p s $" 4he n e . e r pin.ersion T G at the start of a cycle
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
6(
See the differe n t r e p s e5a m pl e !in s+bdir ec t or y e5a m pl e s # for an ill+stration of the +se of differe n tOr e p s The +se of differe n tOr e p s allo4s the +ser to ea sily imple m e n t par all el GA archit e ct + r e s s+ch as the ,S- GA8AGe<s "2nEection 2sland" archit e c t +r e 2n that appro a c h $ s+b p o p +l a ti o n s are orga niz e d in a tre elike ma n n e r$ 4ith bas e le.el s+bp o p +l a ti o n s +sing a repre s e n t a t i o n 4hich is mor e highly aggr e g a t e d tha n the "leaf" nod e s ,igration of indi.id+ al s occ+rs O9L3 in the direction to4ar d the "leaf" nod e s =hen an indi.id+ al is pass e d to a nod e 4ith a more refine d repre s e n t a t i o n$ the any .al+ e for a more coars el y aggr e g a t e d .ariabl e in the "donor" s+bp o p +l a ti o n is sim ply plac e d into all the desti n a ti o n .ariabl e s 4hich corre s p o n d to the singl e donor .ariabl e Then$ 4he n the recei.ing s+b p o p +l a tio n doe s gen e ti c oper a ti o n s $ thes e .al+e s !4hich 4ere force d to be aggr e g a t e d in the donor s+b p o p +l a tio n# ma y di.erg e from one anot h e r$ pro.iding a more det ail e d repr e s e n t a t i o n of the probl e m $ b+t contin + o + sl y "see d e d " 4ith pot e n ti al "b+ilding blocks" from the coars e r le.el =e ha. e fo+nd that this 2nEection 2sland parall el GA archit e c t + r e spe e d s o+r se arc h significa ntl y on som e .ery diffic+lt synt h e si s probl e m s
Global par a m e t e r s C Ap D+iet W X o + t p + t le.el$ GA 6T Ap npop s W X L of pop +l a tion s to be r+n T !,anyp o p s only# Ap start p o p n + m W X f i r s t pop+l atio n for this proce s s1 pr o c e s s o r $ G to npop sA % T !,anyp o p s only# Ap finishpo p n + m W X l a s t pop+l a tion for this proc e s s1 pr o c e s s o r$ G to npop sA %T !,anyp o p s only#
6)
Ap ncycl es W X L of cycles to be r+n T !,anyp o p s only# Pop+l atio nA specific par a m e t e r s C Ap pcross W X ] prob a bility of crosso . e r T Ap pm +t a ti o n W X ] prob a bility of m+t a tio n T Ap pin.er sio n W X ] prob a bility of in.ersion T Ap cro4dingOfact or W X c r o 4 di n g factor T Ap popsiz e W X L of indi.id+ al s1 p o p +l a ti o n T Ap gen s p e r c ycl e W X L of gen e r a ti o n s per cycle T Add a 0 digit pop+l atio n n+m b e r to tag to cha n g e the .al+e of a pop+l atio nA specific para m e t e r for only a single pop +l a tion$ i e $ Ap pcross G 0 W G G ( 4ill only o.errid e for pop L 0 All .al+e s specified on a com m a n d line S-PE8SEDE .al+e s specified in the inp+t files$ and the LATEST .al+ e det er m i n e d for any par a m e t e r on the com m a n d line s+p e r s e d e s any earlier .al+e s for it gi.en on the com m a n d line
Additi o n a
S e e c t i o n %et h o d " @
Sa m p i n g @
An addition al form of selection$ stoch a s tic +ni.ers al sa m plin g !file s+s el e c t c# has bee n add e d $ and is reco m m e n d e d o.er srsel ec t c and rsel ect c !See *aker$ Proc 0nd 2ntFl "onf on GA$ pp %'A 0% # bec a + s e of its sm all SP8EAD abo+ t the desire d distrib+tio n and its free d o m from bias 2t is fast er to com p + t e than all of the oth er met h o d s $ for a serial m ac hi n e GALOPPS contin + e s to pro.id e rselect !ro+lett e 4he el#$ srsel ec t !stoch a s ti c rem ai n d e r sa m plin g#$ and tselec t !to+rn a m e n t selection#$ as 4ell as ranking !describ e d belo4#
Repr e " e n t i n g Non4 =inar ! Chro m o " o m e " #A ph a b e t Siz e G 0$ #No t e @ Re e a " e *. 0 e & e n a o A " diff e r e n t 4 "iz e d a phab e t " for diff er e n t fie d " $
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
6I
8elea s e s 0 6G and later of GALOPPS s+pp ort the +se of nonA binary alph a b e t s to repr e s e n t sol+tion s on the chro m o s o m e That is$ bits are gro+p e d into fields nA bits long$ of 4hich only som e s+bs e t ma y be legal .al+ e s for the field ;or e5a m pl e$ if alph aOsiz e !the cardin ality of the alph a b e t # is set to )$ the n eac h field is 6 bits long$ b+t the only legal bit com bi n a ti o n s in eac h field are the binary strings for G A ( %G That is$ %%G0 and %%% 0 are 9OT legal .al+e s in any field "rosso. e r$ m+t a tio n$ in.ersion$ and initialization 4ill "resp e c t " the s e restriction s$ allo4ing crosso . e r to occ+r only at field bo+ n d a ri e s$ for e5a m pl e The +ser trigge r s the +se of this type of repr e s e n t a t i o n by respo n di n g 9O to "per m p r o bl e m P " and any inte g e r T 0 for alph aOsiz e !AlphaOsiz e W 0 pro.id e s the +s+ al binary repr e s e n t a t i o n # 2np+t files !if +se d# m+st no4 cont ai n alph aOsiz e !cardin ality of alph a b e t # and n+ mfield s$ inst e a d of lchro m !lengt h of chro m o s o m e in bits# for all nonA per m + t a ti o n repr e s e n t a t i o n s !Perm + t a ti o n reps ha. e ne. er +se d lchro m # 2mple m e n t a t i o n of this feat +r e in.ol.e d initialization of the pop +l a tion s !ther e is a ne4 f+nction called in inits+b p c and start + p c$ and s+p er + nifor m initialization of the s e chro m o s o m e s is not allo4e d#$ and de. el o p m e n t of ne4 .ariation s of the tradition al cross o. e r and m+t a tio n oper a t o r s The ne4 in.ersio n oper a t o r s 4ere de. el o p e d 4ith the nonA binary alph a b e t cap a bility ena bl e d "rosso. e r !one p t 5 c$ t4opt5 c$ and +nif5 c# for this repr e s e n t a t i o n are all perfor m e d only at the bo+n d a ri e s bet4 e e n fields This pre. e n t s gen e r a t i o n of any illegal code s$ and pres e r . e s the fields as the basic ato m s of any b+ilding blocks "rosso. e r prob a bility contin+ e s to be a perA chro m o s o m e prob a bility ,+tation is don e on a perA field basis !m+t a ti o n rat e is perA ;2ELD !or per LO"-S$ if yo+ prefer#$ E+st as it is for a binary repr e s e n t a t i o n $ 4her e a bit is a field# =hen a field is to be m+t a t e d $ its .al+ e is chan g e d at +niform rand o m to a differe n t one of the legal .al+ e s 2t is force d 9OT to rem ai n the sa m e !E+st as in the binary cas e#$ b+t to rem ai n legal !Of co+rs e $ mor e than one m+t a ti o n at a tim e on the sa m e chro m o s o m e co+ld conc ei. a bl y ret+r n it to its form e r .al+ e # 2n.ersion constit +t e s a reA arra n g e m e n t of ;2ELDS$ regar dl e s s of the field lengt h Prob a bility of in.ersion is e5pr e s s e d as a perA gen e r a t i o n prob a bility$ since entire s+b p o p +l a tio n s are in.ert e d at onc e A ne4 e5a m pl e application file ill+stratin g the +se of a nonA binary alph a b e t is pro.id e d$ ap p 3 t o ) . c This application se arc h e s for the singl e best string of lengt h n+mfield s$ of the formC G$%$ $mA %$G$%$ $mA %$ G$%$ k$ 4her e m is the +serA specified alph a b e t size There is no +pp er limit impos e d on eith er k or m$ altho + g h it 4ill likely not 4ork 4ith 0QQm T ,A>O-29T
6/
Re" t r 2 c t 2 ri n g an d Additi o n of %ore Cro" " o & e r Oper a t o r " for "?a 2 e4 =a" e d " Prob e m "
The cross o. e r and m+t a tio n oper a t or s are in sep a r a t e files$ allo4ing the +ser to select the m inde p e n d e n t l y at com pil ation tim e As an altern a ti. e to singl eA point cross o. e r !the only cross o. e r pro.id e d in the origin al SGAA"#$ t4oA point cross o. e r and +niform cross o. e r ha. e be e n add e d for ma ni p +l a ti n g binary repr e s e n t a t i o n s Thes e thre e oper a t or s are no4 in files one p t 5 c$ t4opt5 c$ and +nif5 c$ resp e c ti. el y The +ser m+st select one of the s e in the m ak efile !or one of the other s$ for a per m + t a ti o nA typ e probl e m AA se e belo4#$ and a m+t a tio n oper a t o r !nor m ally$ bitm + t a t c for nonA per m + t a ti o n probl e m s # T4oA point cross o. e r tre at s the chro m o s o m e as a ring$ and plac e s gen e s from one pare n t bet4 e e n t4o rando m l y select e d point s on the chro m o s o m e $ 4ith the rem ai n d e r of gen e s comin g from the other par e n t T4oA point cross o. e r is consid e r e d by m a n y to be s+p erior to oneA point cross o. e r for most applicatio n s$ and its +se is reco m m e n d e d -niform cross o. e r tre at s eac h loc+s as inde p e n d e n t of all other s$ so for eac h loc+s$ it assign s the first child the allele from par e n t one 4ith prob a bility (G]$ makin g a ne4$ inde p e n d e n t decision for eac h loc+s "hild t4o al4ays recei. e s its .al+e for any loc+s from the par e n t 9OT +se d in child one =hile +nifor m crosso . e r often 4orks prom o t e s .ery rapid se arc h on .ery sim pl e "co+ntin g one s" probl e m s $ for e5 a m pl e $ it rend e r s the conc e p t of linkage com pl e t el y inoper a ti. e$ so sho+l d 9OT be +se d in any syst e m +sing an 29:E8S2O9 oper a t o r to e.ol.e bett e r linkag e s !S+ch an in.ersion oper a t o r is e5p e c t e d to be a.ailabl e in the ne5t relea s e of GALOPPS # -niform cross o. e r also is 9OT reco m m e n d e d by this a+t h or for probl e m s in 4hich a "nat +r al" repr e s e n t a t i o n offers the hop e that linkag e might help to pres e r . e coA ad a p t e d set s of alleles 4hich are relati.ely close on the chro m o s o m e
SiE Oper a t o r " an d Oth e r Too " Add e d for So 2 ti o n of Ord er4 =a" e d #or Per m 2 t a t i o n 4 T!p e $ Prob e m "
Gen etic algorith m s are freD+ e n tl y +se d to find sol+tions to probl e m s 4hich are ess e n ti ally probl e m s of per m + ti n g !or reord e ri n g# a set of fields Sche d +lin g of prod +c ti on facilities$ sol+tion of short e s t pat h probl e m s $ partitionin g and plac e m e n t for electro nic circ+its$ etc $ are com m o n e5 a m pl e s 8elea s e 0 G( add e d facilities for sol.ing s+ch probl e m s as part of the basic GALOPP Syst e m 2f the +ser specifies that the probl e m is a per m + t a ti o nA type probl e m $ the +ser m+st select appro p ri a t e oper a t or s in the mak efile !-ni5 syst e m s # or proEect file !*orlan d "$ etc # ;or per m + t a t i o nA type probl e m s $ fo+r differe n t cross o. e r oper a t o r s are incl+d e dC +nifor m orderA bas e d crosso . e r !+ob5 c#$ order cross o. e r !o5 c#$ cycle cross o. e r !c5 c#$ and parti ally m at c h e d crosso . e r !pm5 c# The first of the s e is describ e d in Da.is$ 7and b o o k of Gen etic Algorith m s$ 4hile the oth er thre e are describ e d in the Goldb e r g book A choice of t4o m+t a tio nA type oper a t o r s for per m + t a ti o n probl e m s is also pro.id e d AA s4ap pi n g of t4o rand o m l y select e d fields !s4ap c# or rand o m s+blist scra m bl e m+t a tio n !scra m bl e c#$ 4hich is describ e d in Da.is$ 7and b o o k of Gen e tic Algorith m s The +ser is referr e d to both Goldb er g and Da.is for disc+s si o n s of the m erits of the s e .ario+ s oper a t or s for .ario+ s type s of probl e m s T4o ro+tin e s in +tility c$ int0ithr +E and ithr+E0int$ are the lo4estA le.el ro+tin e s +se d to enco d e and deco d e indi.id+ al fi5edA lengt h integ e r fields to and from specified bit rang e s on the chro m o s o m e 7igherA le.el ro+tin e s are also a.aila bl e for sim pl er acce s s$ 4he n the
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
6&
application per mit s !getfield and p+tfield for indi.id+ al fields$ and chro m t oi nt a rr a y and intarr a yt o c h r o m for +nloa di n g1lo a di n g the 4hole chro m o s o m e from an int array !n+ mfi el ds and fieldlen gt h are global .ariabl e s +se d in thes e cas e s# A speci al ro+tin e$ initper m p o p !#$ in start + p c !singl e pop+l atio n s# or inits+b p c !m+ltiple s+bp o p +l a ti o n s#$ perfor m s rando m initialization of all fields so that eac h possi bl e .al+e app e a r s on the chro m o s o m e e5actly once An e5 a m pl e file$ app b t s p c$ imple m e n t s a sol+tion to the *lind Tra.eling Sales m a n Proble m that is$ a TSP in 4hich the sol.er doe s not kno4 !or doe s not m ak e +se of# the dist a n c e s bet4 e e n indi.id+ al city pairs$ b+t only recei. e s at the end of the to+r a m e a s + r e of the total lengt h This ro+tin e ill+strat e s the +se of the facilities pro.id e d for sol.ing s+ch probl e m s $ and sho+l d ser. e as the basis for the +serFs de. el o p m e n t of his1h er o4n file$ starting from the "gen e ri c" app5 5555 c file
6ind o A Sc a i n g
=indo4 scaling$ similar to that pro.id e d in Gen e S3S or GA+csd$ is pro.id e d The +ser ma y elect no 4indo4 scaling !A%#$ or m ay set scalingO4indo 4 to any inte g e r from G to a L d e fi n e<d ma5i m + m !c+rre n tl y %&# The fitnes s is scal e d by s+btr a c ti n g from the ra4 fitne s s !initOfitne s s in the cod e# the LO=EST fitne s s of any indi.id+ al in the past scalingO4indo 4 gen e r a ti o n s !G me a n s c+rre n t gen e r a ti o n onlyB % m e a n s c+rre n t pl+s imm e di a t el y prec e di n g gen e r a ti o n$ etc # Of co+rs e$ this 4indo4 scaling differs from GE9ES2S in that GE9ES2S s+btr a c t s the m a5i m + m fitnes s see n in scalingO4indo 4 gen e r a ti o n s$ bec a + s e it +se s "antiA fitnes s"$ 4hich it tries to minimiz eB in contr a s t $ GALOPPS +se s tr+e fitnes s$ 4hich it se ek s to m a5i miz e The +ser ma y t+rn 4indo4 scaling on or off 'G
Erik D Goodm a n $ GA8AGe$ ,ichiga n State -ni.ersity
d+ring a r+n AA it keep s the ne e d e d mini m + m fitne s s history 4het h e r or not it is acti.e$ and oper a t e s correctly !the a+t h or inten d s # from first acti.ation$ e.e n 4he n files are rest a rt e d after a checkp oi nt halt
Line ar Sca i n g
Linear scaling is pro.id e d as describ e d in Goldb er gF s book$ +sing scal e m +l t !+ser inp+t# as the ratio of best fitne s s to m e a n fitnes s 2f m aint ai ni n g the +serA specified ratio bet4 e e n best and m e a n fitne s s 4o+ld ca+ s e som e fitnes s e s to beco m e neg a ti. e$ the slop e of the scaling line is readE + st e d so that the 4orst fitnes s indi.id+ al rec ei. e s a scal e d fitne s s of G$ 4hile the me a n fitnes s is maint ai n e d A .al+ e of A% ca+s e s linear scaling 9OT to be perfor m e d
Sig m a Tr2n c a t i o n
Sigm a tr+nc a ti o n$ as describ e d in Goldb e r g F s book$ has bee n add e d Thisallo4s the +ser to specify a m+ltiplier of sigm a$ the sta n d a r d de.i atio n$ 4hich the sigm a tr+nc a tio n feat +r e in file statisti c +se s to alter the fitnes s f+nction as follo4sC The stan d a r d de.i ation$ sigm a $ of the fitne s s e s of the c+rre n t gen e r a ti o n is calc+l at e d The fitnes s$ f$ is transfor m e d to sigm aA tr+nc a t e d fitne s s$ fF$ +singC fJ M ma E # 3 . 3 ' f 4 #fb ar 4 "i g m a N t r 2 n c T "i g m a $ $ ' 4her e fbar is the m e a n fitne s s of the c+rre n t gen e r a ti o n$ and sigm aOtr+ n c is the m+ltipl e of sigm a specified by the +ser That is$ all of the transfor m e d .al+ e s of fF belo4 G G are tr+nc a t e d to G The res+ltin g .al+ e s !in ne4p o pRES fitn e s s # are then a.ailabl e for line ar scaling$ if desire d 2f the +ser specifies sigm aOtr + n c W G G$ sigm a tr+nc a tio n is t+rn e d off 9OTEC sigm a tr+nc a ti o n doe s not pres e r . e the m e a n fitne s s of the pop+l atio n
Opti o n a
/ iti " m
*y setting or rese t ti n g a com pil eA tim e flag$ elitism$ in f+nction appOs e tOop ti on s!# in the +serFs app!55555# c probl e m definition file$ the +ser m ay +se or not +se elitism 2f elitism is elect e d $ the gen e r a t i o n proc e s s is modified to 29S-8E that AT LEAST O9E copy of the c+rre n t gen e r a t i o n F s best fitnes s indi.id+ al app e a r s in the ne5t gen e r a ti o n F s pop+l atio n 2f t+rn e d off$ rand o m chan c e m ay fail to allo4 the best indi.id+ al to be select e d for reprod + c tio n +nch a n g e d $ and cha n c e m ay ca+ s e all copie s of the c+rre n t best indi.id+ al to be s+bEect e d to cross o. e r and1or m+t a tio n$ perh a p s res+ltin g in 9O copie s of it in the ne5t gen e r a ti o n$ in spit e of its high erA tha nA a.er a g e fitnes s Th+s$ the fitne s s of the best indi.id+ al of the c+rre n t pop+l atio n co+ld act + ally decr e a s e $ if elitism is not em ploye d 7o4e. er$ dep e n di n g on the circ+ m s t a n c e s $ som e m ay 4ish to a.oid it$ to ins+r e absol +t e adh e r e n c e to the sa m plin g prob a bilities gi.en by the fitnes s distrib+tion$ etc 2f the +ser elect s elitism$ s+r.i.al of the best indi.id+ al is also g+ar a n t e e d by GALOPPS d+ring migr atio n oper a ti o n s !i e $ last copy of best g+y is ne. e r replac e d by a 4ors e indi.id+ al#$ and d+ring parti al reA initialization of a s+b p o p +l a ti o n !so long as at least O9E indi.id+ al is 9OT rand o m l y repl ac e d $ the best one 4ill be pres e r . e d #
'%
A facility 4as add e d for calc+l atin g the proportio n of % bits pres e n t in the pop +l a tion at eac h loc+s -sing this me a s + r e $ 4hich can be calc+l at e d and report e d at a +serA specified inter. al$ it is eas y to det er m i n e 4he n most indi.id+ al s ha. e the sa m e .al+ e s for partic+l ar loci$ and th+s E+dge the degr e e of con. er g e n c e of the pop+l atio n$ and det e r m i n e hyp er pl a n e s in 4hich it ma y be diffic+lt for the pop +l a tion to e5plore
De1on g 4 St! e CroA d i n g ' An A t ern a t i & e %et h o d >or Rep a ci n g Pop 2 a t i o n %em b e r " Ait h Ne A Off" pri n g #Can =e U" e d to >o" t e r Nich e >orma t i o n $
DeHongA style cro4din g$ as describ e d in Goldb er gF s book$ has be e n add e d as a m e a n s of allo4ing "niching" of the pop+l a tion AA that is$ allo4ing se. er al distinct gro+p s of indi.id+ al s !in differe n t "niche s"# to de. elo p and persist in the pop +l a tion$ 4ith less e n e d pres s + r e by the GA for all to con. er g e to4ar d a single type of indi.id+ al This tech ni D + e is inten d e d to help red+ c e pre m a t + r e con. er g e n c e of the pop+l atio n$ allo4ing it to more effecti.el y e5plor e the dom ai n of a m+ltiA mod al f+nction 2t m ay be partic+l arly +sef+l for .ery diffic+lt f+nction s$ in 4hich r+ns of ma n y gen e r a t i o n s are e5p e c t e d to be nec e s s a r y to find a glob al opti m + m DeHong cro4din g +se s an integ e r "cro4din gOfac t or" specified by the +ser 2f it is set to G$ cro4ding is t+rn e d off$ and the cross o. e r oper a ti o n proc e e d s as +s+ al$ 4ith offspring replacin g their pare n t s If cro A d i n g Nf a c t o r i" " e t to (' th e n ea c h indi&i d 2 a pro d 2 c e d b! cro " " o & e r rep a c e " a ran d o m ! " e e c t e d indi&i d 2 a fro m th e po p 2 a t i o n ALR/AD< S/L/CT/D acc o r d i n g to re a ti & e fitn e " " for repr o d 2 c t i o n or "2r&i & a into th e n e E t g e n e r a t i o n . That i"' thi " ca " e do e " no cro w d i n g ' b2t i" "i m p ! an a t e r n a t i & e "tr a t e g ! for p ac e m e n t of off " p ri n g #in " t e a d of "i m p ! rep a c i n g th eir par e n t " ' a" in SGA$. 2f cro4din gOfact or is set gre a t e r than % !+s+ ally to 0$ 6$ or oth er sm all inte g e r#$ crosso . e r is modified to 4ork as follo4sC
'0
Prior to any crosso . e r or m+t a ti o n$ nor m al fitne s sA 4eight e d selection !4ith or 4itho+t sigm a tr+nc a tio n and linear scaling# is +se d to select the tent a ti. e m e m b e r s of the ne5t gen e r a t i o n$ ne4po p "rosso. e r is then perfor m e d on pairs of indi.id+ al s select e d at -92;O8, 8A9DO, from this set !sinc e fitnes s has alre a d y be e n +se d to bias the SELE"T2O9 ;O8 S-8:2:AL# After a pair of indi.id+ al s is select e d for crosso . e r$ the childre n are calc+l at e d as +s+ al Then$ for eac h child$ "cro4din gOfact or" m e m b e r s of the set of tent a ti. e s+r.i.ors are select e d !at +niform rand o m #$ and 7A,,29G D2STA9"E of eac h chro m o s o m e !i e $ n+m b e r of D2;;E8E9T *2TS# from the child is calc+l at e d for the cro4dingOfact or indi.id+ al s The child then 8EPLA"ES 4hich e . e r s+r.i.or it 4as "LOSEST TO in 7am m i n g dist a n c e ,+tation is then applied to all m e m b e r s of the ne4 pop+l atio n at the specified rat e$ and fitnes s e s are calc+l at e d for ne4 indi.id+ al s The idea of cro4ding is that childre n 4ill ten d to replac e indi.id+ al s to 4hich they are S2,2LA8$ so that$ as mor e indi.id+ al s of a similar geno t yp e arise in the pop +l a tion$ the cha n c e s incre a s e that their offspring 4ill replac e one of the m $ rath e r than a dissi milar indi.id+ al That gi.es the D2SS2,2LA8 indi.id+ al s !pres + m a b l y fe4er in n+ m b e r# a *ETTE8 "7A9"E to s+r.i.e Since ;2T9ESS 8EALL3 ,EA9S 29;L-E9"E O9 T7E 9E>T GE9E8AT2O9 !s+r.i.al of self or prod+ ci n g offsprin g similar to one s elf#$ cro4din g prod+ c e s a DE9S2T3A DEPE9DE9T ;2T9ESS ;-9"T2O9$ in effect 7o4e. e r$ +nlike the conc e p t of "fitnes s sharing$" it does not reD+ir e calc+l atio n of a.er a g e 7am m i n g dist a n c e s am o n g ALL me m b e r s of a pop +l a tion$ for e5a m pl e Since cro4din g act + ally implicitly ALTE8S T7E T8-E ;2T9ESS ;-9"T2O9$ the +ser sho+ld e5p e c t that differe n t setting s for cross o. e r rat e$ m+t a tio n rat e$ scaling factor$ etc $ m ay be ne e d e d for effecti. e se arc h than if cro4din g is not +se d
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
'6
de. el o p the cod e nee d e d to sol.e a partic+l ar probl e m +sing GALOPPS$ has bee n enrich e d and e5t e n d e d The +ser is gi.en the opport + nit y to inEect probl e m A specific code at m a n y points$ 4itho+t modifying the GALOPP Syst e m Th+s$ most applicatio n s can be cod e d sim ply by modifying the single file app5 5555 c "9OP" mod el f+nction s for all of the +ser callbacks ha. e be e n preco d e d in app55 555 c$ and any 4hich are not nee d e d ma y simply be left "as is "
U" er4 S2p p i e d Initia iz a t i o n of Pop 2 a t i o n " and Po " t 4 Initia i z a t i o n "C ea n 2 p" S2p p o r t e d @
;o+r type s of "stan d a r d " initialization of chro m o s o m e s are f+rnish e d 4ith GALOPPS !rand o m .al+ e s bet4 e e n G and alph aOsiz eA % in eac h field$ rand o m binary !a speci al cas e of the prec e di n g one#$ s+p er + nifor m initialization of binary chro m o s o m e s $ and rando m per m + t a ti o n s of n .al+ e s am o n g n fields# 2n order to acco m m o d a t e the nee d s of +sers of repre s e n t a t i o n s 4hich ne e d to impos e addition al constr ai nt s on initialization$ t4o ne4 callbacks ha. e be e n add e d to the app filesC +serOs+ p pli e dOinitOpop!s t a r ti n gOg + yOind e 5 # !ne4 in 0 6(# and appOaft erOr a n d o m Oi nit!# !ne4 in 0 6%# The first is called 29STEAD of one of the nor m al fo+r rando m chro m o s o m e gen e r a t o r s$ if the +ser set s the flag "+serOs+ p pli e dOinitialization" to T8-E in appOinit !the defa +lt is ;ALSE# This then reD+ire s that the +ser fill oldpopR st a r ti n gOg + yOind e 5 S thro+ g h oldpopR p o p siz eA %S 4ith .alid chro m o s o m e s $ gen e r a t e d ho4e. e r the +ser desire s The +ser m ay 4ish to do this "from scrat c h$" or by copyin g one of the sta n d a r d ro+tin e s !from start + p c or inits+ b p c# into +serOs + p pli e dOinitOpop!# in app5 5555 c$ then modifyin g it to the reD+ire m e n t s of the +ser<s partic+l ar repr e s e n t a t i o n The seco n d callback$ appOaft erOr a n d o m Oi nit!#$ !introd + c e d in 8elea s e 0 6%# is called aft er A93 !incl+din g +serA s+pplie d# rand o m initialization of chro m o s o m e s has be e n perfor m e d $ b+t before the statistics ha. e be e n r+n on the initial pop +l a tion The +ser m ay perfor m any desire d tran sfor m a t i o n s$ replac e m e n t s $ etc $ on the pop +l a tion$ to com pl e t e the initialization
''
%igra ti o n Capa b i i ti e " Sig nifi c a n t ! /nha n c e d and %2 tip e Repr e " e n t a t i o n " S2p p o r t e d
At 8elea s e 6 G$ significan t ne4 feat +r e s ha. e be e n add e d to migr atio n of indi.id+ al s in ,anypo p s One le.el of to+rn a m e n t selection !4ith to+rn e ysiz e W 6# is a+to m a t i c ally applied in picking can di d a t e s for migr atio n from a s+bp o p +l a ti o n$ +nles s it is the best indi.id+ al 4hich is to be migra t e d This is to ins+re that 4hen high cross o. e r and1or m+t a tio n rat e s are +se d$ the ma n y "leth al s" prod+ c e d are not so likely to be select e d as immigr a n t s 9ote that immigr a n t s from a s+b p o p +l a tio n are picke d from a pop +l a tion 4hich has 9OT y et be e n s+bEec t e d to A93 selectio n since the pre.io+ s gen e r a ti o n<s oper a ti o n s 4ere perfor m e d Ther efor e$ a to+rn a m e n t of thre e for picking eac h candi d a t e for migr atio n helps to pro.id e a fitnes sA bias e d prob a bility of selection for migr atio n 9ote that$ in the e.e n t that migr atio nOinc e s tOr e d + c ti o n is +se d !se e belo4#$ EA"7 "A9D2DATE for migr atio nOinc e s tOr e d + c ti o n is AL8EAD3 the 4inn er of a to+rn a m e n t of thre e bas e d on fitne s s !and the act + al migra n t 4ill be chos e n bas e d on 7am mi n g dist a n c e from the best of the recei.ing s+b p o p +l a tio n# 2n addition to pro.idin g the abo. e fitnes s bias for migr a n t s $ t4o ne4 fields ha. e be e n add e d to the neigh b or lines in the mst files$ 4hich control t4o ne4 proce s s e s add e d to migr atio n "Incest Reduction" During Migration: The first is called migr atio nOinc e s tOr e d + c ti o n$ and is a sm all integ e r .al+e !+s+ ally RGA (S indi.id+ al s# =hen migra tionOinc e s tOr e d + c ti o n T %$ then 4he n a rando m indi.id+ al !i e $ 9OT reD+ e s t e d as the donor pop+l atio n<s *EST# is to be picke d for migra tion$ migr atio nOinc e s tOr e d + c ti o n indi.id+ al s are rand o m l y chos e n !b+t fitnes sA bias e d by m aking eac h the 4inn er of a to+rn a m e n t of 6$ se e abo. e# from the donor pop+l a tion$ and eac h of their chro m o s o m e s is com p a r e d 4ith the chro m o s o m e of the *EST indi.id+ al of the recipien t pop+l atio n The one ,OST D2;;E8E9T !large s t 7am m i n g dist a n c e # is chos e n as the immigr a n t This m ay ha. e the desira bl e effect of red+ cin g the likelihoo d of "reA importin g" the sa m e indi.id+ al o.er and o.er from a neigh b o ri n g s+b p o p +l a ti o n$ and$ in conE+n ctio n 4ith cro4din g$ m ay aid in m aint ai ni n g di.ersity and in ass e m b li n g differe n t b+ilding blocks in the recipien t pop+l atio n 9oteC .al+ e s of G and % are eD+i. al e n t $ and effecti. ely disa bl e incest red+ ctio n d+ring migra tion 9oteC 2f the flag differe n tOr e p s is set !in f+nction appOinit$ or bec a + s e in.ersion is in +se#$ migra tionOinc e s tOr e d + c ti o n is a+to m a t i c ally disabl e d !tre at e d as G# Crowding During Migration: The seco n d ne4 field is called migra tionOcro4 di n gO a m o + n t $ and is also a sm all inte g e r !typic ally RGA (S indi.id+ al s# 2t 4orks similarly to cro4din g d+ring norm al selectio nC eac h immigr a n t is com p a r e d 4ith migra tionOcro4 di n gO a m o + n t indi.id+ al s select e d rand o m l y from the recipi en t pop +l a tion$ and the indi.id+ al 4hos e chro m o s o m e is "LOSEST !sm all es t 7am m i n g dist a n c e # to the immigr a n t is replac e d Dep e n di n g on oth er para m e t e r s and the probl e m being sol.ed$ this m ay ha. e the effect of fa.oring the form a ti on of mor e than one "cohort" or cl+st er of indi.id+ al s 4ith relati.ely high fitnes s$ b+t 4ith som e 4 h a t distinct geno t yp e s !perh a p s repr e s e n t i n g region s of the sol+tion spac e 4ith differe n t local optim a# This m ay aid the GA in com bi nin g b+ilding blocks$ by allo4ing se. er al distinct one s to persist$ at least briefly$ before selection elimin a t e s the ones 4ith m argi n ally lo4er fitne s s User-Supplied Migration Code:
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
'(
2n 8elea s e 6 G$ a flag .aria bl e$ callOap pO+s e rOd o e sO m i gr a ti o n$ has be e n add e d to the app files$ in the appOinit!# f+nction 2f that .ariabl e is set to T8-E !defa +lt is ;ALSE#$ then 4he n migr atio n is to occ+r$ inst e a d of calling the +s+ al migr atio n ro+tin e s$ ,anypo p s calls appO+s e rOd o e sO m i gr a ti o n!# !in the +ser<s app c file#$ pas si n g it a set of par a m e t e r s likely to be +sef+l to the +ser in perfor mi n g migr atio n 2t is then +p to the +ser to do the migr atio n in any m a n n e r desire d The net effect sho+ld be to mo. e som e indi.id+ al s from neigh b o ri n g s+b p o p +l a ti o n s !as set in the mst file# to replac e som e set of indi.id+ al s in the rec ei.in g pop +l a tion ,igration occ+rs for eac h s+b p o p +l a tio n at the begin ni n g of its e5ec + ti on in eac h cycle !e5c e p t the .ery first#$ E+st aft er it has bee n initialized from the rest ar t files$ and befor e any gen e ti c oper a ti o n s are perfor m e d ,igrant s are introd + c e d into pop+l atio n oldpo pRS$ from 4hich selection of indi.id+ al s to crea t e the ne5t gen e r a t i o n is later m a d e 2t is s+gg e s t e d that a +ser 4anting to +se this feat +r e e5a mi n e caref+lly the "stan d a r d " migra tion cod e !in files ma st e r c and checkrd c# and "can ni b aliz e" 4hat e . e r portions are applica bl e !See also the relat e d !b+t differe n t # cap a bility for +sing differe n t repre s e n t a t i o n s in eac h s+b p o p +l a ti o n$ 4hich m ay s+p pl a n t the nee d for +sing callOappO+ s e rO d o e sO mi gr a ti o n$ by letting the +ser specify only the transfor m a t i o n cod e$ not the code for selectin g and placing migra n t s #
"3"LEFs res+lt s$ regar dl e s s of 4het h e r the s+bp o p +l a ti o n being rea d from is proc e s s e d *E;O8E or A;TE8 the rec ei.in g s+bp o p +l a ti o n !Of co+rs e $ 4hen s+b p o p +l a ti o n s are calc+l at e d by more than one P8O"ESS !on a -ni5 4orkst a tio n# or by mor e than one P8O"ESSO8 !net4ork e d P"$ 4orkst a tio n$ or 4hat e . e r#$ ther e is no longer any att e m p t to kee p the s+b p o p +l a ti o n s "in sync$" b+t the file ren a m i n g still oper a t e s $ for the sake of any s+b p o p +l a tio n s han dl e d by the sa m e P8O"ESS$ and to allo4 consist e n t E>TE9D29G of interr+ p t e d r+ns SPE"2AL 9OTE ;O8 -SE8S O; T7E P:, :E8S2O9 O; GALOPPSC See the sep a r a t e g+ide to P:, GALOPPS for inform a tio n on the han dling of files in the P:, .ersion$ 4hich is differe n t from the "norm al" .ersion disc+s s e d her e
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
'I
scalingO4indo 4 W A% 1Q 9ote that if scalingO4indo 4 is not A%$ sigm aOtr + n c and scal e m +l t Q1 1Q ,-ST be rem o . e d or com m e n t e d o+t$ as the progr a m 4ill 9OT try to Q1 1Q rea d the m Q1 sigm aOtr+ n c W G scal e m +l t W % 'G cro4dingOfact or W G con.Osig m aO c o eff W I con.int er . al W G rand o m s e e d W G 6'( Addition al fields are reD+ir e d for GALOPPS1,anyp o p s and for sol.ing per m + t a ti o nA typ e probl e m s 2f yo+ +se to+rn a m e n t selection !tsel e ct c#$ yo+ 4ill also nee d to ent e r a field for the to+rn a m e n t size !for eac h s+bp o p +l a ti o n$ in ,anypo p s# 2f yo+ elect cro4din g !TG#$ yo+ m ay also elect incestOre d + c ti o n ;or .al+ eA bas e d !i e $ 9OT per m + t a t i o n# probl e m s $ yo+ m ay elect pin.ersi on T G !other4is e$ specify pin.ersion W G# 2f yo+ choos e a+toc o n t r olOs el e ctio n W y$ the n inst e a d of bet a$ yo+ ent e r bet aOsOtilde 2n eac h cas e$ if yo+ omit a par a m e t e r $ 4he n yo+ r+n GALOPPS$ it 4ill tell yo+ 4hat it 4as looking for$ and 4hat it fo+nd inst e a d $ so it is eas y to correct 9e4 in 8ele a s e 0 0G and beyo n d$ ther e is a S7O8T form for ,anyp o p s r+ns$ +sef+l if ALL of the s+b p o p +l a tio n s !to be r+n by the proc e s s bein g start e d# are s+pp o s e d to +se the SA,E par a m e t e r s !e g $ pop +l a tion size$ cross o. e r rat e$ scaling m et h o d $ etc # 2n that cas e$ the +ser sho+l d set the par a m e t e r "allOs+b p o p sO + s eO s a m e O p a r a m e t e r s " W y !for yes# 2n that cas e$ the progr a m 4ill prom p t for !or rea d from file# the inp+t para m e t e r s for only O9E s+b p o p +l a tio n$ and 4ill +se the sa m e .al+ e s for all other s This incl+d e s the rando m n+ m b e r se e d in this cas e$ the rand o m n+ m b e r gen e r a t o r E+st contin + e s oper a ti n g 4itho+t res e e di n g 4he n a ne4 s+bp o p +l a ti o n is load e d in
1Q "an specify or chan g e any of the .al+ e s belo4 Q1 alph aOsiz e W nn n+ mfi el ds W nn 2; !not per m p r o bl e m __ alph aOsiz e W W 0# s+p e r + nifor m W !y^n# popsiz e W nnn printstrin g s W !y^n# pcross W RG $ % GS pm +t a ti o n W RG $ % GS !9OTEC is prob a bility1chr o m o s o m e for per m p r o bl e m W W y or if +sing m+lti m +t c$ and prob a bility1field oth er4is e# a+toc o n t r olOsel e ction W !y^n# 2; !a+toc o n t r olOsel e ction W W y# bet aOsOtilde W RG $ ` ( S ELSE bet a W RG $ ` ( S scalingO4indo 4 W RA% A 0GS !9OTEC m+st be A% 2; +sing rankA bas e d selectio n# 2; !scalingO4ind o4 X G# sigm aOtr + n c W RG A ` ( GS scal e m +l t W G G or R% Gn A ` 0 nS !9OTEC m+st be T% G 2; +sing rankA bas e d selection cro4dingOfact or W RG A ` (S !9OTEC G me a n s cro4din g off# 2; !cro4din gOfact or T G# incestOr e d + c ti o n W !y^n# con.Osig m aO c o e ff W RG A ` ( GS con.int e r. al W RG A ` % G G S 2; !to+rn a m e n t selection is com pil ed in# to+rn e ysiz e W n 2; !rest a rtfilepr efi5 2S *LA9? __ pop n o W W G# -SE8ADE;29ED 29P-TS$ 2; A93$ from appOd a t a $ appOinp + t$ etc $ GO 7E8E rand o m s e e d W %06 2; !n+ m b e r ofr+ n s T %# !The sa m e fields$ begi n ni n g after n+m b e r ofr + n s line$ go her e for eac h s+bs e D + e n t r+n #
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
'&
1Q i e $ start of ne4 r+n or first cycle e5t e n di n g a pre.io+ s r+n Q1 2; !rest ar tfilepr efi5 9OT *LA9? __ cycle W W G# chan g e s Ot oOt hi sOpo p W !y^n# 2; !cha n g e s Ot oOt hisOpo p W W y ^^ !rest a rtfilepr efi5 2S *LA9? __ !popn o W W start p o p n + m ^^ 9OT allOs+b p o p sO + s eO s a m e O p a r a m e t e r s ## Z 1Q "an specify or chan g e any of the .al+ e s belo4 Q1 alph aOsiz e W nn n+mfi el ds W nn 2; !not per m p r o bl e m __ alph aOsiz e W W 0# s+p er + nifor m W !y^n# gen s p e r c ycl e W nn popsiz e W nnn print strin gs W !y^n# pcros s W RG $ % GS pm + t a ti o n W RG $ % GS 1Q !9OTEC is prob a bility1chr o m o s o m e for per m p r o bl e m W W y or if +sing m+ltim + t c$ and prob a bility1field 2; not a per m p r o bl e m # Q1 pin.ersi on W RG $ % GS a+t oco n t r olOs el e c ti on W !y^n# 2; !a+toc o n t r olOs el e c ti on W W \y<# bet aOsOtilde W RG $ ` ( GS ELSE bet a W RG $ ` ( GS scalingO4indo 4 W RA% A 0GS 1Q !9OTEC m+st be A% 2; +sing rankA bas e d selectio n# Q1 2; !scalingO4indo 4 X G# sigm aOtr+ n c W RG A ` ( GS scal e m +l t W G G or R% Gn A ` 0 nS 1Q !9OTEC m+st be T% G 2; +sing rankA bas e d selectio n Q1 cro4din gOfact or W RG A ` (S 1Q !9OTEC G me a n s cro4din g off# Q1 2; !cro4din gOfact or T G# incestOr e d + c ti o n W !y^n# con.Osigm aOc o e ff W RG A ` ( GS con.int e r. al W RG A ` % G GS 2; !to+rn a m e n t selection is com pil ed in# to+rn e ysiz e W n 2; !+ser read s in inp+t d+ring this oper a tio n from appOd a t a $ appOinit# -SE8ADE;29ED 29P-TS$ 2; A93$ !in appOd a t a $ appOinit$ etc # 7E8E rando m s e e d W %06 [ [
(G
the n+m b e r of the first s+b p o p +l a tio n T72S proc e s s sho+ld calc+l at e the n+m b e r of the last s+bp o p +l a ti o n T72S proce s s sho+l d calc+l at e the n+m b e r of cycles !rest a rt s of eac h s+b p o p +l a tio n# to r+n$ 4hat D+a n tit y1fre D + e n c y of o+t p+ t is desire d !the "D+iet" flag$ 4ith settin gs from G !sho4 all o+t p+ t# to 6 !sho4 9O o+t p +t # the file prefi5 !) char a c t e r s or fe4er# for the ne4 checkp oi nt files to be 4ritt en d+ring this r+n !if non e gi.e n$ the prefi5 specified belo4 for rest ar t files!if any# is +se dB oth er4is e$ a defa +lt "sga ck p" is +se d# the file prefi5 !) char a c t e r s or fe4er# for the rest a rt files to initialize eac h s+bp o p +l a ti o n !if respo n s e is "5yz"$ then files 5yzGG ind$ 5yzGG ckp$ 5yzG% ind$ 5yzG% ckp$ $ !and also 5yz&& st t $ of r+nnin g pop+l a tion s from more tha n one proce s s# m+st e5ist in the c+rre n t direct or y# 2f resp o n s e is a "ret+r n" !i e $ no file prefi5 is gi.en#$ then the +ser is pro m p t e d for all of the par a m e t e r s for the r+n from the keybo a r d$ or inp+t par a m e t e r s com e from the file specified in the com m a n d line$ in the form a t describ e d abo. e +nd er "9e4 ;orm a t for 2np+t ;iles !or AA 9OT reco m m e n d e d AA as "nake d" resp o n s e s identic al to keybo a r d inp+t# the file prefi5 !/ char a c t e r s or fe4er# for the m as t e r file !if non e is specified$ defa +lt file prefi5 "mas t e r" is +se d 2f file can n o t be ope n e d or read$ the n pop+l atio n s are ass+ m e d to be inde p e n d e n t !no migr atio n# # 2; a ne4 r+n !not an e5t e n si o n# 4het h e r or not all s+b p o p +l a tio n s +se the sa m e par a m e t e r setting s the probl e m typ e !per m + t a ti o n or not# 4het h e r or not all s+b p o p +l a tio n s to be r+n by this proc e s s +se the sa m e par a m e t e r .al+ e s !so they are specified only onc e belo4# 2; 9OT a per m p r o bl e m !per m p r o bl e m W W G# the size of eac h field$ alph aOsiz e !X0 m e a n s differe n t sizes specified in appOs e tOo pti on s# the n+m b e r of fields on the chro m o s o m e !n+ mfield s# ;or a binary repr e s e n t a t i o n $ this is the n+ m b e r of bits on the chro m o s o m e B for nonA binary probl e m s $ the n+ m b e r of fields 9ote that for nonA per m + t a t i o n probl e m s $ the oper a ti o n s of cross o. e r$ m+t a tio n$ etc are don e AT field bo+n d a ri e s only ;or per m probl e m s $ the n+m b e r of fields det er m i n e s the set of integ e r s to be per m + t e d on the chro m o s o m e 2; a per m + t a t i o n probl e m !per m p r o bl e m W W %# the n+ m b e r of e5tra fields !T W GB T G only for "hybrid" reps AA G for most GALOPPS +sers# 2; not a per m + t a t i o n probl e m __ alph aOsiz e W W 0 4het h e r to +se s+p e r + nifor m initialization or not
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
(%
4het h e r to com pl et e the r+n 4itho+t offering the +ser any f+rth e r opport + nit y to modify the para m e t e r s of the s+bp o p +l a ti o n s !this D+e s ti on is aske d only in the first cycle# Then$ if a rest a rt file prefi5 4as gi.en !E>TE9D29G a pre.io+ s r+n#$ and allOpop sO+ s eOs a m e O p a r a m e t e r s W W y$ the n the r+n begin s 2f differe n t s+bp o p s +se differe n t para m e t e r s $ then the +ser ent er s the GA para m e t e r s for eac h s+b p o p +l a tio n in t+rn !from gen s p e r c ycl e thro+ g h rand o m s e e d !first s+bp o p# or con.int er . al !s+bs e D + e n t s+b p o p s#$ and the progr a m e5ec + t e s the specified n+m b e r of cycles 9ote that if rest ar tin g from store d files$ e5ch a n g e of chro m o s o m e s 4ith neigh b or s begin s 4ith the first cycle$ 4her e a s $ if the s+bp o p +l a ti o n s are E+st being initialized$ e5ch a n g e s 4ill com m e n c e only at the begin ni n g of the seco n d cycle# ;iles of "indi.id+ al s" 4ritte n by GALOPPS6 0$ are label e d 4ith the s+ffi5 " ind" A similar proc e d + r e is +se d to sa. e progr a m stat e$ in ckp files 4ritt e n at the end of the eac h s+b p o p +l a tio n<s e5ec + ti on in the cycle D+ring the r+nnin g of GALOPPS1,anyp o p s $ at the end of any s+bp o p +l a ti o n F s cycle in 4hich it achi e. e d a ne4 global best !+nsc al e d # fitnes s$ the progr a m print s a speci al o+t p +t m es s a g e describing the indi.id+ al fo+nd The +ser ma y find it +sef+l to sca n o+tp + t files for thes e speci al lines$ 4hich are the only one s cont ai ni n g the 4ord "Achie. e d "$ to track the progr e s s of the entire set of s+bp o p +l a ti o n s
ISLAND PARALL/LIS% 44
GALOPPS5%AN<POP S >OR SI%ULATION O> %ULTIPL/ SU=POPULATIONS
A m aEor cap a bility of the GALOPPS syst e m is the cap a bility to sim +l at e a n+ m b e r of "island" s+b p o p +l a tio n s r+nnin g in parallel The cap a bility is pro.id e d +sing a seco n d "main" progr a m $ ,anyp o p s $ and differe n t initialization ro+tin e s All other code$ and +ser files$ are com m o n or com p a ti bl e bet4 e e n the single pop +l a tion and par all el s+bp o p +l a ti o n s syst e m s The singl eA pop +l a tion .ersion$ called GALOPPS1One p o p $ has a checkp oi nt1r e s t a r t cap a bility$ 4hich ser. e s as the basis for the ne4 .ersion$ GALOPPS1,anyp o p s !an islan dA par all el gen e ti c algorit h m #$ 4hich allo4s the +ser to sim+l at e parall el oper a ti o n of m+ltipl e s+b p o p +l a tio n s$ 4ith periodic interc h a n g e of indi.id+ al s am o n g the .ario+ s s+b p o p +l a ti o n s This coars eA grain par all elis m is inten d e d to assist the +ser in a.oiding pre m a t + r e con. er g e n c e on diffic+lt m+lti m o d al probl e m s ;iles !pop+l atio n s# cre at e d .ia the checkp oi nt facility of GALOPPS1One p o p m ay be +se d to initialize r+ns of ,anypo p s$ and .iceA .ers a !gi.en the prop e r choice s of file na m e s # ,anypo p s can S2,-LATE par all el s+b p o p +l a ti o n s $ or$ in 8ele a s e 0 0G and beyo n d$ can +se m+ltipl e proc e s s o r s to r+n more than one s+b p o p +l a tio n sim +lt a n e o + sl y$ as describ e d belo4
seD + e n c e a set of s+b p o p +l a tio n s !label e d GG$ G%$ G0$ #$ first rea di n g a checkp oi nt file for one of the s+b p o p +l a ti o n s $ then rea di n g indi.id+ al s from "neigh b o ri n g" s+b p o p +l a tio n s as specified by the +ser$ r+nnin g for a specified n+m b e r of gen e r a ti o n s$ then 4riting a ne4 checkp oi nt file Then it proc e e d s to the ne5t s+bp o p +l a ti o n 2t oper a t e s in "cycles$" in 4hich eac h s+bp o p +l a ti o n recei. e s one t+rn On ,-LT2PLE proce s s o r s$ the s+b p o p +l a tio n s are r+n 4ith e5actly the sa m e sort of interco m m + n i c a t i o n and e5 ec + ti o n$ b+t mor e than one s+b p o p +l a tio n m ay be in e5ec + ti on AT T7E SA,E T2,E !tr+e par all elis m# This ne4 cap a bility of 8elea s e 0 0G and beyo n d is describ e d mor e f+lly in the section U8+nnin g ,A93POPS on ,+ltiple Proces s or s V 8egar dl e s s of the mod e of e5ec + ti on !one proce s s or ma n y proc e s s e s or m a n y proc e s s o r s#$ eac h s+b p o p +l a tio n has indi.id+ al control o.er all of its o4n par a m e t e r s $ incl+ding the n+ m b e r of gen e r a ti o n s to r+n in eac h cycle$ pop +l a tion size$ etc 7o4e. er$ som e prop er ti e s !like chro m o s o m e lengt h$ etc # are shar e d am o n g all s+b p o p +l a tio n s$ sinc e indi.id+ al s m+st be abl e to pass from one s+bp o p +l a ti o n to anot h e r$ -9LESS the Udiffere n tOre p s V flag is set !see that section# The e5ch a n g e of indi.id+ al s bet4 e e n s+bp o p +l a ti o n s is specified by a ne4 form of te5t file$ called a "m as t e r" file$ Q mst The m as t e r file is a tabl e 4hich cont ai n s the n+ m b e r of s+bp o p +l a ti o n s $ and for eac h$ its n+m b e r of neigh b or s$ follo4e d by the n+ m b e r of eac h neigh b o r$ and ho4 m a n y indi.id+ al s !and ho4 chos e n # are to be read from that neigh b or A S7O8T .ersion is also a.aila bl e for sit+ atio n s 4he n the patt er n of migr atio n is to be identic al for ALL s+b p o p +l a ti o n s !for e5a m pl e$ eac h s+bp o p +l a ti o n n rea d s the best indi.id+ al from the s+bp o p +l a ti o n s n+m b e r e d n- 1 and n + 1 !mod +lo npop s$ the n+ m b e r of s+bp o p +l a ti o n s# Details follo4 the e5a m pl eC 9OTEC 9e4$ in 8ele a s e 6 GC migr a n t s 4hich are to be chos e n "ran d o m l y" !i e $ not picke d bec a + s e they are the c+rre n t best of s+b p o p +l a tio n# are no4 P8EASELE"TED ;or eac h "ran d o m " indi.id+ al to migr at e$ thre e are chos e n at +niform rand o m $ the n to+rn a m e n t A select e d !i e $ the best of the thre e is picked# Th+s$ the migr atio n proc e s s acts as if emi gr a n t s 4ere chos e n from a pop +l a tion 4hich has alre a d y +nd e r g o n e som e selection !This is import a n t $ bec a + s e other4is e$ offsprin g of crosso . e r s and m+t a ti o n s in the donor pop +l a tion 4hich ha. e terribl e fitne s s might be picked to migr at e AA the ne4 one s ha. e 9OT 3ET be e n s+bEect e d to any selection # 2f the +ser has elect e d to +se migr atio nOinc e s tOr e d + c ti o n$ then EA"7 of the indi.id+ al s to be e5a mi n e d for possibl e migr atio n is alre a d y the 4inn er of a thre eA 4ay to+rn a m e n t selection
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
(6
chro mJ " ' chro mJ " ' chro m chro mJ " (' b e " t K ( chro mJ "
S9ORT ?/RSION #S<%%/TRICAL PATT/RN$ SA%PL/ %AST/R >IL/@ V /IPLANATION@ "2 b c n t M 4+ V Ther e are + "2 b p o p " W "4" me a n " a 2" e "a m e pat t e r n "2 b p o p M 3 0 V S2 b p o p 3 ha " 0 n ei g h b o r " n ei g h b o r M ( 0 * + V g e t " ' fro m "2 b p o p (' 0 ran d o m ! ch o " e n chro mJ " ' m.i .r. M * ' mi gNcr M + n ei g h b o r M * 0 * * V g e t " ' fro m "2 b p o p *' 0 ran d o m ! ch o " e n chro mJ " ' et c . Gen e r a >or m a t for %a" t e r >i e@
s+bc nt W X n + m b e r of s+b p o p s T or AX n + m b e r of s+bp o p s T s+b p o p W Xs + b p o pi n d e 5 T X n + m b e r of n ei g h b o r s T neigh b or W Xs + b p o pi n d e 5 T X;LAGT X mi gr a ti o nOinc e s tOr e d + c ti o n T X mi gr a ti o nOcro4 di n gO a m o + n t T etc 4her e s+bc nt $ if neg a ti . e$ m e a n s that the neigh b o r s 4ill be specified for only O9E s+b p o p +l a tio n$ and all oth ers 4ill +se "O88ESPO9D29G patt er n s !mod +lo npop s$ and neigh b o r patt e r n s "4rap aro+ n d " so that s+bp o p +l a ti o n "npop s" is really s+b p o p +l a tio n "G"$ etc $ ;LAG m e a n s C if positi.e$ the n+m b e r of rand o m l y chos e n indi.id+ al s to rea d from the specified neigh b o r Fs fileB if zero$ no chro m o s o m e s are to be rea d from that neigh b orB if neg a ti. e $ the *EST chro m o s o m e is to be rea d$ pl+s ^;LAG^A % addition al rand o m l y chos e n indi.id+ al s !so A% m e a n s best only$ A0 m e a n s best and one other$ etc #
('
,igrationOinc e s tOr e d + c ti o n !ne4 in 6 G# applies only to migr a n t s to be 8A9DO,L3 chos e n !i e $ 9OT applica bl e to the *EST indi.id+ al 4hen it is specifically reD+ e s t e d for migr atio n# ,igrationOinc e s tOr e d + c ti o n is the n+ m b e r of indi.id+ al s picke d at rando m !b+t eac h is the best of thre e candi d a t e s chos e n at +niform rand o m # from the donor s+b p o p +l a ti o n to com p a r e 4ith the c+rre n t best indi.id+ al of the recei.ing s+b p o p +l a tio n$ 4ith the one ;A8T7EST in 7am m i n g dist a n c e 4inning the right to migra t e Setting migr atio nOinc e s tOr e d + c ti o n to G or % effecti.el y t+rns off this option al m ec h a ni s m $ and eac h migr a n t to mo. e is select e d at rand o m !the best of 6 candi d a t e s # ,igrationOcro4di n gO a m o + n t !ne4 in 6 G# me a n s the n+m b e r of indi.id+ al s from the rec ei.in g s+b p o p +l a ti o n agai n s t 4hich the migr ati n g chro m o s o m e 4ill be "cro4d e d "$ 4ith the one "LOSEST in 7am mi n g dist a n c e to the migra n t select e d to be be repl ac e d by the migr a n t This is similar to DeHongA style cro4din g$ b+t applied in the cont e 5 t of immigr a n t s rath er tha n ne4ly gen e r a t e d offsprin g Settin g it to % or G m e a n s that a single indi.id+ al is select e d at +nifor m rando m for replac e m e n t ;or sim plicity$ the m as t e r file is store d in m e m o r y as a fi5edA size tabl e$ holding a m a5i m + m of (G s+bp o p +l a ti o n s This is readily alter a bl e by the +ser$ if ne e d e d This m ak e s it eas y for the +ser to imple m e n t dyn a m i c strat e gi e s for migra tion$ if desire d$ by cha n gi n g the tabl e bas e d on 4hat e . e r criteri a the +ser est a blish e s $ from one of the app callback ro+tin e s
((
the inp+t line to in.oke ,anypops process on each processor !all e5cept the ret+rn key#$ and to start them nearly together by hitting the ret+rn key on the process o4ning s+bpop G$ then the others in rapid s+ccession Then$ to 4hate.er e5tent the processors are similar$ and the n+mber of s+bpops1processor is balanced$ they 4ill tend to maintain similar progress in sol.ing the problem !9OTEC There is no proced+ral problem if they r+n as some4hat different rates ,anypops simply takes any s+bpop+lation<s immigrant!s# from the specified neighbor<s LAST SA:ED checkpoint file$ so if some processors are slo4er$ the migrants they pro.ide 4ill simply be less Uad.anced V 7o4e.er$ as migration occ+rs thro+gho+t a str+ct+re !at least if all nodes of the mst file<s graph are in some cycle# then slo4erAcalc+lating s+bpop+lations 4ill tend to Ucatch +pV beca+se of immigrants from fasterAmo.ing ones$ altho+gh that effect is not perfect$ and may allo4 slo4er pop+lations to tend to4ard mimicking the searches of their neighbors if the migrants are able to Utake o.erV 7o4e.er$ e.en in that case$ the di.ersity of the recei.ing s+bpop+lation helps to broaden the search aro+nd the ne4$ highlyAfit immigrants$ at least for some time$ so the slo4er processor is doing +sef+l 4ork The theory for modeling and describing these phenomena is interesting and not yet 4orked o+t # '# E5amine the o+tp+t file created by each process E5amine the stt file for global s+mmary information abo+t the best .al+es fo+nd by A93 process!or# at any point in time 9OTEC The c+rrent .ersion of the ne4 Tcl1Tk G-2 4orks only 4ith a single ,anypops process$ and does not kno4 abo+t the global stt file That 4ill be impro.ed in f+t+re releases 7o4e.er$ the +ser may -SE the G-2 !as a separate process on each processor# to initiate each ,anypops process and to plot its res+lts$ so long as each process +ses a different o+tp+t file name !and hence$ a different plot file name for the G-2 to +se#
Roa d >2n c ti o n
Hohn 7ollan dF s %&&6 8oyal 8oad ;+nction !challe n g e probl e m to att ai n 8oyal 8oad le.el 6 4ithin %G$GG G f+nction e.al+ a tio n s# has be e n cod e d as a GALOPPS applicatio n e5 a m pl e $ and is .ery +sef+l for learnin g ho4 to select the most appro p ri a t e options and t+n e the ()
Erik D Goodm a n $ GA8AGe$ ,ichiga n State -ni.ersity
par a m e t e r s of a GA$ esp e ci ally for a binary repr e s e n t a t i o n probl e m 2t is diffic+lt to m e e t 7ollan d<s challen g e for opti miz ation of this f+nction in the reD+ire d n+ m b e r of e.al + a ti o n s ;iles appro yr d in and appro yr / in are sa m pl e inp+t files for +se 4ith Onepo p and ,anypo p s$ resp e c ti. el y$ and sho+l d be +nd e r s t a n d a b l e to all +ser s plan ni n g to 4rite their o4n application s +sing +tility fields$ +serA gen e r a t e d o+t p +t $ etc At 8elea s e 6 G$ addition al e5a m pl e s of inp+t files asso ci a t e d 4ith the 8oyal 8oad f+nction ha. e be e n add e d Thes e files incl+d e a seD + e n c e of fi.e$ called royrd st % i n$ $ royrd st ( i n$ a bat ch file$ royalrd b a t !DOS .ersion# or royalrd s h$ -ni5 .ersion#$ 4hich in.oke s the m !4ith som e file copyin g inters p e r s e d # $ and thre e mst files$ 60iso p o p m s t $ /to't o 0 m s t $ and 6&fe e d b k m s t $ to de m o n s t r a t e a possi bl e appro a c h to 7ollan dF s 8oyal 8oad challe n g e probl e m 2t de m o n s t r a t e s the fle5ibility of the GALOPPS fram e 4 o rk in m a ni p +l a ti n g m+ltipl e pop+l a tion s$ b+t is inten d e d only as an e5 a m pl e for the sophistica t e d +ser planni n g to +se tim eA .aryin g archit e c t +r e s for m+ltipl e pop+l a tion r+ns The shell script$ royalrd s h$ or bat ch file$ royalrd b a t $ ill+stra t e one 4ay in 4hich a st+d e n t +se d GALOPPS to att ack 7olland<s challe n g e $ +sing a .ariet y of config+r a tio n s of s+b p o p +l a tio n s and migr atio n patt e r n s d+ring a series of r+ns 2t mak e s +se of files royrds t % i n$ $ royrds t ( i n
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
(I
G$%$0$6$ n + m fi el d s1 0 Th+s$ it is conc ei. a bl e that in.ersio n 4ill help cross o. e r find good sol+tion s by rearr a n gi n g the chro m o s o m e so that the relat e d pairs of fields !eD+idist a n t from the cent e r# act+ ally app e a r ne5t to eac h other on the chro m o s o m e for som e period of cross o. e r$ so that good pairs$ once fo+nd$ can ten d to be pres e r . e d +nd e r cross o. e r 9+mfields sho+ld be ent e r e d as an e.e n n+m b e r
(/
APPIIIII.C 44 A "= an7" Tem p a t e for De& e o p m e n t of Ne A "Ordin ar !" GALOPPS App ic a t i o n "
A copy of this code sho+l d be +se d as the te m pl a t e for de. el o p m e n t of a ne4 "ordin ary opti miz ation" application$ +nles s the +ser finds anot h e r e5a m pl e applicatio n pro.id e d is closer in form to the ne4 probl e m to be sol.e d ;or hybrid or mi5edA type applicatio n s !i e $ 4her e bot h an opti m al orderin g of som e fields and .al+ e s for som e par a m e t e r s are so+g h t#$ te m pl a t e app h yb 5 5 c sho+ld be +se d inst e a d $ as it is alre a d y prep a r e d to interfa c e 4ith the mi5s et + p c progr a m for definition of the per m + t a t i o n s+bfields and position s+br a n g e s ne e d e d ;or m a n y applicatio n s$ the +ser 4ill nee d only to typ e in a fe4 lines in the obEf+nc!#$ and can +se the rem ai n d e r of the file 4itho+t alter a tio n As application s beco m e .ery com pl e 5$ mor e of the facilities 4ill nee d to be +tilized
*/
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
(&
/* USER ABSOLUTELY MUST FILL IN TO DEFINE THE USER'S PROBLEM. OTHERS ARE /* OPTIONAL, DEPENDING ON THE NATURE AND COMPLEXITY OF THE PROBLEM. /* /* /* /* /* This is where you code the objective function for your particular problem, getting the genotype from critter->chrom, and then placing the raw (unscaled) fitness for critter into critter->init_fitness. Another action which must be accomplished is to increment the current evaluation number (neval) and record it in critter->neval.
*/ */ */ */ */ */ */
struct individual *critter; { neval++; local_cycle_neval++; critter->neval = neval; /* /* /* /* /* The LEAST that any application can do is to replace the line below with a valid statement that assigns a raw fitness to the genotype (chromosome) passed in (pointed to by critter). The constant below is just so you can check that this "blank" template indeed compiles and runs with the rest of the system as you have configured it. */ */ */ */ */
critter->init_fitness = 10.; }
void app_set_options() /* This routine is called once when a new run or extended run is started. */ /* It must set a value for all of its global variables, although they may */ /* be modified later (in other app_ functions) during the run. */ { avg_mut_width = 3; /* Must set if using multimut.c. Value is expected /* number of adjacent fields (bits, if binary) to */ /* set randomly at once. */ stochastic = 0; /* /* /* /* elitism = 1; /* Must set to 0 or 1 to specify whether or not */ fitness function always returns same value for a */ given chrom.-- If always same, set stochastic = 0 */ to avoid extra evaluations; if changes with env't */ or randomly, set = 1 */ */ */
/* Must set to 0 or 1 to determine whether or not /* best indiv. is always preserved in next generation */ /* (1 = yes). */ elitism &= !stochastic; /* Note that elitism is reset to 0 automatically /* if user specifies stochastic flag = 1, since the */ /* changing fitness makes it impossible to insure that*/ /* what was once best is still best. */
*/
user_supplied_initialization = 0; /* Make it TRUE (1) if you will */ /* supply code to initialize the */ /* individuals in oldpop below, in */ /* routine app_user_init_pop(), */ /* instead of using one of the */ /* "standard" methods supplied with*/ /* GALOPPS. */ call_app_user_does_migration = 0; /* Flag, if set, allows user full */ /* control of migration, from */ /* app_user_does_migration(), below */ using_inversion = 0; /* Set flag to 1 (TRUE) if will use inversion to */
)G
/* /* /* /* /* /* /* /* different_reps = 0 || /* /* /* /* /* /* /* /* /* /*
alter placement of fields on chromosome, with */ remapping of fields to "standard" positions at */ each evaluation, before objective function is */ called. It is set automatically if pinversion>0, */ but user may set manually here if has ever used */ inversion, so unmapping, translation, etc., will*/ continue to occur, even if pinversion now set */ to 0. */ using_inversion; You set to 1 (TRUE) if will use different reps */ in different subpops. If TRUE, and if the */ difference is NOT ONLY INVERSION, then YOU MUST*/ also supply code to transform ALL of the */ migrating individuals, in app_transform_migrant*/ in the skeleton below, and code below in */ app_transform_chrom_to_std to transform a */ chromosome into its STANDARD representation */ (used in the objective function objfunc(). */ Always 1 if inversion is being used. */
if (different_reps && !using_inversion) { /* User is using different representations in various subpopulations, */ /* so must be supplying app_transform_chrom_to_std() and */ /* app_transform_migrant(). User must also set the variables */ /* max_chromsize_among_all_subpops and max_numfields_among_all_subpops */ /* in the lines directly below, and delete the print and the call to */ /* exit() which are inserted as a reminder to the user. */ fprintf(stderr, "\n*** You have selected different_reps and are not "); fprintf(stderr,"using inversion, \nso you MUST specify here in app_init"); fprintf(stderr, " the maximum sizes of chromsize and numfields.***\n"); exit(-9); } else { max_chromsize_among_all_subpops = -1; /* set to illegal value, as flag */ max_numfields_among_all_subpops = -1; /* set to illegal value, as flag */ } }
void app_set_field_sizes() /* Routine called ONLY IF user inputs alpha_size as < 2, meaning fields have /* different lengths. In that case, user MUST provide code here to set the /* array field_sizes[i], 0<=i<numfields, to the number of different codes /* possible in the ith field (codes will vary from 0 to field_sizes[i] - 1). /* Data may be set in executable statements, or via initializers. If the /* problem uses different representations in different subpopulations, and /* if that affects the field sizes, then this code must set the proper sizes /* for each subpopulation, using popno to tell which subpop is being /* initialized. Elsewhere, the program will also automatically use the /* field_sizes to set array field_ends, to the final bit number (in /* [1, lchrom]) of each field. */ { int i; /* field_sizes[0] = 24; Replace with code to set them to the sizes /* you actually want. /* ... */ field_sizes[9] = 24; Replace with code to set them to the sizes /* you actually want. */ */
*/ */ */ */ */ */ */ */ */ */
/* }
*/ */
void app_read_prob_params()
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
)%
/* /* /* /* /* /* /* /* /* /* /* /* /* { }
Application dependent data input, called ONCE at start of run (whether */ started from input parameters or EXTENDED from restart files) by main */ program BEFORE it reads the "standard" fields like numfields, etc. */ (Note: Onepop may do many RUNS, and this is called at start of each). */ Values read here are usually stored in static variables */ declared at the top of the app file, so they may be used in any of the */ user callback routines, but do NOT have to be read/written to the */ checkpoint files. Thus, user should read these values ALSO when a run is restarted from saved checkpoint files. If values MUST be preserved ACROSS runs (i.e., saved when checkpointing and reread when restarting) then that must be done in app_write_ckp_hdr() and app_read_ckp_hdr(), below, and the variables will be saved with EACH subpopulation. Note: values like numfields, alpha_size, etc., are NOT yet known when this is called.
*/ */ */ */ */ */
)0
void app_data(REVISING) BOOL REVISING; /* Application dependent data input, called by initdata() and revisedata(), */ /* just after user answers questions about crossover rate, scaling, */ /* convinterval, etc. Ask input questions here which might be different for */ /* each subpopulation, and write (and read) the values to the checkpoint */ /* header file by putting code into app_write_ckp_hdr() and app_read_ckp_hdr()*/ /* below. Values like numfields, alpha_size, etc., are already known when */ /* this routine is called. */ /* NOTE: app_data is called whenever the user is initializing (from user */ /* input, flag REVISING == FALSE) or revising (flag REVISING == TRUE) input */ /* data (but only once if flag all_subpops_use_same_parameters is TRUE). */ /* HOWEVER, IF user is RESTARTING from saved checkpoint files, and does NOT */ /* ask to revise any parameters, this routing IS NOT CALLED. Therefore, for */ /* user data (tables, etc.) which you want to read in on a RESTART, also, */ /* use app_init to read those data, as it is called whether restarting or */ /* starting from the beginning. (Put it inside the "firstcall" logic.) */ { if (REVISING) return; }
void application() /* this routine should contain any application-dependent computations /* that should be performed before each generation. called by main() { }
*/ */
void app_init() /* Application dependent initialization routine called by initialize() for */ /* EACH subpopulation each cycle, whether started from input or restarted */ /* from a restartfile, and whether all_subpops_use_same_parameters is TRUE */ /* or FALSE. Called after individuals are malloc'd and after individuals */ /* are read from .ind file (on a restart), but before random initialization*/ /* of all individuals (if initial start) or of individuals NOT read (if */ /* restarting). */ { static int firstcall = 1; /* Any code you want to add to app_init goes below. */ if (firstcall) { firstcall = 0; /* Put here any code you want to do just once in a run, regardless of */ /* how run was started. */ return; } /* Put here any code you want run for each subpopulation at the beginning */ /* of its execution in each cycle. */
return; }
void app_user_init_pop(starting_guy_index) /* If none of the standard methods supplied with GALOPPS will work for */ /* initializing the individuals in oldpop at start of run, or for creating */
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
)6
/* new "random" guys when popsize is expanded, or when convergence triggers*/ /* partial re-initialization, etc., then you can create the individuals */ /* here, filling oldpop[starting_guy_index] through oldpop[popsize-1]. */ int starting_guy_index; { }
)'
void app_after_random_init() /* Application-dependent changes or redoing of initialization, called after */ /* the random initialization is performed and (on restart) individuals have */ /* been read in from restart file. */ { } void app_initreport() /* Application-dependent initial report called once by initialize() */ { } void app_report() /* Application-dependent report, called each generation by report() */ { /* Normal app-dependent end-of-generation printing done here. */ } void app_decide_if_converged(flag, num_to_replace_if_converged) /* This routine is called at the end of each generation of each subpopulation /* to give the user the option of checking for convergence of the /* subpopulation, or other condition. When (if) that happens, if user wants /* simply to reinitialize all or part of the subpopulation to random values /* and keep running, user can just set flag to 1 and set /* num_to_replace_if_converged to the desired number to reinitialize. If /* user wants to take some other action, should set flag = 2 and code the /* desired actions in routine app_when_converged() below. */ int * flag; int * num_to_replace_if_converged; { }
*/ */ */ */ */ */ */
void app_when_converged() /* This routine is called if user's routine (above) app_decide_if_converged */ /* ever sets its flag to 2. The intent is that user can here stop a run, or */ /* change any GA parameters as desired, for the current subpopulation, etc. */ { }
void app_quiet_report() /* Routine to be called when other output is suppressed, to check for * trigger for special user-defined output, or to print desired output even * when running in quiet mode. Helpful when doing many long runs. * User can do checking for last generation of a Manypops run, for example, * in case want to reset quiet to 0 for a final summary printout, etc. */ { /* Below, supply any logic and printing to be used in quiet mode * operation, when most other normal output is suppressed. */ /* for example, print warning ONE TIME if quiet flag is on, so user knows * why doesn't get any output. */ if(quiet < 3 && popno == 0 && cycle == 0 && gen == startgen) fprintf(outfp, "\n Flag quiet > 0, normal output suppressed.\n"); /* Logic below starts printing end of next-to-last generation of last
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
)(
* cycle, for final summary. (Works for GALOPPS/Onepop (ncycles == 0) */ /* and GALOPPS/Manypops) */ /* To enable this logic, remove comment delimiters on next line. /* if((cycle == ncycles - 1 || ncycles == 0) && gen == maxgen - 2) quiet = 0; */ }
))
void app_new_global_best_report() /* Application-dependent report, called by globalstats() in statisti.c when */ /* GALOPPS/Manypops is run (not used by GALOPPS/Onepop runs). It is called */ /* after the LAST GENERATION of the cycle of EACH subpopulation. That means */ /* that some things MAY have changed (inversion pattern, etc.) in some */ /* generations BETWEEN when this best individual was found and now, when it */ /* is to be printed, so user must be aware of that in writing outputs. Also */ /* called in checkhdr.c to print the same values (local_bestfit.xxx) when */ /* that local best turns out also to be the best among all pops, all */ /* processes, so is EQUIVALENT at that time to printing all_pops_bestfit.xxx)*/ /* It should print out any app-dependent fields user will want to see. */ /* (This call is not made at all from Onepop -- single-population runs). */ { /* /* /* /* /* /* /* } void app_print_strings() /* Application-dependent string printer, called by report() and initreport() */ /* if flag printstrings == 1, just after it has finished printing the */ /* chromosomes in "standard" binary format. (Using this is OPTIONAL.) */ { } User can print from utility fields, call output routines, etc. */ to print whatever information is wanted when a new best individual of */ all populations on all processes (processors) is found. Since the */ performance measures, etc., have NOT yet been updated in the .stt */ file, user should now output local_bestfit.xxxxx, etc., not yet */ all_pops_bestfit.xxxx, which will be updated AFTER this print is done.*/ Use of this callback is OPTIONAL. */
void app_conv_rept() /* Application-dependent report, called by reptconv() (in report.c) */ { } BOOL app_user_does_migration(IndArray, filename, number_to_migrate, want_best , migration_crowding_amount, ChromSize , migration_incest_reduction, BestInd , migrant_holder) /* In this routine, if the user has set the global variable (in app_init) */ /* call_app_user_does_migration, and user is NOT using inversion, then the */ /* user HERE is allowed to perform migration among subpopulations in any */ /* manner the user chooses. ChromSize is the number of unsigneds in the */ /* chromosome of the DONOR population, and global chromsize is the number of*/ /* unsigneds in the chromosome of the RECEIVING population (in IndArray). */ /* IndArray is the receiving population (the global variable is oldpop), */ /* and transfer occurs at the start of a cycle); the index of the best */ /* individual in oldpop (in internal form, without one added) is in BestInd.*/ /* For guidance in performing the required operations, see routine */ /* GetMigrants() in file checkrd.c, where the system-provided migration */ /* capabilities (migration_incest_reduction, migration crowding, inversion, */ /* etc., are all done. */ struct individual *IndArray; char *filename; int number_to_migrate; BOOL want_best; int migration_crowding_amount, ChromSize, migration_incest_reduction; int BestInd; struct individual * migrant_holder;
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
)I
{ return TRUE; }
)/
BOOL app_transform_chrom_to_std(mapped_saved_chromosome, chrom_for_objfunc) /* If the user is using different representations for different subpops, */ /* but is NOT using the system-provided inversion code, here is where the */ /* user must supply the code to transform a migrant individual's chromosome */ /* (in mapped_saved_chromosome) from its "mapped" representation in the */ /* subpopulation to the STANDARD representation, which is the one the user */ /* uses in defining the objective (or fitness) function, objfunc. The */ /* "standard rep" chromosome must be returned in chrom_for_objfunc, which is*/ /* a local name for critter->chrom, the chromosome passed to objfunc(). */ /* The user can use any of the global variables, or local variables defined */ /* at the top of this file, to determine which supopulation this is (popno),*/ /* and what characteristics THIS representation may have (local variables, */ /* utility fields, etc.) */ unsigned *mapped_saved_chromosome; unsigned *chrom_for_objfunc; { int ii; /* /* /* /* /* /* The commented-out code below does the "identity" transformation on the chromosome -- i.e., copies one to the other. If the user is doing some transformation OTHER than the system-provided inversion, user should change the first loop below to perform the actual transformation process. Finally, user must make the function return TRUE if successful. */ */ */ */ */ */
/*
/* NOTE: Next loop must be modified if subpops have different chromosome */ /* representations -- user must do a transformation, not a copy. */ for (ii=0;ii<chromsize;ii++) { chrom_for_objfunc[ii] = mapped_saved_chromosome[ii]; } return TRUE; return FALSE;
*/ } BOOL app_transform_migrant(migrant_holder, DonorChromSize, newguy, filename) /* If the user is using different representations for different subpops, */ /* but is NOT using the system-provided inversion code, here is where the */ /* user must supply the code to transform a migrant individual (in a struct */ /* individual pointed to by migrant_holder) from its donor pop rep to its */ /* popno (a global, the current "receiving" population) representation, */ /* returning the transformed guy in newguy, which has a chromosome length of*/ /* RecipientChromSize unsigneds. If user is using inversion, not user's */ /* "own" transformation, then this routine is not called, so may be left in */ /* its "commented out" form, which is the the IDENTITY transformation (i.e.,*/ /* copy the individual unchanged from migrant_holder to newguy. */ /* A pointer to the individual to migrate, as read from donorpop, and its */ /* DonorChromSize, are provided, as is the filename of the recipient pop. */ /* After transforming the individual, the user should place it into new_guy */ /* and return TRUE if successful. */ struct individual *migrant_holder, *newguy; int DonorChromSize; char *filename; { int ii; /* The commented-out code below does the "identity" transformation. If user */ /* is doing some transformation OTHER than the system-provided inversion, user*/ /* should change the first loop below to perform the actual transformation */ /* process. Finally, make the function return TRUE if successful. */
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
)&
/* NOTE: limit chromsize in next loop below must be revised if subpops have /* different chromosome sizes... user must do a transformation, not a copy. /* for (ii=0;ii<chromsize;ii++) { newguy->chrom[ii] = migrant_holder->chrom[ii]; }
*/ */
IG
newguy->parent[0] = migrant_holder->parent[0]; newguy->parent[1] = migrant_holder->parent[1]; newguy->xsite[0] = migrant_holder->xsite[0]; newguy->xsite[1] = migrant_holder->xsite[1]; newguy->fitness = migrant_holder->fitness; newguy->init_fitness = migrant_holder->init_fitness; newguy->neval = migrant_holder->neval; sys_util_copy_utility(newguy->utility, migrant_holder->utility); return TRUE; */ return FALSE; } void app_generate() /* Opportunity to do any desired (application-dependent) operations at the */ /* end of each generation of each subpopulation. */ { } void app_stats(pop) /* Application-dependent statistics calculations called by statistics() at /* the end of each generation. struct individual *pop; { /* See approyrd.c for an example. */ } void app_before_inversion() /* Allow user to perform any desired application-specific actions before */ /* calling the inversion routine. Only called when an inversion WILL be */ /* performed on the current subpopulation at the current generation. */ { }
*/ */
BOOL app_write_ckp_hdr(fp) FILE *fp; /* Application-dependent callback routine user may use for writing /* any needed app-specific variables into a checkpoint file. { /* See approyrd.c for an example. */ return TRUE; } */ */
BOOL app_read_ckp_hdr(fp) FILE *fp; /* Application-dependent callback routine user may use for reading back */ /* from the checkpoint header file any fields added to the checkpoint */ /* header by the user. */ { /* See approyrd.c for an example. */ return TRUE;
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
I%
I0
int GetUtilitySize() /* Application-dependent callback routine user must use to tell program /* the size of the utility field to malloc for each chromosome. Used /* to compute the amount of space needed per individual in the checkpoint /* files. { /* See approyrd.c for an example. */ return 0; }
*/ */ */ */
int GetMaxUtilitySize() /* User must here return 0 (utility fields not used) or GetUtilitySize */ /* (if different_reps are NOT used), or the size (bytes) of the LARGEST */ /* utility field used by ANY subpopulation, if different_reps includes use */ /* of utility fields of different sizes. */ { int nbytes; nbytes = GetUtilitySize(); if (nbytes) { if (different_reps) /* Here, return size of largest utility field used by any rep. */ /* nbytes = xxxxxx; */ return nbytes; else return nbytes; /* same as GetUtilitySize if !different_reps */ } return nbytes; }
DOS Format
GALOPPS 6 0 is b+ndled 4ith the dEgpp <"< compiler for DOSC Disk or directory contains dEgpp$ and belo4 it$ a s+bdirectory containing galopps6 0 Galopps6 0 has a s+bdirectory str+ct+re as follo4sC cCNdEgppNgalopps6 0 Nsrc c files comprising "core" of galopps6 0 Nincl+de h files incl+ded in all files in galopps system Ndocs doc+mentation for galopps system N4ork directory for de.eloping ne4 applications NG-2 !9ot yet a.ailable for DOS$ b+t forthcomingB a.ailable no4 for -ni5 only# Ne5amples Napp Goldberg<s first e5ample problem Napp% Goldberg<s second e5ample problem Napp0 Goldberg<s third e5ample problem Nbtsp *lind Tra.eling Salesperson Problem Nroyalrd Hohn 7olland<s 8oyal 8oad "hallenge Problem Ndemoalph Demo of a problem 4ith nonAbinary representation Ndemoin. Demo of a problem +sing in.ersion Ndiffreps Demo of a problem +sing different reps !inEection architect+re# NdeEongfn ;o+r of ?en DeHong<s fi.e benchmark f+nctions Ngga *in Packing e5ample and code for ;alkena+er<s Gro+ping Genetic Algorithm
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
I6
representation and operators Nsrc contains the "core" c files for galopps6 0B Nincl+de contains the h header files N4ork and the s+bdirectories +nder Ne5amples contain e5ample application U cV$ inp+t$ master$ etc $ files All of the te5t files in this directory are in "DOS standard file format " DEgpp +sers m+st +se the makefile in 1src first to compile the "core" ro+tines$ then s4itch to an e5ample directory and +se the makefile there to create a ,anypops or OnepopB then they m+st r+n "coff0e5e ,anypops"$ for e5ample$ to create the e5ec+table file ,anypops e5e -sers may need to perform minor editing on the makefiles$ to s+pply the correct compiler name !cc$ gcc$ ""$ etc #$ for e5ample
Unix Format:
1galopps6 0 1src c files comprising "core" of galopps6 0 1incl+de h files incl+ded in all files in galopps system 1docs doc+mentation for galopps system 14ork directory for de.eloping ne4 applications 1G-2 !9ot yet a.ailable for DOS$ b+t forthcomingB a.ailable no4 for -ni5 only# 1e5amples 1app Goldberg<s first e5ample problem 1app% Goldberg<s second e5ample problem 1app0 Goldberg<s third e5ample problem 1btsp *lind Tra.eling Salesperson Problem 1royalrd Hohn 7olland<s 8oyal 8oad "hallenge Problem 1demoalph Demo of a problem 4ith nonAbinary representation 1demoin. Demo of a problem +sing in.ersion 1diffreps Demo of a problem +sing different reps !inEection architect+re# 1deEongfn ;o+r of ?en DeHong<s fi.e benchmark f+nctions 1gga *in Packing e5ample and code for ;alkena+er<s Gro+ping Genetic Algorithm representation and operators A main directory galopps6 0 contains ) s+bdirectoriesC src$ incl+de$ docs$ G-2$ 4ork$ and e5amples The src s+bdirectory contains all of the GALOPPS6 0 files 4hich are 9OT applicationAspecific 2t m+st be compiled before any application can be r+n To compile$ enter the src s+bdirectory and type "make" The makefile contains directi.es to generate all of the o mod+les 3o+ sho+ld first edit makefile to select the compiler options yo+ 4ant !for e5ample$ Ag for deb+ggerAcompatible code$ A5O0 for a high le.el of optimization on SPA8"4orks compiler$ etc # This make prod+ces no e5ec+table !no linking is done#$ b+t generates all b+t the applicationAspecific " o" files S+bdirectory incl+de contains the header ! h# files common to all applications S+bdirectory 4ork contains a "blank" application template$ app55555 c$ 4hich +sers "c+stomize" to program their o4n applications S+bdirectory G-2 contains the Tcl1Tk code for the ne4 !optional# Graphical -ser 2nterface$ 4hich has been tested to date only on S+n Solaris systems S+bdirectory e5amples contains many other s+bdirectories$ of e5ample applications 2n each s+bdirectory is one or more c files !4hich are deri.ed from app55555 c#$ and e5ample inp+t files$ e5amples of any datasets needed by the application !or programs to generate them#$ mst files describing migration patterns for the parallel e5ample$ etc To r+n any application$ the +ser sho+ld enter its directory$ type "make" or "make ,anypops" to prepare for a parallel GA r+n$ or "make Onepop" to prepare for a singleA pop+lation r+n Then typing "Onepop" or ",anypops" 4ill in.oke the GA in interacti.e mode Typing "Onepop Ai abcdef in" or ",anypops Ai abcdef in" 4ill r+n the GA 4ith inp+ts taken from the file abcdef in$ and typing "Onepop Ai abcdef in Ao abcdef o+t" or ",anypops Ai abcdef in Ao abcdef o+t" 4ill r+n the GA 4ith inp+ts from the first file and all b+t error o+tp+t going to file abcdef o+t See earlier sections for f+ll description of command line parameter o.errides$ etc =hen +sing yo+r O=9 application file !deri.ed from app55555 c in 1galopps6 014ork#$ yo+ need to edit the ,akefile so the " APPW " line lists yo+r c files for this application The nat+re and +se of all files is e5plained in Appendi5 OneC A+5iliary ;iles GALOPPS1On e p o p and 1,anyp o p s shar e ne arly all files AA the e5c e p ti o n s are the main progr a m s !eac h has its o4n$ label e d m aino n e c and m ain m a n y c$ resp e c ti. el y# and
I'
initialization ro+tin e s !start + p c for Onepo p and inits+ b p c for ,anypo p s#$ pl+s file m as t e r c only for ,anyp o p s The t4o progr a m s +se e5 actly the sa m e application files !app c$ app % c$ app 0 c$ appro yr d c$ app b t s p c$ app G t o & c$ app5 5555 c$ appr ally c$ app % p e r m c $ app % p o s n c$ app % b o t h c$ app m a t c h c$ etc # They +se identical form a t s for checkp oi nt and rest ar t files =hen editing any of the files distrib+t e d 4ith the GALOPP Syst e m $ yo+r TA* char a c t e r sho+l d be set eD+i.al e n t to / SPA"ES$ to mat c h the setting +se d 4hen the files 4ere crea t e d Other4is e$ yo+r listing 4ill app e a r to be stran g el y inde nt e d The F"F cod e r+ns +nm o dified on -ni5 syst e m s !test e d on S+n'$ 7P &GG G1 I>>$ DE"st ation$ and 9e>T syst e m s #$ on P"Fs !test e d +nd er ,SDOS ( G and ) G and +nd e r =indo4s 6 %$ 4ith dEgp pB 4ith *orlan d "K K $ +sing only the F"F feat +r e sB and +sing ,icrosoft F"F#$ and on ,acintos h syst e m s A com pil eA tim e choice defining P8OTOT3PESOA""EPTED han dl e s the com piler differe n c e s enco + n t e r e d so far !A9S2Atyp e or the older ?A8Atype <"<# The syst e m 4as m a d e so it can be com pile d by A9S2Acom pli an t F"F com pilers 4ith mod e r n protot yp e decl ar a ti o n s $ or 4itho+t the A9S2 .ariation s =e ha. e pro.id e d t4o form s of decl ar a ti o n for f+nction s$ in files sgaf+ n c h and sga p + r e h 2f yo+ lea. e L d e fi n e P8OTOT3PESOA""EPTED at the top of files sga h and e5t er n al h$ they 4ill do f+ll A9S2Astyle protot yp e checkin g$ +sing protot yp e s in file sgaf+ n c h 2f yo+r com piler obEect s to thes e protot yp e s $ com m e n t o+t the line L d e fi n e P8OTOT3PESAA""EPTED at the top of the sga h and e5t er n al h files$ and the n the olderA style declar a ti o n s in sga p + r e h 4ill be +se d inst e a d 2n that cas e$ +se e5tr a ca+tion that the type s of all arg+ m e n t s in any f+nction s yo+ crea t e for calling from the app55 555 c ro+tin e s m at c h their decl ar a ti o n s $ for less checking is don e 9OTEC On m a n y syst e m s $ som e "4arnin g" me s s a g e s 4ill be gen e r a t e d d+ring com pil atio n$ as the "skelet o n" callback str+ct +r e ca+ s e s ma n y .ariabl e s to be decl ar e d 4hich are not +se d$ etc This sho+l d NOT be a ca+ s e for alar m 4he n GALOPPS com pilation s are don e ;or -ni5 syst e m s $ m ak efiles are incl+d e d $ 4hich can easily be modified to crea t e 4hat e . e r config+r a tio n of mod +l e s !oper a t or s$ selectio n m et h o d s $ etc # is desire d On DOS syst e m s !oth er than 4ith dEgp p$ 4hich can +se the -ni5 mak efiles#$ yo+ m ay sim ply follo4 the direction s gi.en belo4 to com pil e and link the nec e s s a r y mod +l e s 4ith 4hat e . e r tools yo+ are familiar
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
I(
ro+tin e s$ the a+t hor 4o+ld be hap p y to rec ei. e the m for possibl e incl+sion in f+t+r e rele a s e s of the syst e m -pgra d e to ne4 relea s e s of GALOPPS sho+l d still be .ery eas y 6# freely modify the cont e n t and str+ct +r e of any of the ro+tin e s in the syst e m This pro.id e s the gre a t e s t free d o m $ b+t the a+t h or 4ill no longer att e m p t to assist in fi5ing any b+gs disco. e r e d in s+ch a modified syst e m $ +nles s yo+ also de m o n s t r a t e the m in the +n m o difie d cod e 7o4e. er$ the a+t h or 4ill be plea s e d to learn of and1 or rec ei. e copi es of any s+ch enh a n c e m e n t s 4hich are fo+nd to be +sef+l
Similar to the original SGAA"$ to cha n g e the met h o d of selection !am o n g ro+lett e 4he el$ stoch a s tic rem ai n d e r selection$ stoch a s ti c +niform sa m plin g$ to+rn a m e n t selectio n$ and rankA bas e d selectio n#$ E+st +nco m m e n t the appro p ri a t e line in the m ak efile ;ile rselect c is ro+let t e 4he el selectio nB srsel ec t c is stoch a s ti c rem ai n d e r selectio n$ s+s el e c t c is stoch a s tic +nifor m sa m pling !+s+ ally reco m m e n d e d o.er the first t4o#$ tsel ect c is to+rn a m e n t selectio n$ and rnkslect c is rankA bas e d selection Similarly$ +nco m m e n t i n g the appro pri at e line choos e s am o n g the .ario+s cross o. e r oper a t o r s !one p t 5 c$ t4opt5 c$ +nif5 c$ +ob5 c$ pm5 c$ c5 c$ and o5 c# and the .ario+s m+t a tio n oper a t or s !bitm + t a t c$ m+ltim + t c$ s4a p c$ and scra m bl e c# 3o+ m+st +se care to be s+re that if yo+r probl e m is a per m + t a ti o n probl e m $ yo+ +se only the legal per m + t a t i o n oper a t o r s !+ob5$ c5$ o5$ pm5 for cross o. e rB s4a p or scra m bl e for m+t a tio n#$ and if not$ that yo+ +se the other oper a t o r s !one p t 5$ t4opt5$ +nif5 for crosso . e rB bitm +t a t or m+ltim + t for m+t a ti o n#
I)
;or -ni5 +sers$ e5a m pl e mak efiles are pro.id e d $ 4hich the +ser ma y alter to s+it their partic+l ar nee d s To com pile and link the files for a P"$ yo+ m+st select the appro pri at e ro+tin e s to com pil e$ incl+ding selectio n am o n g the choice s abo. e$ +sing the r+les belo4
The fi e " to co m p i e an d in7 for ALL t! p e " of prob e m " are th e fo o A i n g #th e ! ar e in th e "2 b d ir e c t o r ! ga o p p " * . 0 5 " r c $ @ checkh dr c checkrd c check4 t c ffscanf c filest a t c gen e r a t e c me m o r y c rando m c report c statis ti c +tility c +serOin c
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
II
In ga o p p " * . 0 5 i n c 2 d e m 2 " t b e th e :i n c 2 d e fi e " @ sga h !Lincl+d e d in maino n e c or main m a n y c# e5t er n al h !Lincl+ d e d in mos t other c files# sgaf+n c h !Lincl+d e d in sga h and e5ter n al h# sga p + r e h !Lincl+d e d in sga h and e5t er n al h# On e m 2 " t a " o ch o o " e /IACTL< ON/ APPLICATION >IL/ 44 in a "2 b d ir e c t o r ! UND/R ga o p p " * . 0 5 e E a m p e " @ app c app% c app0 c appb p p c appro yr d c appG t o & c appb t s p c app d e m o i c app55555 c appdEf% c !etc # app difrp c !or yo+r proble m $ ma d e by modifying the app55555 c form s+pplied in director y galopp s 6 014 ork# p 2 " a ch oi c e of /IACTL< ON/ S/L/CTION %/T9OD #in th e m a7 e f i e in th e pro b e m F " "2 b d ir e c t o r ! >RO%@ rselect c srs elec t c rnkslect c s+s el ec t c tselec t c p 2 " a ch oi c e of /IACTL< ON/ CROSSO?/R OP/RATOR #in th e m a7 e f i e in th e pro b e m F " "2 b d ir e c t o r ! >RO%@ one p t 5 c !for nonA per m + t a ti o n proble m s # t4opt5 c !for nonA per m + t a ti o n proble m s # +nif5 c !for nonA per m + t a tio n proble m s # +ob5 c !for per m + t a ti o n proble m s # o5 c !for per m + t a tio n proble m s # c5 c !for per m + t a tio n proble m s # pm5 c !for per m + t a ti o n proble m s # p 2 " a ch oi c e of /IACTL< ON/ %UTATION OP/RATOR #in th e m a7 e f i e in th e pro b e m F " "2 b d ir e c t o r ! >RO%@ bitm+ t a t c !for nonA per m + t a ti o n proble m s # m+ltim+ t c !for nonA per m + t a tio n proble m s # scra m bl e c !for per m + t a ti o n proble m s # s4ap c !for per m + t a ti o n proble m s # p 2 " a ch oi c e of /IACTL< ON/ IN?/RSION OP/RATOR #in th e m a7 e f i e in th e pro b e m F " "2 b d ir e c t o r ! >RO%@ in.ercla c in.ercir c
I/
p 2 " ' for SINGL/ POPULATION OP/RATION' =OT9 O>@ maino n e c start + p c OR for PARALL/L SU=POPULATION OP/RATION' ALL T9R// O>@ main m a n y c inits+b p c ma s t e r c
AUIILIAR< %AIN PROGRA% 44 CO%PILATION
To com pile the only "a2Ei iar!" m ain progr a m s pro.id e d 4ith the GALOPP Syst e m $ for m aking a sa m pl e dat a files for the blind tra. eling sales p e r s o n probl e m $ the follo4ing directi. e !or its eD+i.al e n t # m ay be +se d !the file cre/ b t s p m a k ma y be so+rc e d by -ni5 +sers to do this$ inst e a d #C ;or cre 8 b t " p . c !"reat e s dist a n c e tabl e for n rando m l y plac e d cities in a sD+ a r e of +serA specified size$ for blind tra. eling sales p e r s o n probl e m #C cc Ag cre/ b t s p c +tility c Alm Ao m ak e cit y 9OTEC !At som e point !prob a bl y not no4#$ yo+ m ay 4ant to kno4 thisC# The GALOPPS1One p o p and ,anypo p s progr a m s can rea d and 4rite eac h other s F checkp oi nt1r e s t a r t files ! ckp for he a d e r s and ind for indi.id+ al s# Th+s$ for e5a m pl e$ the +ser can mak e se. er al r+ns 4ith Onepo p on single pop +l a tion s$ and the n can +se their checkp oi nt files to initiat e a m+ltipl e s+bp o p +l a ti o n r+n of ,anyp o p s The +ser 4o+ld ha. e to ren a m e the ind checkp oi nt files$ in that cas e$ so that they shar e a com m o n prefi5$ are n+ m b e r e d GG Gn$ and are s+ffi5ed ind and ckp for indi.id+ al and hea d e r files$ resp e c ti. el y The stt files for glob al statistics 4ill also be in.alid and m+st be ignore d Altern a ti. el y$ the +ser m ay 4ant to "e5plor e" the beh a .i or of a singl e s+bp o p +l a ti o n crea t e d by ,anyp o p s $ and ma y +se Onep o p to do that e5plor ation E5aminin g the checkp oi nt files cre at e d by ,anypo p s !see app e n di c e s # sho+l d mak e it .ery clear ho4 to proc e e d
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
I&
2f yo+ 4o+ld like to recei. e +pd a t e s !b+g fi5es and1or ne4 rele a s e s of the syst e m # plea s e let the a+t h or kno4 of yo+r inter e s t thro+ g h any of the s e chan n el s
/G
8EAD,E;2 8ST chan g e s t 5 t pre.io+s one s# no4arr a n of any risk# g+ide 6 0 p s =ord ) G ! doc# licens e distrib+t e d#
!AS"22 te5t file describing this .ersion of the GALOPP Syst e m# !AS"22 te5t file describing differe nc e s of this .ersion from !AS"22 te5t file disclai me r $ indicating that ther e is 9O =A88A9T3 kind associa t e d 4ith the GALOPP Syst e m AA +ser +se s at o4n !-ser<s G+ide for GALOPP Syst e m$ 8elea s e 6 0$ in ,icrosoft and PostScript ! ps# .ersions !G9- Gene r al P+blic Licens e $ +nd er 4hich GALOPPS is
Templ a t e s Defining the Str+ct +r e of 2np+t ;ilesC !;or +ser s 9OT +sing the ne4 Graphic al -ser 2nterfac e# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA 9OTEC G-2 +ser sC The G-2 4ill a+to m a ti c ally 4rite correctly forma t t e d inp+t files for yo+$ 4hich yo+ ma y the n +se 4ith or 4itho+t the G-2 for f+rther r+ns
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
/%
The ea s y 4ay to de.elop an inp+t file for 3O-8 application is E+st to pick an e5a m pl e of one and the n modify it +ntil it r+ns As long as yo+ +se the !optional# key4or d on each inp+t line$ then at eac h stag e $ the progr a m 4ill TELL yo+ 4hat it has 4as looking for and 4hat it has fo+nd$ so it is .ery eas y to de.elop a file 4ith all inp+ts pre s e n t in the correc t order !Te mpl a t e files are in s+bdire c t or y "docs"#C inte m pl a o n e Onepop# inte m pl a m a n ,anypop s # !te mpl a t e defining the option al inp+t file for !te mpl a t e defining the option al inp+t file for
S+bdire c t or y e5a m pl e s 1 a p p Application ;ile app . c C !;rom Goldber g<s book# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for app c for Onepop appo n e in !sa mpl e inp+t file for app c for Onepop !i e $ mainon e c## 0r+ns a p p i n !sa mpl e inp+t file for Onepo p$ 0 r+ns !diff par a m s # # apppo p ' in !sa mpl e inp+t file$ app c for ,anypop s !' s+bpop +l a tion s ## 'popb e s t m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# contin+ % in !sa mpl e inp+t file for Onepo p$ for E>TE9D29G the r+n done by appo n e in# S+bdire c t or y e5a m pl e s 1 a p p % Application ;ile app ( . c C !;rom Goldber g<s book# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for app% c# app%o n e in !sa mpl e inp+t for Onepo p !app%o n e # r+n# app% p o p ' i n !sa mpl e inp+t file for ,anypo p! a p p % m a n y# m+ltiA s+bpop r+n# 'popb e s t m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# %st0of' in !sa mpl e inp+t file for ,anypo p s r+n from t4o differe n t proc e s s o r s !or proc e s s e s AA this file r+ns s+bpo p s G and %# 0nd0of' in !sa mpl e inp+t file for ,anypo p s r+n from t4o differe n t proc e s s o r s !or proc e s s e s AA this file r+ns s+bpo p s 0 and 6# rea d m e !describe s r+nning of ,anypop s on 0 ma c hi n e s $ +sing %st0of' in$ 0nd0of' in# S+bdire c t or y e5a m pl e s 1 a p p 0 Application ;ile app 0 cC !;rom Goldber g<s book# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for app0 c# app0o n e in !sa mpl e inp+t for Onepo p !app0o n e # r+n#
/0
!sa mpl e inp+t for ,anypo p s !app0 m a n y# m+ltiA !sa mpl e mst file +se d by se.er al ,anypop s inp+t files#
S+bdire c t or y e5a m pl e s 1r o yalr d Application ;ile appr o ! r d . c C !Hohn 7olland<s 8oyal 8oad "halleng e Proble m# AAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for approyr d c# approyr d in !sa mpl e inp+t for Onepo p !approyr d# r+n# approyr / in !sa mpl e inp+t for ,anypo p s !approyr p# m+ltiA s+bpop r+n$ b+t all r+nning from one proc e s s # approyr / in% !one of ;O-8 sa mpl e inp+t files for ,anypop s !approyr p# for a tr+ly par allel r+n on ' proce s s or s !or fake d 4ith ' proc e s s e s on one proc e s s or $ in -ni5# approyr / in0 !see abo.e# approyr / in6 !see abo.e# approyr / in' !see abo.e# rr0't o/ in !sa mpl e inp+t for ,anypo p s !approyr p# m+ltiA s+bpo p r+n# royalrd s h !e5a m pl e shell script to r+n a m+ltiA pha s e $ m+ltiA pop r+n# royalrd b a t !sa m e $ b+t for DOS# rrnoinit s h !rest a r t script for r+nning royalrd s h$ b+t 4itho+t the first ro+nd of initializations# rrnoinit ba t !rest a r t script for r+nning royalrd b a t $ b+t 4itho+t the first ro+nd of initializations# !pl+s .ario+s other ms t and in files +se d for a m+ltiA pha s e ,anypo p s r+n by royalrd s h or royalrd b a t # S+bdire c t or y e5a m pl e s 1 b t s p Application ;ile app b t " p . c C AAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for appbt s p c# appbt s p in !sa mpl e inp+t for Onepo p !appbt s p# r+n# appbt s p / in !,anypo p s !main m a n y c # r+n# /pop0 n b r m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# cre/bt s p c !progr a m to ma k e intercity dist a n c e inp+t file To r+n the sa mpl e inp+t files$ yo+ sho+ld r+n cre/b t s p !or mak e cit y$ as e5ec +t a bl e is called +nde r -ni5# to crea t e files %Gcities d s t !for appbt s p in# or 0Gcities d s t !for appbt s p / i n# # cre/bt s p m a k !sa mpl e compilation com m a n d !can +se Uso+rc e cre/bt s p m a k V # for making the stan d al on e progr a m 4hich 4rites the table of dist a n c e s bet4 e e n n rando ml y select e d cities$ to +se 4ith appbt s p c # cre/bt s p b a t !sa mpl e compilation com m a n d !can type cre/bt s p b a t # for making the stan d al on e progr a m 4hich 4rites the table of dist a n c e s
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
/6
bet4 e e n n rando ml y select e d cities$ to +se 4ith appbt s p c # S+bdire c t or y e5a m pl e s 1 d e m o i n . Application ;ile app d e m o i . c C AAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for appd e m oi c# appd e m oi in !sa mpl e inp+t for Onepo p !appd e m oi# r+n# apd e m oi ' in !,anypo p s !main m a n y c # r+n# apd e m oi / in !,anypo p s !main m a n y c # r+n# 'popb e s t m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# /pop0 n b r m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# S+bdire c t or y e5a m pl e s 1 d e m o a l p h Application ;ile app 3 t o ) . c AA De mo applica tion 4ith nonA binary fields AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for appGt o & c# apGt o & o n in !sa mpl e inp+t for Onepo p !apGt o & o n# r+n# apGt o G p / in !,anypo p s !main m a n y c # r+n# /pop0 n b r m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# S+bdire c t or y e5a m pl e s 1 d e E on gf n Application ;ile app dHf ( . c 4 ap p dHf + . c AA ;irst ' of DeHong<s Test ;+nction S+ite AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for appdEf% c# AA modify for dEf0 A dEf' apdEf%s in !sa mpl e inp+t for Onepo p r+n# apdEf%p/ in !sa mpl e inp+t for ,anypo p s !main m a n y c# r+n# !similarly$ apdEf0p/ in$ apdEf6p/ in$ apdEf'p/ in# /pop0 n b r m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# rea d m e !file describing e5a mpl e s in this director y# S+bdire c t or y e5a m pl e s 1 diffre ps Application ;ile app d i fr p . c AA De mo applica tion 4ith differe n t repr e s e n t a ti o n s $ inEection archit e c t +r e !9o Onepop .ersion is a.ailabl e 4ith this applica tion# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for appdifrp c# appdifr( in !,anypo p s !main m a n y c # r+n# 'to%inE ms t !sa mpl e mst file for UinEection archit e c t +r e V to inEect lo4A resol+tion sol+tions from fo+r s+bpo p s into one higherA resol+tion s+bpop# rea d m e !description of e5a m pl e pro.ide d her e# S+bdire c t or y e5a m pl e s 1 g g a Application ;ile app b p p . c AA Demo application of +se of Gro+ping Gene tic Algorith m !GGA# repr e s e n t a ti o n to sol.e a binA packing proble m
/'
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA mak efile !sa mpl e mak efile for appb p p c# gga c !additional proble mA indep e n d e n t \"< code for proble m s +sing GGA repr e s e n t a ti o n# gga h !incl+de file for proble m s +sing GGA repr e s e n t a t i o n# gga5 c !cross o. e r oper a t or for +se 4ith GGA repr e s e n t a ti o n# gga m + t c !m+t a tion oper a t or for +se 4ith GGA repr e s e n t a t i o n# apbp % G G 0 in !sa mpl e inp+t file for +se 4ith dat a s e t t%GG 0 d a t for bin packing !One po p## apbp p ( G % in !sa mpl e inp+t file for +se 4ith dat a s e t t(G%OGG d a t for bin packing !One po p## bpp(G % p ' in !sa mpl e inp+t file for +se 4ith dat a s e t t(G%OGG d a t for bin packing !,anypo p s ## bpp/% G G 0 in !sa mpl e inp+t file for +se 4ith dat a s e t t%GG 0 d a t for bin packing !,anypo p s ## 'popb e s t m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# /popring m s t !sa mpl e mst file +se d by se.er al ,anypop s inp+t files# rea d m e !te5t file describing GGA e5a m pl e # t(G%OGG d a t !sa mpl e dat a file of (G% ite ms to be pack e d into bins# t%GG0 d a t !sa mpl e dat a file of %GG0 ite ms to be packe d into bins#
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
/(
APP/NDII T6O@ CONT/NTS O> T9/ >IL/ T<P/S 6RITT/N =< GALOPPS
I. >i e EEEEE E ) ) . " t t @
8+ns of ,anyp o p s 4hich in.ol.e mor e than one P8O"ESS !i e $ not all s+b p o p s are calc+l at e d by a singl e proce s s# cre at e or read and 4rite a file called 555555 && s t t $ 4her e 555555 is the checkp tfilepr efi5 specified by the +ser for this r+n The file cont ai n s the o.er all statistics abo +t the r+n$ incl+din g the contrib+tio n s of ALL s+b p o p +l a ti o n s being r+n by ALL proc e s s e s in ALL proc e s s o r s +sing the m as t e r file defining this ,anypo p s r+n !One p o p r+ns do not nee d or +se this file at all$ and neith e r doe s ,anyp o p s 4hen all s+b p o p +l a tio n s are calc+l at e d 4ithin a singl e proce s s # 2f the +ser is initiating a 9E= r+n$ and not rest ar tin g from any sa. e d checkp oi nt e d pop +l a tion s or 4ith "se e d" indi.id+ al s fo+nd in pre.io+ s r+ns$ then the r+n sho+ld be start e d 4ith the stt file "zero e d o+t " That is don e m er el y by 8E,O:29G !erasi n g$ del etin g# the file from the direct or y in 4hich the r+n is being don e =hen the proc e s s "r+nni n g" s+b p o p +l a tio n G det er m i n e s that ther e is not s+ch a file in e5ist e n c e $ it 4ill cre at e one f+ll of zero .al+ e s$ 4hich 4ill then be +se d by it and all other proc e s s e s in.ol.e d in sol.ing this probl e m 2; T7E -SE8 ;O8GETS to del et e this file$ the progr a m 4ill print a 4arnin g to this effect on bot h the progr a m F s nor m al o+tp +t and on std err$ ho4e. e r it doe s not interfer e 4ith norm al e5 ec + tio n The file 4ill a+t o m a t i c ally be zeroe d o+t 2f the +ser E>TE9DS a r+n from check p oi nt s 4ritte n pre.io+ sl y$ the stt file sho+l d be LE;T AS 2S$ so that gat h e ri n g of perfor m a n c e statistics can contin+ e +nint e rr + p t e d 2ts na m e 4ill agr e e 4ith the checkp oi nt s =82TTE9 by the first part of the r+n being e5t e n d e d $ so it 4ill be +se d 4he n the +ser specifies the rest a rtfilepr efi5 from 4hich the r+n is to be reloa d e d After the first cycle of the rest a rt$ a ne4 stt file for T72S r+n 4ill be crea t e d $ m at c hi n g the na m e s of the check p oi n t files being 4ritt en no4 The stt file is rea d at the begi n ni n g of the first cycle and the end of eac h cycle of eac h s+b p o p +l a tio n in eac h proc e s s of the probl e m 2ts .al+ e s are incre m e n t e d by the res+lts of that s+b p o p +l a ti o n F s cycle Th+s$ it is +p to dat e as of the last cycle com pl et e d for eac h s+b p o p +l a tio n by eac h proc e s s o r =A8929GC *eca + s e the +pd a ti n g of this file is don e asyn c hr o n o + sl y by !pot e n ti ally# ma n y proc e s s o r s $ the cont e n t s beco m e 29:AL2D if a rest a rt is don e after an "abnor m a l ter mi n a ti o n " That is$ if the rest a rt res+lts in "thro4in g a4ay" of parti al cycles !4hich occ+rs 4hen a cycle 4as not com pl et e d #$ the n the contrib+tio n s of thos e partial cycles 4ill AL8EAD3 ha. e be e n add e d to allOpop s st t Th+s$ after s+ch a rest a rt$ the +ser sho+ld 8E"OG92JE that the glob al statistics ha. e be e n affect e d by addi n g in of fitnes s e s $ e.al+ a ti o n s $ etc $ e.e n tho+ g h the pop+l atio n s 4hich did the m ha. e be e n T78O=9 O-T This doe s 9OT occ+r if the ,anypo p s proc e s s e s are termi n a t e d norm ally at the end of a cycle$ or if only a singl e proc e s s is being +se d to r+n all s+bp o p +l a ti o n s
The stt file cont ai n s the follo4ing inform a ti o nC :ariabl e 9am e E5plan a ti o n
/)
OOOOOOOOOOOOO allOpop sOs + m fit n e s s to dat e allOpop sOs + m O b e s t Ofitn e s s gen e r a ti o n allOpop sOonlin eOd e n o m i n a t o r allOpop sOs + m fit n e s s allOpop sOb e s tOfitn e s sOc o + n t allOpop sOn e . al all s+b p o p +l a ti o n s allOpop sOb e s t fit chro m s+b p o p +l a tio n s allOpop sOb e s t fit fitn e s s allOpop sOb e s t fit initOfitne s s allOpop sOb e s t fit n e . al allOpop sOb e s t fit g e n e r a t i o n the best allOpop sOb e s t fit on the chro m o s o m e # $ +sing +tility
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO S+m of ra4 fitnes s e s of all indi.id+ al s e.al + a t e d S+m of best fitnes s of eac h s+b p o p +l a ti o n at eac h Total n+m b e r of fitnes s e s s+ m m e d into c+rre n t Total n+m b e r of best fitne s s e s s+m m e d into c+rre n t allOpopsOs+ m O b e s tOfitn e s s Total n+m b e r of e.al+ a tio n s perfor m e d to dat e in "hro m o s o m e of best indi.id+ al fo+nd so far in all !chro m siz e +nsign e d s # Scale d fitnes s of best indi.id+ al fo+nd so far 8a4 fitnes s of best indi.id+ al fo+nd so far E.al+ atio n n+ m b e r of best indi.id+ al fo+nd so far Gen er a ti o n n+m b e r !of its o4n s+b p o p +l a tio n# in 4hich indi.id+ al fo+nd so far 4as fo+nd 2f +tility fields are defin e d !point e d to by +tility the +tility fieldsF cont e n t s are 4ritte n her e by appO4rit eO+tilityOfields$ 4hich the +ser m+st define if fields
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
/I
4rite b+ffers This ena bl e s a rest a rt to be perfor m e d "fairly"$ regar dl e s s of 4he n a r+n m ay ha. e be e n interr+ p t e d ;iles of this type cont ai n the pop+l atio n at the tim e of checkp oi nti n g$ toge t h e r 4ith a little addition al inform a tio n at the begin ni n g of the file$ as follo4sC :ar 9am e OOOOOOOOOO .ersion popsiz e E5plan a ti o n OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO .ersion n+m b e r of progr a m 4riting file !not c+rre n tly +se d# 9+m b e r of indi.id+ al s in this !s+b#po p +l a tio n
indi.id+ al siz e Size !in byt e s# of an indi.id+ al$ incl+din g the chro m siz e +nsign e d s and the +tility fields lchro m best n o 4 Lengt h of chro m o s o m e in bits 2nde5 in oldpop of c+rre n t best indi.id+ al RG$po p siz eA %S
!Then$ for eac h indi.id+ al from G to popsiz eA %C# Z chro m chro m siz e +nsign e d s cont ai ni n g the act + al chro m o s o m e fitnes s initOfitne s s ne. al fo+nd scal e d fitnes s for the chro m o s o m e ra4 !+nsc al e d # fitne s s for the chro m o s o m e n+ m b e r of e.al + a ti o n s perfor m e d in T72S s+b p o p +l a tio n this indi.id+ al 4as
5siteR GS site RG$lchro m A %S on par e n t chro m o s o m e s 4her e cross o. e r 4as don e !one p t 5# or s+bstrin g start e d !t4opt5# 4he n this indi.id+ al 4as crea t e d $ or G if crea t e d som e other 4ay 5siteR %S site 4her e s+bst ri n g end e d on pare n t chro m o s o m e s if this indi.id+ al 4as crea t e d by t4opt5B G other4is e pare n t R GS position in oldpo p R%$po p siz eSS of par e n t R GS of this indi.id+ al !one more than s+bs cript in array# pare n t R %S as abo. e$ seco n d pare n t
+tility fields if +tility fields are defin e d !point e d to by +tility on the chro m o s o m e # $ the +tility fieldsF cont e n t s are 4ritte n her e by appO4rit eO+tilityOfields$ 4hich the +ser m+st define if +sing +tility fields [
//
char Qfna m e and "all*ack;+ n is decl ar e d asC *OOL !Q"all*ack;+ n# ;iles of this type cont ai n stat e inform a tio n !ess e n ti ally$ all b+t the act+ al indi.id+ al s in the pop +l a tion# 4hich is ne e d e d to restor e the progr a m to be able to contin + e r+nnin g after a checkp oi nt d+m p is take n Arg+m e n t fna m e is a point er to the string 4hich cont ai n s the na m e of the file 4hich sho+l d be ope n e d for 4riting the checkp oi nt he a d e r inform a tio n 2t m+st com ply 4ith DOS na mi n g con. e n tio n s $ e.e n on a -ni5 syst e m $ for com p a t i bility rea s o n s Th+s$ only an /A char a c t e r na m e $ a period$ and a 6A char a c t e r e5t e n si o n are allo4e d ;or Onep o p s r+ns$ this na m e is ass e m b l e d from the +ser inp+t !file or keyb o a r d #$ +p to / char a c t e r s $ +sing the field "check ptfilepr efi5"$ and app e n di n g " ckp" 2f the +ser doe s not specify a check ptfilepr efi5$ the n the rest a rtfilepr efi5 is +se d$ +nles s non e is specifiedB in that cas e$ the defa +lt "sga ck p" is +se d ;or ,anypo p s r+ns$ the proc e d + r e is similar$ e5ce p t that the +serA ent er e d prefi5 is limite d to ) char a c t e r s$ and t4oA digit s+bp o p +l a ti o n n+m b e r s are app e n d e d to it$ gen e r a ti n g file na m e s like "r+non e G G ck p"$ "r+non e G % ck p"$ etc Each s+bp o p +l a ti o n in a r+n has its o4n checkp oi nt hea d e r file At the end of a com pl et e cycle of all s+b p o p +l a tio n s in a ,anypo p s r+n$ all of the checkp oi nt hea d e r files 4ritte n are +pd a t e d to that their rea d and 4rite b+ffer are a s are e5ch a n g e d This en a bl e s a rest a rt to be perfor m e d "fairly"$ regar dl e s s of 4he n a r+n m ay ha. e be e n interr+ p t e d ;ile cont e n t s areC :ariabl e 9am e OOOOOOOOOOOOO popsiz e indcnt !al4ays popsiz e$ if fle5ibility 4itho+t chan gi n g file form a t # chro m siz e n+ m b e r of +nsign e d ints in a single chro m o s o m e n+ mfi el ds the tot al n+m b e r of fields to be repr e s e n t e d on the chro m o s o m e fieldlen g t h !calc+l at e d # lengt h of eac h field$ for per m + t a t i o nA type probl e m s thisOpo pO m a pOt oOst dRiS array of nu m fi el d s int indice s$ telling 4hich field in the sta n d a r d repr e s e n t a t i o n is no4 repr e s e n t e d at field 2 of the c+rre n t pop+l a tion<s chro m o s o m e !ne e d e d 4he n +sing in.ersion# m a5Ochro m si z eO a m o n gO allOs+ b p o p s 4he n +ser defin e s differe n t reps for differe n t s+bp o p s$ specifies here the longe s t one in +se in any s+b p o p !in n+m b e r of +nsign e d s # m a5On + m fi el d sO a m o n gO allOs+ b p o p s 4he n +ser defin e s differe n t reps for differe n t s+bp o p s$ specifies here the m a5i m + m n+m b e r of fields +se d in any s+bp o p
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
E5plan a ti o n OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO n+ m b e r of chro m o s o m e s in pop+l atio n bein g checkp oi nt e d n+ m b e r of indi.id+ al s being record e d in the acco m p a n yi n g ind file 4ritte n by this f+nction$ b+t record e d a seco n d tim e for f+t+re
/&
array of nu m fi el d s int indice s$ telling the endin g bit position lchro m# of eac h field i on eac h chro m o s o m e of this s+b p o p fieldOsiz esRiS array of nu m fi el d s int indice s$ telling the n+ m b e r of distinct integ e r .al+ e s field i on eac h chro m o s o m e of this s+bp o p can rang e o.er !i e $ ran g e is RG$ field_size s[i] - %S# bestfit chro m chro m siz e +nsign e d s $ cont ai nin g the chro m o s o m e of the most fit indi.id+ al fo+nd to dat e 29 T72S S-*POP-LAT2O9 bestfit fitn e s s scal e d fitnes s !if scaling +se dB oth er4is e$ ra4 fitnes s# of most fit indi.id+ al to dat e 29 T72S S-*POP-LAT2O9 bestfit initOfitn e s s +nsc al e d !ra4# fitne s s !from +serA defin e d ro+tin e obEf+nc!## of most fit indi.id+ al to dat e 29 T72S S-*POP-LAT2O9 bestfit n e . al 9+m b e r of e.al+ a tio n s 29 T72S S-*POP-LAT2O9 O9L3 of indi.id+ al s +p thro+ g h first finding this most fit indi.id+ al of T72S S-*POP-LAT2O9 bestfit g e n e r a t i o n Gen er a ti o n n+m b e r !for T72S S-*POP-LAT2O9# at 4hich this most fit indi.id+ al O; T72S S-*POP-LAT2O9 4as first fo+nd bestfit m a pOt oOst dRiS array of nu m fi el d s .al+ e s storing the thisOpo pO m a pOt oOst d at tim e this indi.id+ al 4as sa. e d $ allo4ing later deco di n g of it bestfit fieldOen d sRiS array of nu m fi el d s .al+ e s storing the fieldOen d s arra y for the s+b p o p at the tim e this indi.id+ al 4as sa. e d $ to en a bl e later deco di n g of the indi.id+ al$ e.e n if array chan g e s Q!bestfit +tility# 2f the +ser defin e s +tility fields$ their cont e n t s !for the best indi.id+ al 29 T72S S-*POP-LAT2O9 to dat e# is 4ritt e n ne5t$ by a call to the +serA defin e d +tility 4riter$ appO4rit eO+tility!b e s tfit +tility$fp# ;ield bestfit +tility !not 4ritt en# is the point er to thes e cont e n t s stdOfieldOen d s RiS array of nu m fi el d s .al+ e s storing the fieldOen d s arra y for the STA9DA8D repr e s e n t a t i o n !i e $ +se d by the fitnes s f+nction obEf+nc!##$ b+t 9OT nec e s s a rily in this s+bp o p oneOpo pOc + m O s + m fit n e s s S+m of the ra4 fitnes s e s of all indi.id+ al s e.al + a t e d in this s+b p o p +l a tio n to dat e oneOpo pOs + m O b e s t Ofitn e s s S+m of the ra4 fitnes s of the best indi.id+ al of eac h gen e r a t i o n of this s+b p o p +l a tio n e.al+ a t e d to dat e
&G
oneOpo pOb e s tOfitn e s sOco + n t "o+nt of the n+m b e r of indi.id+ al s incl+d e d in this s+bp o p +l a ti o n F s oneOpo pOs + m O b e s tOfitn e s s Th+s$ offline perfor m a n c e for this s+b p o p +l a tio n can al4ays be calc+l at e d as oneOpo pOs + m O b e s t Ofitn e s s 1 oneOpo pOb e s tOfitn e s sOco + n t oneOpo pOo nlin eOd e n o m i n a t o r 9+m b e r of indi.id+ al s of this s+b p o p +l a tio n 4hos e ra4 fitne s s e s are incl+d e d in oneOpo pOc+ m O s + m fit n e s s Th+s$ online perfor m a n c e for this s+b p o p +l a tio n can al4ays be calc+l at e d asC oneOpo pOc + m O s + m fit n e s s 1 oneOpo pOo nlin eOd e n o m i n a t o r minr a4 Lo4est ra4 fitne s s in the c+rre n t !s+b#p o p +l a tio n a.gr a 4 A.era g e ra4 fitnes s in the c+rre n t !s+b#po p +l a ti o n fitOm a5 7ighe s t ra4 fitne s s in the c+rre n t !s+b#p o p +l a tio n pcross Proba bility of cross o. e r !per chro m o s o m e # $ in RG $% S pm +t a ti o n Proba bility of m+t a tio n !per *2T$ for ordinar y binary repr e s e n t a t i o n s $ b+t per "78O,OSO,E$ for per m + t a t i o nA type repr e s e n t a t i o n s# pOm+lti m + t Proba bility of m+ltiA field m+t a tio n !per "78O,OSO,E# a.gO m + tO4idt h E5pect e d .al+ e of n+m b e r of fields !Poisso nA distrib # 4hich 4ill be s+bEect e d to setting at rando m 4hen a m+ltim + t is don e !take n from appOs e tOo p tio n s!## pin.er sio n Proba bility of in.ersion$ per gen e r a ti o n a+toc o n t r olOs el e ctio n ;lag telling 4het h e r to control selection a+t o m a t i c ally !ShapiroA like sch e m e # or not bet a *oltzm a n n scaling para m e t e r specified by +ser 4hen 9OT a+toc o n t r olling selection$ or set a+t o m a t i c ally if A8E a+toc o n t r olling selection bet sOsOtilde :al+e +se d to det e r mi n e bet a 4he n a+t oco n t r olling selectio n scal e m +l t ,+ltiple of a.er a g e fitnes s to 4hich most fit indi.id+ al is to be scal e d Also +se d 4ith sa m e m e a ni n g 4hen rankA bas e d selection is +se d :al+e A% m e a n s donFt do linear scaling con.Om e a s + r e 8es+lt of a con. er g e n c e me a s + r e B see body of m a n + al con.Osig m aO c o eff 9+m b e r of stan d a r d de.i ation s abo. e1 b el o4 me a n to be +se d for con. er g e n c e me a s + r e abo. e sigm aOtr+ n c 9+m b e r of stan d a r d de.i ation s from me a n at 4hich ra4 fitne s s e s are to be tr+nc a t e d in calc+l atin g scal e d fitnes s !G G me a n s donFt donFt do sigm a tr+nc a tio n# scalingO4indo 4 9+m b e r of gen e r a t i o n s back from 4hich LEAST fit indi.id+ al 4ill be +se d to
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
&%
det e r m i n e scaling of c+rre n t pop+l atio n !A% m e a n s donFt +seB G m e a n s c+rre n t gen e r a t i o n only$ % m e a n s c+rre n t pl+s pre.io+ s one$ etc B m a5 .al+ e c+rre n tly %&# 4indo4 st a r t 4indo4 e n d sa. e d m i n sR 0 GS sigm a ne. al dat e# lchro m gen s p e r c ycl e befor e it is gen pop +l a tion start s gen m a5 g e n files$ of co+rs e# r+n$ so m a5 g e n printstring s nm +t a ti o n ncross best n o 4 !may not be best m+st be larger tha n that to r+n at all ;lag$ G says donFt print chro m o s o m e s B % says do 9+m b e r of m+t a ti o n s perfor m e d to dat e !in this s+b p o p +l a ti o n# 9+m b e r of cros so . e r s perfor m e d to dat e !in this s+bp o p +l a ti o n# 2nde5 !in RG$pop siz eA %S# of best indi.id+ al in the c+rre n t s+bp o p +l a ti o n Point er for tracking gen e r a ti o n s for 4indo4 scaling !sa m e as abo. e # Array of mini m + m s +se d for 4indo4 scaling Stan d a r d de.iation of c+rre n t ra4 fitnes s e s 9+m b e r of chro m o s o m e s e.al+ a t e d in c+rre n t !s+b#p o p +l a tio n !to Lengt h of the chro m o s o m e !in bits# !,anypo p s only# 9+m b e r of gen e r a ti o n s of a s+b p o p +l a ti o n calc+l at e d checkp oi nt e d and repl ac e d in m e m o r y by anot h e r s+b p o p +l a tio n 9+m b e r of the c+rre n t gen e r a t i o n !a r+n initialized from a rando m at G# :al+e of gen at 4hich r+n is to ter mi n a t e !aft er 4riting its checkp oi nt -pon rest ar t$ r+n begi ns 4ith high e s t .al+e gen att ai n e d in pre.io+ s
e.er$ if not +sing elitism# con.int er . al 9+m b e r of gen e r a t i o n s bet4 e e n printing of con. er g e n c e statistics cro4dingOfact or DeHongA type cro4ding factorB G m e a n s donFt +se cro4ding !offspring replac e par e n t s#B % me a n s pick a rand o m s+r.i.or to replac e 4ith ne4 indi.id+ al !4itho+t replac e m e n t #B 0 or mor e m e a n s replac e "LOSEST !7am mi n g dist a n c e # indi.id+ al am o n g the 0 or more s+r.i.ors test e d incestOre d + c ti o n ;lagB G me a n s no m atin g restriction in effectB % me a n s mat e s for pare n t % in a crosso . e r 4ill be picked from a pool of 6 possi bl e pare n t 0<s AA the one f+rth e s t a4ay !7am m i n g dist a n c e #i s chos e n as the m at e stoch a s tic ;lagB G me a n s 9OT stoch a s ti c$ so donFt ree. al + a t e +nch a n g e d indi.id+ al sB % me a n s 2S stoch a s ti c$ so e.al + a t e e.ery indi.id+ al e.ery gen e r a ti o n !red +c e s sa m plin g error 4hen fitnes s e s .ary 4ith tim e or are densit y dep e n d e n t #
&0
elitism ;lagB G me a n s 9OT elitistB % m e a n s 2S elitistC best indi.id+ al is g+ar a n t e e d at least one spot in ne5t gen e r a ti o n oldra n dR ( (S Array of rando m n+m b e r gen e r a t o r$ so rest a rt s can pick +p seD + e n c e 4her e it 4as left off Erand 2nde5 +se d in rand o m n+m b e r gen e r a ti o n rnd50 Do+ble +se d in rand o m n+ m b e r gen e r a ti o n rndc alcfla g ;lag +se d in rando m n+m b e r gen e r a t i o n alph aOsiz e 2nt telling the n+ m b e r of alleles per loc+s !0 m e a n s a bit string# Legal .al+ e s in eac h field 4ill rang e from G thro+ g h alpha_siz e A % per m p r o bl e m 2nt telling 4het h e r is !W W % # a per m + t a ti o n probl e m or not !W W G # to+rn e ysiz e 2nt telling size of to+rn a m e n t if to+rn a m e n t selection is +se d A93 -SE8ADE;29ED :A82A*LES =72"7 ,-ST *E 8E"O8DED !e5ce p t +tility fields# Any .al+e s 4ritt en to the file by "all*ack;+ n!#$ 4hich are add e d to end of "stan d a r d " file -ser pro.id e s the code to 4rite thes e .ariabl e s !if any# in a f+nction called appO4rit eOckpOhdr!# in file app5 5555 c !or 4hat e . e r the +serFs applicatio n file is called# Thes e files are rea d by f+nction 8ead" h e c kP oi nt7 e a d e r $ 4he n e . e r a s+b p o p +l a tio n is being restor e d after bein g checkp oi nt e d !-ser s+p plie s cod e to read any -SE8ADE;29ED :A82A*LES 4ritt en by appO4rit eOckpOh dr!# in its corres p o n di n g f+nction$ appOre a dOck pOh dr!#$ and by appO4rit eO+tility!# in its corres p o n di n g f+nction$ appOre a dO + tility!#
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
&6
SGA4 C@ A C4 an g 2 a g e Imp e m e n t a t i o n of a Sim p e Gen e t i c A g orit h m Rob er t /. Smit h The Uni& e r " i t ! of A ab a m a Dep a r t m e n t of /ngin e e r i n g %ec h a n i c " T2" c a o o " a ' A ab a m a *, + 3 , an d Da&id /. Go d b e r g The Uni& e r " i t ! of I in oi " Dep a r t m e n t of Gen e r a /ngin e e r i n g Urba n a ' I inoi " -( 8 3 ( an d 1eff A. /aric7 " o n A ab a m a S2 p e r c o m p 2 t e r Net A o r 7 The =o ei n g Com p a n ! 92nt " & i e ' A ab a m a *, 8 3 SGA4 C Di"c ai m e r @ SGAA" is distrib+t e d +nd e r the ter m s describ e d in the file 9O=A88A9T3 Thes e term s are take n from the G9- Gen er al P+blic Licens e This me a n s that SGAA" has no 4arra n t y implied or gi.e n$ and that the a+t hor s ass+ m e no liability for da m a g e res+ltin g from its +se or mis+ s e
Intro d 2 c t i o n
SGAA" is a "Alang+ a g e tran sl a ti on and e5t e n si o n of the origin al Pasc al SGA code pres e n t e d by Goldb er g$ /& 2t has som e addition al feat +r e s$ b+t its oper a ti o n is ess e n ti ally the sa m e as that of the original$ Pasc al .ersion This report is incl+d e d as a concis e introd + c tio n to the SGAA" distrib+tion 2t is pres e n t e d 4ith the ass + m p t i o n s that the rea d e r has a gen e r al +nd e r s t a n d i n g of Goldb er gF s original Pasc al SGA cod e$ and a good 4orking kno4led g e of the " progr a m m i n g lang+ a g e The report begin s 4ith an o+tline of the files incl+d e d in the SGAA" distrib+tion$ and the ro+tin e s they cont ai n The o+tline is follo4ed by a disc+s sio n of significa nt feat +r e s of SGAA" that differ from thos e of the Pasc al .ersion The report concl+ d e s 4ith a disc+s si o n of ro+tin e s that m+st be alter e d to imple m e n t oneFs o4n application in SGAA"
&'
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
&(
R R R R R R R R R
pse + d oA rand o m n+ m b e r bet4 e e n G and % This ro+tin e +se s the s+btr a c ti. e m et h o d specified by ?n+thC/ % rnd!lo4$high# S ret+r n s an +nifor mlyA distrib+t e d integ e r bet4 e e n lo4 and high rndr e al!lo4$hi gh# S ret+r n s an +nifor mlyA distrib+t e d floating point n+m b e r bet4 e e n lo4 and high flip!p# S flips a bias e d coin$ ret+r nin g % 4ith prob a bility p$ and G 4ith prob a bility %A p ad. a n c eOr a n d o m ! # S gen e r a t e s a ne4 bat ch of (( rando m n+m b e r s rando m i z e!# S asks the +ser for a rando m n+m b e r see d 4arm + pOr a n d o m ! # S prim e s the rand o m n+ m b e r gen e r a t o r noise! m + $ sigm a # S gen e r a t e s a norm al rand o m .aria bl e 4ith m e a n m+ and stan d a r d de.i atio n sigm a This ro+tin e is not c+rre n tly +se d in SGAA"$ and is only incl+d e d as a gen e r al +tility rando m n o r m a l d e .i a t e !# S is a +tility ro+tin e +se d by noise 2t com p + t e s a stan d a r d norm al rando m .ariabl e initran d o m n o r m a l d e .i a t e !# S initialization ro+tin e for rand o m n o r m a l d e .i a t e !#
R report c S cont ai n s ro+tin e s +se d to print a report from eac h cycle of SGAA"Fs oper a ti o n R report!# S controls o.er all reportin g R 4ritepo p!# S 4rites o+t the pop+l atio n at e.ery gen e r a ti o n R 4ritechr o m !# S 4rites o+t the chro m o s o m e as a string of one s and zero e s 2n the c+rre n t imple m e n t a t i o n $ the most significan t bit is the right m o s t bit print e d Thre e selectio n ro+tin e s are incl+d e d 4ith the SGAA" distrib+tionC R rselect c S cont ai n s ro+tin e s for ro+lett eA 4he el selectio n R srsel ec t c S cont ai n s the ro+tin e s for stoch a s ticA rem ai n d e r selectio n !*ookerC / 0# R tsel ect c S cont ai n s the ro+tin e s for to+rn a m e n t selection !*rindleC / % a # To+rn a m e n t s of any size +p to the pop +l a tion size can be held 4ith this imple m e n t a t i o n RThe to+rn a m e n t selection ro+tin e incl+d e d 4ith the distrib+tio n 4as 4ritt en by 7illol ?arg+p t a $ of the -ni.ersity of Alaba m a S ;or mod +l arity$ eac h selectio n m et h o d is ma d e a.aila bl e as a com pil e tim e option Edit the ,akefile to choos e a selectio n m et h o d Each of the thre e selection files cont ai n s the ro+tin e s selectOm e m o r y and selectOfre e !called by initm alloc and free all$ resp e c ti. el y#$ 4hich perfor m any nec e s s a r y a+5iliary me m o r y han dling$ and the ro+tin e s pres el e c t!# and select!#$ 4hich imple m e n t the partic+l ar selection met h o d R stat s c S cont ai n s the ro+tin e statistics!#$ 4hich calc+l at e s pop +l a tion statistics for eac h gen e r a ti o n R +tility c S cont ai n s .ario+s +tility ro+tin e s Of partic+l ar inter e s t is the ro+tin e ithr+E0int!#$ 4hich ret+r n s bits aia thro+ g h aEa of a chro m o s o m e interpr e t e d as an int R app c S cont ai n s applicatio n dep e n d e n t ro+tin e s &)
Erik D Goodm a n $ GA8AGe$ ,ichiga n State -ni.ersity
-nless yo+ nee d to cha n g e the basic oper a ti o n of the GA itself$ yo+ sho+ld only ha. e to alter this file ;+rth er instr+ction s for alterin g the SGA applicatio n are incl+d e d in the description of ro+tin e app R applicatio n!# S sho+l d cont ai n any applicatio nA specific com p + t a ti o n s ne e d e d befor e eac h GA cycle 2t is called by main!# R appOd a t a !# S sho+ld ask for and rea d in any applicatio nA specific inform a tio n This ro+tin e is called by initOdat a!# R appO m alloc!# S sho+ld perfor m any applicatio nA specific calls to m alloc!# to dyn a m i c ally allocat e me m o r y This ro+tin e is called by initm alloc!# R appOfre e!# S sho+l d perfor m any applicationA specific calls to free!#$ for rele a s e of dyn a m i c ally allocat e d me m o r y This ro+tin e is called by free all!# R appOinit!# S sho+ld perfor m any applicationA specific initialization nee d e d 2t is called by initialize!# R appOinitre p o rt !# S sho+l d print o+t an applicatio nA specific initial report befor e the start of gen e r a ti o n cycles This ro+tin e is called by initialize!# R appOre p or t!# S sho+l d print o+t any applicatio nA specific o+tp + t after eac h GA cycle 2t is called by report!# R appOst a t s!# S sho+ld perfor m any applicationA specific statistic al calc+l ation s 2t is called by statistics!# R obEf+nc!critt er# S The obEecti. e f+nction for the specific application The .ariabl e critt er is a point er to an indi.id+ al !a GA pop +l a tion me m b e r #$ to 4hich this ro+tin e m+st assign a fitnes s This ro+tin e is called by gen e r a t i o n!# R ,akefile S is a -92> mak efile for SGAA"
Inp2 t4 O2tp 2 t
SGAA" allo4s for m+ltipl e GA r+ns =hen the progr a m is e5ec + t e d $ the +ser is first prom p t e d for the n+m b e r of GA r+ns to be perfor m e d After this$ the D+a n tit y of inp+t ne e d e d dep e n d s on the selectio n ro+tin e chos e n at com pileA tim e$ and any applicatio nA specific inform a tio n reD+ir e d =hen com pile d 4ith ro+lett e 4he el selection$ the inp+t reD+ e s t e d from the +ser is as follo4sC The n+m b e r of GA r+ns to be perfor m e d !int# The pop +l a tion size !int# The chro m o s o m e lengt h !int# Print the chro m o s o m e strings eac h gen e r a ti o n !y1n#P
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
&I
The m a5i m + m n+m b e r of gen e r a t i o n s for the r+n !int# The prob a bility of cross o. e r !float# The prob a bility of m+t a tio n !float# ApplicationA specific inp+t$ if any The se e d for the rand o m n+ m b e r gen e r a t o r !float#
a+t h or s are inter e s t e d in the com m e n t s $ criticism s$ and b+g report s from SGAA" +sers$ so that the code can be refine d for easi er +se in s+bs e D + e n t .ersion s Pleas e em ail yo+r com m e n t s to robMg al a b 0 m h + a e d + $ or 4rite to T"GAC The "learingh o + s e for Gen etic Algorith m s The -ni.ersity of Alaba m a Depart m e n t of Engin e e ri n g ,ech a ni cs P O *o5 /IG 0 I / T+scaloo s a $ Alaba m a 6(' / I QAckno4le d g m e n t s The a+t h or s grat ef+lly ackno4l e d g e s+p p ort pro.id e d by 9ASA +nd er Grant 9GTAA(G0 0 ' and s+p p ort pro.id e d by the 9ation al Scienc e ;o+nd a ti o n +nd er Grant "TSAA/'( % ) % G imple m e n t a t i o n =e also tha nk 7illol ?arg+p t a for don a ti n g his to+rn a m e n t selectio n
GALOPPS A Gene tic Algorith m Optimize d for Porta bility and Parallelism A 8eleas e 6 0
&&