% ./sga ----------------------------------------------------------- | SGA-C (v1.1) - A Simple Genetic Algorithm | | (c) David E. Goldberg 1986, All Rights Reserved | | C version by Robert E. Smith, U. of Alabama | | v1.1 modifications by Jeff Earickson, Boeing Company | ----------------------------------------------------------- Number of GA runs to be performed-> 1 ------- SGA Data Entry and Initialization ------- Enter the population size ------------> 10 Enter chromosome length --------------> 5 Print chromosome strings? (y/n) ------> y Enter maximum number of generations --> 35 Enter crossover probability ----------> 0.8 Enter mutation probability -----------> .001 Enter random number seed, 0.0 to 1.0 -> 0.42 SGA Parameters ------------------------------------------------- Total Population size = 10 Chromosome length (lchrom) = 5 Maximum # of generations (maxgen) = 35 Crossover probability (pcross) = 0.800000 Mutation probability (pmutation) = 0.001000 RUN 1 of 1: GENERATION 0->35 -------------------------------------------------------------------------------- Population Report Generation 0 Generation 1 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 00111 784.000000 | ( 6, 1) 2 11111 961.000000 2) 11100 49.000000 | ( 6, 1) 2 00110 144.000000 3) 01000 4.000000 | ( 1, 4) 0 00111 784.000000 4) 00101 400.000000 | ( 1, 4) 0 00101 400.000000 5) 11011 729.000000 | ( 9, 6) 4 01000 4.000000 6) 11110 225.000000 | ( 9, 6) 4 11111 961.000000 7) 00101 400.000000 | ( 5, 5) 4 11011 729.000000 8) 11010 121.000000 | ( 5, 5) 4 11011 729.000000 9) 01001 324.000000 | (10, 1) 1 00111 784.000000 10) 01100 36.000000 | (10, 1) 1 01100 36.000000 -------------------------------------------------------------------------------- Generation 0 Accumulated Statistics: Total Crossovers = 4, Total Mutations = 0 min = 4.000000 max = 961.000000 avg = 553.200000 sum = 5532.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 1->35 -------------------------------------------------------------------------------- Population Report Generation 1 Generation 2 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11111 961.000000 | ( 6, 8) 1 11111 961.000000 2) 00110 144.000000 | ( 6, 8) 1 11111 961.000000 3) 00111 784.000000 | ( 3, 6) 1 01111 900.000000 4) 00101 400.000000 | ( 3, 6) 1 10111 841.000000 5) 01000 4.000000 | ( 7, 7) 4 11011 729.000000 6) 11111 961.000000 | ( 7, 7) 4 11011 729.000000 7) 11011 729.000000 | ( 4, 6) 1 01111 900.000000 8) 11011 729.000000 | ( 4, 6) 1 10101 441.000000 9) 00111 784.000000 | ( 8, 8) 4 11011 729.000000 10) 01100 36.000000 | ( 8, 8) 4 11011 729.000000 -------------------------------------------------------------------------------- Generation 1 Accumulated Statistics: Total Crossovers = 9, Total Mutations = 1 min = 441.000000 max = 961.000000 avg = 792.000000 sum = 7920.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 2->35 -------------------------------------------------------------------------------- Population Report Generation 2 Generation 3 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11111 961.000000 | ( 4, 9) 3 10111 841.000000 2) 11111 961.000000 | ( 4, 9) 3 11011 729.000000 3) 01111 900.000000 | ( 4, 9) 2 10011 625.000000 4) 10111 841.000000 | ( 4, 9) 2 11111 961.000000 5) 11011 729.000000 | ( 7, 1) 3 01111 900.000000 6) 11011 729.000000 | ( 7, 1) 3 11111 961.000000 7) 01111 900.000000 | ( 2, 1) 3 11111 961.000000 8) 10101 441.000000 | ( 2, 1) 3 11111 961.000000 9) 11011 729.000000 | ( 7, 7) 3 01111 900.000000 10) 11011 729.000000 | ( 7, 7) 3 01111 900.000000 -------------------------------------------------------------------------------- Generation 2 Accumulated Statistics: Total Crossovers = 14, Total Mutations = 1 min = 625.000000 max = 961.000000 avg = 873.900000 sum = 8739.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 3->35 -------------------------------------------------------------------------------- Population Report Generation 3 Generation 4 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 10111 841.000000 | ( 9,10) 3 01111 900.000000 2) 11011 729.000000 | ( 9,10) 3 01111 900.000000 3) 10011 625.000000 | ( 2, 8) 1 11111 961.000000 4) 11111 961.000000 | ( 2, 8) 1 11011 729.000000 5) 01111 900.000000 | ( 1, 7) 1 11111 961.000000 6) 11111 961.000000 | ( 1, 7) 1 10111 841.000000 7) 11111 961.000000 | ( 1, 2) 4 10111 841.000000 8) 11111 961.000000 | ( 1, 2) 4 11011 729.000000 9) 01111 900.000000 | ( 5, 8) 4 01111 900.000000 10) 01111 900.000000 | ( 5, 8) 4 11111 961.000000 -------------------------------------------------------------------------------- Generation 3 Accumulated Statistics: Total Crossovers = 19, Total Mutations = 1 min = 729.000000 max = 961.000000 avg = 872.300000 sum = 8723.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 4->35 -------------------------------------------------------------------------------- Population Report Generation 4 Generation 5 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 01111 900.000000 | ( 2,10) 3 01111 900.000000 2) 01111 900.000000 | ( 2,10) 3 11111 961.000000 3) 11111 961.000000 | (10, 4) 3 11111 961.000000 4) 11011 729.000000 | (10, 4) 3 11011 729.000000 5) 11111 961.000000 | ( 7, 5) 2 10111 841.000000 6) 10111 841.000000 | ( 7, 5) 2 11111 961.000000 7) 10111 841.000000 | ( 7,10) 4 10111 841.000000 8) 11011 729.000000 | ( 7,10) 4 11111 961.000000 9) 01111 900.000000 | ( 5, 6) 2 11111 961.000000 10) 11111 961.000000 | ( 5, 6) 2 10111 841.000000 -------------------------------------------------------------------------------- Generation 4 Accumulated Statistics: Total Crossovers = 24, Total Mutations = 1 min = 729.000000 max = 961.000000 avg = 895.700000 sum = 8957.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 5->35 -------------------------------------------------------------------------------- Population Report Generation 5 Generation 6 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 01111 900.000000 | ( 2, 9) 4 11111 961.000000 2) 11111 961.000000 | ( 2, 9) 4 11111 961.000000 3) 11111 961.000000 | ( 2, 6) 4 11111 961.000000 4) 11011 729.000000 | ( 2, 6) 4 11111 961.000000 5) 10111 841.000000 | ( 4, 6) 3 11011 729.000000 6) 11111 961.000000 | ( 4, 6) 3 11111 961.000000 7) 10111 841.000000 | ( 8, 7) 3 11111 961.000000 8) 11111 961.000000 | ( 8, 7) 3 10111 841.000000 9) 11111 961.000000 | ( 4, 1) 1 11111 961.000000 10) 10111 841.000000 | ( 4, 1) 1 01011 676.000000 -------------------------------------------------------------------------------- Generation 5 Accumulated Statistics: Total Crossovers = 29, Total Mutations = 1 min = 676.000000 max = 961.000000 avg = 897.300000 sum = 8973.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 6->35 -------------------------------------------------------------------------------- Population Report Generation 6 Generation 7 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11111 961.000000 | ( 2, 3) 1 11111 961.000000 2) 11111 961.000000 | ( 2, 3) 1 11111 961.000000 3) 11111 961.000000 | ( 5, 5) 1 11011 729.000000 4) 11111 961.000000 | ( 5, 5) 1 11011 729.000000 5) 11011 729.000000 | ( 6, 8) 0 11111 961.000000 6) 11111 961.000000 | ( 6, 8) 0 10111 841.000000 7) 11111 961.000000 | ( 8, 5) 0 10111 841.000000 8) 10111 841.000000 | ( 8, 5) 0 11011 729.000000 9) 11111 961.000000 | ( 3, 7) 1 11111 961.000000 10) 01011 676.000000 | ( 3, 7) 1 11111 961.000000 -------------------------------------------------------------------------------- Generation 6 Accumulated Statistics: Total Crossovers = 32, Total Mutations = 1 min = 729.000000 max = 961.000000 avg = 867.400000 sum = 8674.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 7->35 -------------------------------------------------------------------------------- Population Report Generation 7 Generation 8 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11111 961.000000 | ( 3, 4) 1 11011 729.000000 2) 11111 961.000000 | ( 3, 4) 1 11011 729.000000 3) 11011 729.000000 | ( 6, 1) 4 10111 841.000000 4) 11011 729.000000 | ( 6, 1) 4 11111 961.000000 5) 11111 961.000000 | ( 6, 6) 2 10111 841.000000 6) 10111 841.000000 | ( 6, 6) 2 10111 841.000000 7) 10111 841.000000 | ( 6, 9) 3 10111 841.000000 8) 11011 729.000000 | ( 6, 9) 3 11111 961.000000 9) 11111 961.000000 | ( 6, 5) 0 10111 841.000000 10) 11111 961.000000 | ( 6, 5) 0 11111 961.000000 -------------------------------------------------------------------------------- Generation 7 Accumulated Statistics: Total Crossovers = 36, Total Mutations = 1 min = 729.000000 max = 961.000000 avg = 854.600000 sum = 8546.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 8->35 -------------------------------------------------------------------------------- Population Report Generation 8 Generation 9 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11011 729.000000 | ( 8,10) 4 11111 961.000000 2) 11011 729.000000 | ( 8,10) 4 11111 961.000000 3) 10111 841.000000 | ( 1, 9) 2 11111 961.000000 4) 11111 961.000000 | ( 1, 9) 2 10011 625.000000 5) 10111 841.000000 | ( 2, 4) 0 11011 729.000000 6) 10111 841.000000 | ( 2, 4) 0 11111 961.000000 7) 10111 841.000000 | ( 3,10) 2 10111 841.000000 8) 11111 961.000000 | ( 3,10) 2 11111 961.000000 9) 10111 841.000000 | ( 2, 4) 2 11111 961.000000 10) 11111 961.000000 | ( 2, 4) 2 11011 729.000000 -------------------------------------------------------------------------------- Generation 8 Accumulated Statistics: Total Crossovers = 40, Total Mutations = 1 min = 625.000000 max = 961.000000 avg = 869.000000 sum = 8690.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 9->35 -------------------------------------------------------------------------------- Population Report Generation 9 Generation 10 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11111 961.000000 | ( 2, 8) 0 11111 961.000000 2) 11111 961.000000 | ( 2, 8) 0 11111 961.000000 3) 11111 961.000000 | ( 8, 1) 2 11111 961.000000 4) 10011 625.000000 | ( 8, 1) 2 11111 961.000000 5) 11011 729.000000 | ( 1, 8) 0 11111 961.000000 6) 11111 961.000000 | ( 1, 8) 0 11111 961.000000 7) 10111 841.000000 | ( 2, 1) 1 11111 961.000000 8) 11111 961.000000 | ( 2, 1) 1 11111 961.000000 9) 11111 961.000000 | ( 4, 8) 0 10011 625.000000 10) 11011 729.000000 | ( 4, 8) 0 11111 961.000000 -------------------------------------------------------------------------------- Generation 9 Accumulated Statistics: Total Crossovers = 42, Total Mutations = 1 min = 625.000000 max = 961.000000 avg = 927.400000 sum = 9274.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 10->35 -------------------------------------------------------------------------------- Population Report Generation 10 Generation 11 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11111 961.000000 | ( 5, 8) 2 11111 961.000000 2) 11111 961.000000 | ( 5, 8) 2 11111 961.000000 3) 11111 961.000000 | ( 6, 6) 3 11111 961.000000 4) 11111 961.000000 | ( 6, 6) 3 11111 961.000000 5) 11111 961.000000 | ( 7, 1) 4 11111 961.000000 6) 11111 961.000000 | ( 7, 1) 4 11111 961.000000 7) 11111 961.000000 | ( 6, 3) 1 11111 961.000000 8) 11111 961.000000 | ( 6, 3) 1 11111 961.000000 9) 10011 625.000000 | ( 6, 6) 0 11111 961.000000 10) 11111 961.000000 | ( 6, 6) 0 11111 961.000000 -------------------------------------------------------------------------------- Generation 10 Accumulated Statistics: Total Crossovers = 46, Total Mutations = 1 min = 961.000000 max = 961.000000 avg = 961.000000 sum = 9610.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 -------------------------------------------------------------------------------- RUN 1 of 1: GENERATION 11->35 -------------------------------------------------------------------------------- Population Report Generation 11 Generation 12 num string fitness parents xsite string fitness -------------------------------------------------------------------------------- 1) 11111 961.000000 | ( 7, 2) 1 11111 961.000000 2) 11111 961.000000 | ( 7, 2) 1 11111 961.000000 3) 11111 961.000000 | ( 1, 8) 0 11111 961.000000 4) 11111 961.000000 | ( 1, 8) 0 11111 961.000000 5) 11111 961.000000 | ( 4, 8) 0 11111 961.000000 6) 11111 961.000000 | ( 4, 8) 0 11111 961.000000 7) 11111 961.000000 | ( 2, 4) 3 11111 961.000000 8) 11111 961.000000 | ( 2, 4) 3 11111 961.000000 9) 11111 961.000000 | ( 8, 4) 0 11111 961.000000 10) 11111 961.000000 | ( 8, 4) 0 11111 961.000000 -------------------------------------------------------------------------------- Generation 11 Accumulated Statistics: Total Crossovers = 48, Total Mutations = 1 min = 961.000000 max = 961.000000 avg = 961.000000 sum = 9610.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 --------------------------------------------------------------------------------