Matthew Frederick
matthew@mich.distance.net
Symbolic Regression
The goal of the symbolic regression problem is to evolve a function to match a given curve. In the graphing window, the blue line represents the "true" line, while the red line is the evolved function. The edit box under it shows the current best solution. This applet is highly costomizable. The curve that the genetic programming engine has to evolve is user definable. A LISP like expression can be entered in the edit box on the righ hand side, and this expression will try to be matched using genetic programming. The internal parser does not handle incorrect syntax elegantly, though, and no errors are outputted. The limits on the Y axis can be specified in the edit boxes above the function. The series of checkboxes is where the user can specify what function the evolving genetic expression has available to it. The geneic programming engine will always have access to the variable x and constants.
Setting changes will not take effect until the "New Population" button is pressed.
This problem was adapted for a problem proposed by John Koza (1992).
Expressions
Each expression can be composed basic math operations,
constants, conditionals, and some environmental variables. Add, subtract,
multiply, divide, cosine, sine, inverse cosine, and inverse sine are available
to expressions, as well as a branching conditional "if less than zero branch
one way else branch the other way". Constants range in value between
-1.0 and 1.0. The following environmental variables
are available to expressions:
x | the independent vaiable |
Criterion for evaluating each expression
Each generation, each expression is given 10 random x values, and it has to try to match the corresponding y value. Fitness is simply determined by the negative sum of all the differences between the experimental value and the correct value squared . A fitness of 0.0 means a perfect match.
Results
While this applet is good at matching the expression entered by the user, what is really interesting is evolving a function after removing key operators. For example, the genetic programming engine does not have access to the power function. Therefore, it cannot take the square root of a number easily. Remarkably, it is possible for it to evolve something similiar with what is does have, though. Try entering
(pow (x) .5)
in the user definable function area. Set the limits to 0 and .25, and press "New Population".
Another interesting test is evolving sine after unckecking the sine checkbox. Set the limits to -1.57 and 1.57, and enter
(sin (x))
The sign function is also interesting. Turn sine back on, turn of branching, and enter
(iflz x -1.0 1.0)
Remember, "New Population" must be pressed for any changes to take effect.
This applet has been known to crash on start up or after the "New Population" button has been pressed. The solution probably lies somewhere in the timing of all the threads, but at this time the bug is concealled.
References
Koza, J. R. (1992). Generic Programming: On the programming of computers by eans of natural selection. Cambridge, MA: MIT Press.