Gene *P1, *P2; Gene tmp; P1 P2 e1 e2 C1: xyxxxxxyxxxxxxxxxxx C2: xyxxxxxyxxxxxxxxxxx copying errors copy pointers rather than data copy the data correctly check each part is doing its job test with a couple of super simple problems check the bias efficiency avoid costly operators don't recompute fitness don't construct and destruct -------------------------------------------------------------------------------- 8 queens problem (chess) 8 x 8 board for 64 squares 64 bit representation 10^19 too general bits: C(64, 8) 10^9 constrained to 8 queens 8 numbers in {1..8} 10^7 one queen per column permuations of 1..8 10^4 one queen per column and row (combinatorial problem) general nonpermutation problem permuation problems job shop scheduling traveling sales person problem (TSP) Simple Substitution Cipher abcdefghijklmnopqrstuvwxyz badfcgzy... . .. p... i "key" 26! 4*10^26 cat <- "clear" message dbp <- "encrypted" send this MUTATION IN PERMUATION SPACE badfcgzy... . .. p... i ^ ^ 2 swap badzcgfy... . .. p... i sum_i,j (D_i,j - English_i,j)^2 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ