artificial life

Chapter 6: Genetic Programming

6.4 Symbolic Regression Applet

A Java Applet that allows the user to define an equation to regress using Genetic Programming is created as part of this project.

As in the Genetic Algorithms Applet this applet has three panels for the user to control the process of the Genetic Program. In this applet the first panel allows the user to define the equation to be found and the domain over which the genotypes are tested. The second panel allows the user to execute and analyze the Genetic Programs. The third panel is a graph that plots the goal equation and the best Genetic Programming solution in order to visualize the fitness of the best genotype.


</COMMENT>

Panel 1

The first panel of the Symbolic Regression Applet allows the user to define the equation to be found and sets the domain to be tested.

Possible Functions: This is a list of the functions and variables the user can apply in the function definition. The functions are printed in the format in which they should be used. "Value" indicates that any of the functions or a constant can be entered as a parameter. The applet uses prefix notation since this is a more natural format to translate into tree structure.

Define Function Field: This is where the user enters the goal function.

Set Function Button: The user presses this button when the function is finished and properly formatted. If the user enters an equation that is formatted incorrectly, or contains an operator that isn't in the top list the applet gives an error message, otherwise it displays that the function loaded successfully.

Set Domain for Genetic Programs to test: The user may adjust these fields to determine what domain the Genetic Programs is tested over. The Genetic Programs must be reset in order for any changes to take effect.


Panel 2

The second panel of the Symbolic Regression Applet allows the user to define the Genetic Programming system and to see the results of the genetic programming system.

Reset Genetic Programs Button: This button reinitializes the Genetic Programming system to the current set of options chosen and creates a new random population. This button needs to be pressed for any Genetic Programming state changes.

Crossover & Mutation Checkboxes: These checkboxes act as toggles for the crossover and mutation options for regeneration in the Genetic Programming system. The Genetic Programming system must be reset for any of these changes to take effect.

Mutation Rate: Allows the user to set the likelihood that an individual gene will mutate or not. The Genetic Programming system must be reset for any of these changes to take effect.

Advance Population buttons: These buttons allow the Genetic Programming system to progress the appropriate number of generations.

Population Size Field: The user can set the number of genotypes in a population using this field. The Genetic Programming system must be reset for any of these changes to take effect.

Best GP Score: This is the score of the best Genetic Program in the current population. All scores in this problem are negative.

Best GP Genotype Found: This displays the best equation created by the system in the current population.

Main Graph: This graph plots the best genotype in each generation so that the user can visualize the progress of the system.


Panel 3

The third panel of the Symbolic Regression Applet produces a graph that compares the goal equation with the best equation found so far. The fields on the left allow the user to set the domain and range of the graph. The Graph button will refresh the graph with the current goal function and the best GP found. This button must be pressed to generate a graph. The goal function is plotted in red, while the best candidate is plotted in blue.



As in the Genetic Algorithms project this project has two parts: a set of generic Genetic Programming classes and classes that implement a Symbolic Regression solution with these classes.


The Genetic Programming library is comprised of ten .java files:

GPPair.java

GPNode.java

GPTerminalNode.java

GPVariableNode.java

GPUnaryNode.java

GPBinaryNode.java

GPNodeContainer.java

GPNodeComparator.java

GPPopulation.java

GPFunctionTemplate.java


The specific Symbolic Regression solution has four .java files:

Operators.java

GpGraph.java

GPCompGraph.java

GPApplet.java