% ./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 ----------> 1.0 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) = 1.000000 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) 2 00101 400.000000 4) 00101 400.000000 | ( 1, 4) 2 00111 784.000000 5) 11011 729.000000 | ( 6, 7) 1 10101 441.000000 6) 11110 225.000000 | ( 6, 7) 1 01110 196.000000 7) 00101 400.000000 | ( 5, 1) 2 11111 961.000000 8) 11010 121.000000 | ( 5, 1) 2 00011 576.000000 9) 01001 324.000000 | ( 1, 5) 2 00011 576.000000 10) 01100 36.000000 | ( 1, 5) 2 11111 961.000000 -------------------------------------------------------------------------------- Generation 0 Accumulated Statistics: Total Crossovers = 5, Total Mutations = 0 min = 144.000000 max = 961.000000 avg = 600.000000 sum = 6000.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 | ( 8, 7) 3 01011 676.000000 2) 00110 144.000000 | ( 8, 7) 3 11111 961.000000 3) 00101 400.000000 | ( 5, 5) 1 10101 441.000000 4) 00111 784.000000 | ( 5, 5) 1 10101 441.000000 5) 10101 441.000000 | ( 7, 5) 1 10101 441.000000 6) 01110 196.000000 | ( 7, 5) 1 11111 961.000000 7) 11111 961.000000 | ( 6, 1) 4 01111 900.000000 8) 00011 576.000000 | ( 6, 1) 4 11110 225.000000 9) 00011 576.000000 | (10, 2) 1 10110 169.000000 10) 11111 961.000000 | (10, 2) 1 01111 900.000000 -------------------------------------------------------------------------------- Generation 1 Accumulated Statistics: Total Crossovers = 10, Total Mutations = 1 min = 169.000000 max = 961.000000 avg = 611.500000 sum = 6115.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) 01011 676.000000 | (10, 3) 2 01101 484.000000 2) 11111 961.000000 | (10, 3) 2 10111 841.000000 3) 10101 441.000000 | ( 8, 4) 4 11111 961.000000 4) 10101 441.000000 | ( 8, 4) 4 10100 25.000000 5) 10101 441.000000 | ( 2, 6) 3 11111 961.000000 6) 11111 961.000000 | ( 2, 6) 3 11111 961.000000 7) 01111 900.000000 | ( 1, 1) 3 01011 676.000000 8) 11110 225.000000 | ( 1, 1) 3 01011 676.000000 9) 10110 169.000000 | ( 7, 6) 3 01111 900.000000 10) 01111 900.000000 | ( 7, 6) 3 11111 961.000000 -------------------------------------------------------------------------------- Generation 2 Accumulated Statistics: Total Crossovers = 15, Total Mutations = 1 min = 25.000000 max = 961.000000 avg = 744.600000 sum = 7446.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) 01101 484.000000 | (10, 7) 3 11111 961.000000 2) 10111 841.000000 | (10, 7) 3 01011 676.000000 3) 11111 961.000000 | ( 9, 8) 2 01011 676.000000 4) 10100 25.000000 | ( 9, 8) 2 01111 900.000000 5) 11111 961.000000 | ( 7, 6) 1 01111 900.000000 6) 11111 961.000000 | ( 7, 6) 1 11011 729.000000 7) 01011 676.000000 | ( 2, 7) 2 10011 625.000000 8) 01011 676.000000 | ( 2, 7) 2 01111 900.000000 9) 01111 900.000000 | ( 8, 7) 3 01011 676.000000 10) 11111 961.000000 | ( 8, 7) 3 01011 676.000000 -------------------------------------------------------------------------------- Generation 3 Accumulated Statistics: Total Crossovers = 20, Total Mutations = 1 min = 625.000000 max = 961.000000 avg = 771.900000 sum = 7719.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) 11111 961.000000 | ( 9, 5) 4 01011 676.000000 2) 01011 676.000000 | ( 9, 5) 4 01111 900.000000 3) 01011 676.000000 | ( 4, 7) 4 01111 900.000000 4) 01111 900.000000 | ( 4, 7) 4 10011 625.000000 5) 01111 900.000000 | ( 5, 4) 3 01111 900.000000 6) 11011 729.000000 | ( 5, 4) 3 01111 900.000000 7) 10011 625.000000 | (10, 4) 2 01111 900.000000 8) 01111 900.000000 | (10, 4) 2 01011 676.000000 9) 01011 676.000000 | ( 5, 8) 2 01111 900.000000 10) 01011 676.000000 | ( 5, 8) 2 01111 900.000000 -------------------------------------------------------------------------------- Generation 4 Accumulated Statistics: Total Crossovers = 25, Total Mutations = 1 min = 625.000000 max = 900.000000 avg = 827.700000 sum = 8277.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) 01011 676.000000 | ( 9, 5) 4 01111 900.000000 2) 01111 900.000000 | ( 9, 5) 4 01111 900.000000 3) 01111 900.000000 | ( 6, 7) 2 01111 900.000000 4) 10011 625.000000 | ( 6, 7) 2 01111 900.000000 5) 01111 900.000000 | ( 6, 1) 3 01111 900.000000 6) 01111 900.000000 | ( 6, 1) 3 01011 676.000000 7) 01111 900.000000 | ( 7, 3) 2 01111 900.000000 8) 01011 676.000000 | ( 7, 3) 2 01111 900.000000 9) 01111 900.000000 | ( 1, 7) 3 01011 676.000000 10) 01111 900.000000 | ( 1, 7) 3 01111 900.000000 -------------------------------------------------------------------------------- Generation 5 Accumulated Statistics: Total Crossovers = 30, Total Mutations = 1 min = 676.000000 max = 900.000000 avg = 855.200000 sum = 8552.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) 01111 900.000000 | ( 3, 3) 3 01111 900.000000 2) 01111 900.000000 | ( 3, 3) 3 01111 900.000000 3) 01111 900.000000 | ( 5, 2) 1 01111 900.000000 4) 01111 900.000000 | ( 5, 2) 1 01111 900.000000 5) 01111 900.000000 | ( 8, 9) 4 01111 900.000000 6) 01011 676.000000 | ( 8, 9) 4 01011 676.000000 7) 01111 900.000000 | (10, 2) 2 01111 900.000000 8) 01111 900.000000 | (10, 2) 2 01111 900.000000 9) 01011 676.000000 | ( 1, 5) 4 01111 900.000000 10) 01111 900.000000 | ( 1, 5) 4 01111 900.000000 -------------------------------------------------------------------------------- Generation 6 Accumulated Statistics: Total Crossovers = 35, Total Mutations = 1 min = 676.000000 max = 900.000000 avg = 877.600000 sum = 8776.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) 01111 900.000000 | ( 1, 9) 1 01111 900.000000 2) 01111 900.000000 | ( 1, 9) 1 01111 900.000000 3) 01111 900.000000 | (10, 8) 4 01111 900.000000 4) 01111 900.000000 | (10, 8) 4 01111 900.000000 5) 01111 900.000000 | ( 5, 3) 3 01111 900.000000 6) 01011 676.000000 | ( 5, 3) 3 01111 900.000000 7) 01111 900.000000 | ( 7, 4) 4 01111 900.000000 8) 01111 900.000000 | ( 7, 4) 4 01111 900.000000 9) 01111 900.000000 | ( 5, 4) 4 01111 900.000000 10) 01111 900.000000 | ( 5, 4) 4 01111 900.000000 -------------------------------------------------------------------------------- Generation 7 Accumulated Statistics: Total Crossovers = 40, Total Mutations = 1 min = 900.000000 max = 900.000000 avg = 900.000000 sum = 9000.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) 01111 900.000000 | ( 7, 4) 2 01111 900.000000 2) 01111 900.000000 | ( 7, 4) 2 01111 900.000000 3) 01111 900.000000 | ( 2, 5) 1 01111 900.000000 4) 01111 900.000000 | ( 2, 5) 1 01111 900.000000 5) 01111 900.000000 | ( 8, 9) 2 01111 900.000000 6) 01111 900.000000 | ( 8, 9) 2 01111 900.000000 7) 01111 900.000000 | ( 9, 5) 3 01111 900.000000 8) 01111 900.000000 | ( 9, 5) 3 01111 900.000000 9) 01111 900.000000 | ( 9, 5) 3 01111 900.000000 10) 01111 900.000000 | ( 9, 5) 3 01111 900.000000 -------------------------------------------------------------------------------- Generation 8 Accumulated Statistics: Total Crossovers = 45, Total Mutations = 1 min = 900.000000 max = 900.000000 avg = 900.000000 sum = 9000.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) 01111 900.000000 | ( 1, 5) 4 01111 900.000000 2) 01111 900.000000 | ( 1, 5) 4 01111 900.000000 3) 01111 900.000000 | ( 8, 2) 1 01111 900.000000 4) 01111 900.000000 | ( 8, 2) 1 01111 900.000000 5) 01111 900.000000 | ( 6, 5) 4 01111 900.000000 6) 01111 900.000000 | ( 6, 5) 4 01111 900.000000 7) 01111 900.000000 | ( 5,10) 2 01111 900.000000 8) 01111 900.000000 | ( 5,10) 2 01111 900.000000 9) 01111 900.000000 | ( 3, 9) 2 01111 900.000000 10) 01111 900.000000 | ( 3, 9) 2 01111 900.000000 -------------------------------------------------------------------------------- Generation 9 Accumulated Statistics: Total Crossovers = 50, Total Mutations = 1 min = 900.000000 max = 900.000000 avg = 900.000000 sum = 9000.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) 01111 900.000000 | ( 6, 1) 4 01111 900.000000 2) 01111 900.000000 | ( 6, 1) 4 01111 900.000000 3) 01111 900.000000 | ( 4, 5) 4 01111 900.000000 4) 01111 900.000000 | ( 4, 5) 4 01111 900.000000 5) 01111 900.000000 | ( 7, 2) 3 01111 900.000000 6) 01111 900.000000 | ( 7, 2) 3 01111 900.000000 7) 01111 900.000000 | ( 2, 8) 2 01111 900.000000 8) 01111 900.000000 | ( 2, 8) 2 01111 900.000000 9) 01111 900.000000 | ( 8, 2) 1 01111 900.000000 10) 01111 900.000000 | ( 8, 2) 1 01111 900.000000 -------------------------------------------------------------------------------- Generation 10 Accumulated Statistics: Total Crossovers = 55, Total Mutations = 1 min = 900.000000 max = 900.000000 avg = 900.000000 sum = 9000.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) 01111 900.000000 | (10, 2) 3 01111 900.000000 2) 01111 900.000000 | (10, 2) 3 01111 900.000000 3) 01111 900.000000 | ( 3, 9) 3 01111 900.000000 4) 01111 900.000000 | ( 3, 9) 3 01111 900.000000 5) 01111 900.000000 | ( 3, 5) 1 01111 900.000000 6) 01111 900.000000 | ( 3, 5) 1 01111 900.000000 7) 01111 900.000000 | ( 1, 5) 3 01111 900.000000 8) 01111 900.000000 | ( 1, 5) 3 01111 900.000000 9) 01111 900.000000 | (10, 1) 2 01111 900.000000 10) 01111 900.000000 | (10, 1) 2 01111 900.000000 -------------------------------------------------------------------------------- Generation 11 Accumulated Statistics: Total Crossovers = 60, Total Mutations = 1 min = 900.000000 max = 900.000000 avg = 900.000000 sum = 9000.000000 Global Best Individual so far, Generation 0: Fitness = 961.000000: 11111 --------------------------------------------------------------------------------