Page 177 - 49A Field Guide to Genetic Programming
P. 177

B.4 Compiling and Running TinyGP                              163


            java tiny gp FILE, where FILE is the dataset file name (which can include
            the full path to the file). Finally, the user can specify both the datafile and
            a seed for the random number generator on the command line, by giving
            the command java tiny gp SEED FILE, where SEED is an integer.
               As an example, we ran TinyGP on the sin(x) dataset described in Sec-
            tion B.2 (which is available at http://cswww.essex.ac.uk/staff/rpoli/
            TinyGP/sin-data.txt). The output produced by the program was some-
            thing like the following

            −− TINY GP ( Java version ) −−
            SEED=−1
            MAX LEN=10000
            POPSIZE=100000
            DEPTH=5
            CROSSOVER PROB=0.9
            PMUT PER NODE=0.05
            MIN RANDOM=−5.0
            MAXRANDOM=5.0
            GENERATIONS=100
            TSIZE=2
            −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
            Generation=0 Avg Fitness =42.53760218120066 Best Fitness
                =39.997953686554816 Avg Size =10.9804
            Best In d ivi du a l : (1.589816334458055 / −2.128280559500907)
            Generation=1 Avg Fitness =1226.404415960088 Best Fitness
                =24.441994244449372 Avg Size =10.97024
            Best In d ivi du a l : ((( −0.3839867944222206 / −2.2796127162428403) +
                 ( −1.8386812853617673 / −1.06553859601892) ) −
                (((4.984026635222818 ∗ (0.17196413319878445 −
                0.1294044215655923) ) + (X1  − −1.8956001614031734) ) ∗
                0.3627020733460027) )
            . . .

               The flip-o-rama animation in the footer of the bibliography and index
            include plots of the best and mean fitness, the mean program size and the
            behaviour of the best-so-far individual at each generation. The animation
            should be viewed by rapidly flipping the pages of the book from the begin-
            ning of the bibliography onward. For convenience, the plots corresponding
            to the final generation are also reported in Figure B.1.
               As one can see, GP progressively evolves better and better approxima-
            tions to the sine function. The best individual at the end of the run had an
            error of 1.88. Its unsimplified version as produced by the system is

            (X1  / (( −2.766097899954383 ∗ (X1  / ( ( ( X1  / ( ( ( ( X1  / (X1  ∗
                −3.2001163763204445) ) ∗ X1 ) − −3.2001163763204445) ∗
                −3.2001163763204445) ) + X1 ) + (X1  ∗ (X1  −
                3.9532436938954376) ) ) ) ) − ( ( ( X1  ∗ X1 ) / ( ( ( X1  /
                (3.9532436938954376 ∗ −3.2001163763204445) ) ∗ X1 ) −
                −3.2001163763204445) ) / ( ( ( X1  + X1 ) / (X1  ∗ X1 ) ) + X1 ) )
                ) )
   172   173   174   175   176   177   178   179   180   181   182