JGAP

examples.gp
Class SimpleExample

java.lang.Object
  extended by org.jgap.gp.GPProblem
      extended by examples.gp.SimpleExample

public class SimpleExample
extends GPProblem

Simple example of Genetic Programming to discover the formula (X > 0) OR (X == -8) OR (X == - 5) given a set of inputs from -10 to 10 and expected outputs (true or false). The fitness function used in this example cares about deviation from the expected result as well as the complexity of the solution (the easier the solution, the better it is, mutatis mutandis).

Since:
3.5

Field Summary
protected static Variable vx
           
 
Constructor Summary
SimpleExample()
           
 
Method Summary
 GPGenotype create()
           
static void main(java.lang.String[] args)
           
 void start()
           
 
Methods inherited from class org.jgap.gp.GPProblem
createTree, getGPConfiguration, setGPConfiguration, showTree, showTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vx

protected static Variable vx
Constructor Detail

SimpleExample

public SimpleExample()
Method Detail

create

public GPGenotype create()
                  throws InvalidConfigurationException
Specified by:
create in class GPProblem
Returns:
newly created GPGenotype
Throws:
InvalidConfigurationException

start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

JGAP