This class is a special control class used to implement experiments using the Push Genetic Programming (PushGP) system. PushGP is a system which uses genetic programming and the Push programming language to attempt to evolve solutions to a wide variety of problems. For more information on Push and PushGP, see the class PushInterpreter.This class is appropriate for evolving Push programs which are only run once per fitness case.
To implement a PushGP experiment you will need to setup a PushGP object which overrides two methods: setup-fitness-test, which sets up a fitness test and compute-error, which is used to compute the fitness of an individual.
Additionally, other methods in this class are useful for configuring the genetic programming environment and a variety of parameters including population size, mutation rate, crossover rate, and the Push language interpreter set.
Finally, you may also wish to add custom instructions to the Push interpreter objects which manipulate data or trigger actions in the simulated world. The Push interpreter can be retrieved using the method get-interpreter, and adding instructions is documented in PushInterpreter.
Setting and Retrieving GP Parameters
- get-crossover-percent
- get-deletion-percent
- get-generation-limit
- get-mutation-percent
- get-population-size
- get-tournament-size
- read-interpreter-config
- seed-population
- set-crossover-percent
- set-deletion-percent
- set-generation-limit
- set-mutation-percent
- set-population-size
- set-spatial-radius
- set-tournament-size
Getting the Push Interpreter Used During Evolution
- abort-fitness-test
- auto-simplify
- compute-diversity
- get-current-individual
- get-interpreter
- get-program-limit-penalty
- run-tournament
Methods Overridden by the User To Set Up PushGP Experiments
Aborts the currently running fitness
Programs generated through genetic programming are often complicated and difficult to understand. This method attempts to simplify an evolved push program while maintaining the same fitness.
Each time this method is invoked, a random simplification is preformed on the program p. If the simplification does not harm the fitness, p is modified to contain the simplification, otherwise, nothing happens. This method should be called repeatedly -- perhaps 100 times or more to aggressively simplify an unweildy program.
Computes the diversity of the current population, as defined by the PushDiversityPool object. Returns the number of unique "species" which differ by less than t points.
This method must be overridden by the user in order to run a PushGP experiment. The job of this method is to inspect the state of the PushInterpreter object and determine the fitness (in terms of error) of the specified fitness case. This typically involves comparing values from the interpreter's stacks against desired values.
For example, with a symbolic regression problem, this method might return the difference between the top of the float stack, and the predetermined "correct" answer for the specified fitness case. For example:
return (interpreter get-float-stack-top) - desiredOutputs{ n }.
This method takes a list of errors returned by compute-error for all fitness cases, and produces a fitness value. The default implementation of this method computes the fitness by summing the absolute values of the errors, which should suffice for most applications.
Overriding this method is optional.
This method must be overriden by the user in order to run a PushGP experiment. This method should return the number of fitness cases to be run.
This method is called when a solution is found. You should override this method to preform any additional analysis you'd like. Typically this involves examining the program for generalization.
The default implementation simplifies the program p for 1000 iteration using auto-simplify and prints out the result.
Returns the crossover percent. See set-crossover-percent for more information.
Returns the PushProgram currently being evaluated.
Returns the deletion percent. See set-deletion-percent for more information.
Returns the generation limit. See set-generation-limit for more information.
Returns the PushInterpreter object that this object is using for fitness tests.
Returns the mutation percent. See set-mutation-percent for more information.
Returns the population size. See set-population-size for more information.
Returns a penalty value applied to program which hit their evaluation limit. The default value is .1, but you may override this method in order to penalize programs differently according to the problem.
Returns the tournament size. See set-tournament-size for more information.
Reads a configuration file for the interpreter used in the fitness tests. Changing the configuration also reinitializes the evolving population (since instructions sets may be changed).
Logs information to the output at every generation. This method may be overridden to provide more (or less) output data.
The argument bestIndividual is the best individual in the population and is provided so that it may be inspected by the user if this method is overridden.
Used internally.
Runs a tournament selection from the population. Used internally during reproduction uses the tournament size set with set-tournament-size.
This method may be overridden to implement a custom tournament selection if desired, though the default implementation should suffice in most situations.
Uses pushProgram to seed the initial population.
Sets the percentage of agents generated by genetic crossover at each generation. This should be a value between 0 and 100. The default value is 40.
Sets the percentage of agents generated by genetic deletion at each generation. This should be a value between 0 and 100. The default value is 5.
Sets the generation limit to n. If no solution is found by the generation limit, the simulation with terminate. The default value is 300.
Sets the percentage of agents generated by genetic mutation at each generation. This should be a value between 0 and 100. The default value is 40.
Sets the population size to n and reinitializes the population. The default value is 2000.
Sets the spatial radius used for tournament selection during reproduction. Setting to 0 disables spatial effects.
Sets the tournament size to n. The tournament size determines how many individuals are examined during tournament selection. The default value is 7.
This method must be overridden by the user in order to run a PushGP experiment. The job of this method is to prepare to run the specified fitness test. This typically means pushing input values onto the PushInterpreter object's stacks.
In a symbolic regression problem, for example, this method might push a predetermined input value onto the float stack.
interpreter push-float value inputValues{ n }.