com.groovyj.jgprog
Class SymbolicRegressionWorld

java.lang.Object
  |
  +--com.groovyj.jgprog.World
        |
        +--com.groovyj.jgprog.SymbolicRegressionWorld
All Implemented Interfaces:
java.io.Serializable

public class SymbolicRegressionWorld
extends World

The symbolic regression problem of Koza[1992], to find the formula x^4+x^3+x^2+x given 20 random points for x in the range [-1,1]. Uses a population size of 500 with fitness-proportionate selection, and runs for 50 generations.

Note: this is where I found that I had to protect the EXP and LN functions against extremely large values, since they would return infinity and then other functions operating on that value (especially SIN and COS) would return Not-a-Number, which would totally throw everything off.

Probably a better solution would have been to protect functions against infinity arguments.

Copyright (c) 2000 Robert Baruch. This code is released under the GNU General Public License (GPL).

Version:
$Id: SymbolicRegressionWorld.java,v 1.4 2000/10/12 15:22:55 groovyjava Exp $
Author:
Robert Baruch (jgprog@sourceforge.net)
See Also:
Serialized Form

Fields inherited from class com.groovyj.jgprog.World
crossMethod, crossoverProb, maxChromosomes, maxCrossoverDepth, maxInitDepth, maxSize, random, reproductionProb, selectionMethod
 
Constructor Summary
SymbolicRegressionWorld()
           
 
Method Summary
 float computeFitness(Individual ind)
          Computes the adjusted fitness of the given individual.
 float computeRawFitness(Individual ind)
           
 void create()
           
static void main(java.lang.String[] args)
           
 int run(int numGenerations)
           
 void runProb(int numGenerations, int numRuns)
           
 
Methods inherited from class com.groovyj.jgprog.World
addGPListener, create, getBestIndividual, getPopulation, getTotalFitness, getWorstIndividual, nextGeneration, removeGPListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolicRegressionWorld

public SymbolicRegressionWorld()
                        throws java.io.IOException
Method Detail

create

public void create()

computeFitness

public float computeFitness(Individual ind)
Description copied from class: World
Computes the adjusted fitness of the given individual. The subclass must provide an implementation of this method.
Overrides:
computeFitness in class World
Following copied from class: com.groovyj.jgprog.World
Parameters:
individual - the Individual to evaulate
Returns:
the adjusted fitness, where bigger numbers are better. Does not necessarily have to have a maximum value.

computeRawFitness

public float computeRawFitness(Individual ind)

run

public int run(int numGenerations)

runProb

public void runProb(int numGenerations,
                    int numRuns)

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException