JGAP

examples.gp
Class Fibonacci

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

public class Fibonacci
extends GPProblem

Example demonstrating Genetic Programming (GP) capabilities of JGAP.

Here, the Fibonacci sequence is calculated (only integers are used).

Please note: We try to find a program that computes Fibonacci iteratively.

This example utilizes a INodeValidator (see FibonacciNodeValidator).

Each new best solution found will be displayed as a graphical tree representing the GP. The tree is written to a PNG-imagefile onto harddisk.

Since:
3.0

Nested Class Summary
static class Fibonacci.FormulaFitnessFunction
           
 
Constructor Summary
Fibonacci(GPConfiguration a_conf)
           
 
Method Summary
 GPGenotype create()
          Sets up the functions to use and other parameters.
static void main(java.lang.String[] args)
          Starts the example.
static java.lang.Object readFromStream()
           
static void writeToStream(IGPProgram prog)
           
 
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
 

Constructor Detail

Fibonacci

public Fibonacci(GPConfiguration a_conf)
          throws InvalidConfigurationException
Throws:
InvalidConfigurationException
Method Detail

create

public GPGenotype create()
                  throws InvalidConfigurationException
Sets up the functions to use and other parameters. Then creates the initial genotype.

Specified by:
create in class GPProblem
Returns:
the genotype created
Throws:
InvalidConfigurationException
Since:
3.0

main

public static void main(java.lang.String[] args)
Starts the example.

Parameters:
args - ignored
Throws:
java.lang.Exception
Since:
3.0

writeToStream

public static void writeToStream(IGPProgram prog)
                          throws java.lang.Exception
Throws:
java.lang.Exception

readFromStream

public static java.lang.Object readFromStream()
                                       throws java.lang.Exception
Throws:
java.lang.Exception

JGAP