org.vizzini.example.ant
Class Ant

java.lang.Object
  extended by org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
      extended by org.vizzini.ai.geneticprogramming.AbstractGeneticAlgorithmGP
          extended by org.vizzini.example.ant.Ant
All Implemented Interfaces:
IGeneticAlgorithm, IGeneticAlgorithmGP

public class Ant
extends AbstractGeneticAlgorithmGP

Provides an example ant problem using genetic programming.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson

Field Summary
static String HEADING_EAST
          Enumeration of ant heading East.
static String HEADING_NORTH
          Enumeration of ant heading North.
static String HEADING_SOUTH
          Enumeration of ant heading South.
static String HEADING_WEST
          Enumeration of ant heading West.
 
Fields inherited from class org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
_crossoverFraction, _crossoverType, _elapsedTime, _generation
 
Constructor Summary
Ant()
          Construct this object.
 
Method Summary
protected  int evaluateFitness(int index, IChromosomeGP chromosome, boolean isPrinting)
          Evaluate the fitness of the given chromosome for this problem.
protected  int getPerfectFitness()
          Return the perfect fitness.
protected  Class getReturnType()
          Return the overall return type for the chromosomes.
static void main(String[] args)
          Application method.
static void main2(String[] args)
          Application method.
 
Methods inherited from class org.vizzini.ai.geneticprogramming.AbstractGeneticAlgorithmGP
addFunction, addTerminal, createChromosome, evaluateFitness, getContext, getFunctionCount, getFunctionGenerator, getInitialMaxDepth, getTerminalCount, isSimpleBetter, onePointCrossover, penalizeComplexity, setContext, setInitialMaxDepth, setSimpleBetter
 
Methods inherited from class org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
averageCrossover, fillPopulation, generateNewPopulation, getAverageCrossoverFraction, getCrossoverFraction, getCrossoverType, getElapsedTime, getGeneration, getMostFit, getMutationFraction, getMutationMagnitude, getMutationRate, getPopulation, getPopulationSize, getProcessingRate, isDuplicateAllowed, mutation, reproductionAndCrossover, reset, runGenerations, setAverageCrossoverFraction, setCrossoverFraction, setCrossoverType, setDuplicateAllowed, setMutationFraction, setMutationMagnitude, setMutationRate, setPopulation, setPopulationSize, sortPopulation, toString, uniformCrossover, writeReport, writeStats, writeStatsHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.ai.geneticalgorithm.IGeneticAlgorithm
getCrossoverFraction, getCrossoverType, getElapsedTime, getGeneration, getMostFit, getMutationFraction, getMutationMagnitude, getMutationRate, getPopulationSize, getProcessingRate, reset, runGenerations, setAverageCrossoverFraction, setCrossoverFraction, setCrossoverType, setDuplicateAllowed, setMutationFraction, setMutationMagnitude, setMutationRate, setPopulationSize, writeReport
 

Field Detail

HEADING_EAST

public static final String HEADING_EAST
Enumeration of ant heading East.

See Also:
Constant Field Values

HEADING_SOUTH

public static final String HEADING_SOUTH
Enumeration of ant heading South.

See Also:
Constant Field Values

HEADING_WEST

public static final String HEADING_WEST
Enumeration of ant heading West.

See Also:
Constant Field Values

HEADING_NORTH

public static final String HEADING_NORTH
Enumeration of ant heading North.

See Also:
Constant Field Values
Constructor Detail

Ant

public Ant()
Construct this object.

Since:
v0.3
Method Detail

main

public static final void main(String[] args)
Application method.

Parameters:
args - Input arguments.
Since:
v0.3

main2

public static final void main2(String[] args)
Application method.

Parameters:
args - Input arguments.
Since:
v0.3

evaluateFitness

protected int evaluateFitness(int index,
                              IChromosomeGP chromosome,
                              boolean isPrinting)
Evaluate the fitness of the given chromosome for this problem.

Specified by:
evaluateFitness in class AbstractGeneticAlgorithmGP
Parameters:
chromosome - Chromosome.
isPrinting - Flag indicating if the method should print.
Since:
v0.3

getPerfectFitness

protected int getPerfectFitness()
Return the perfect fitness.

Overrides:
getPerfectFitness in class AbstractGeneticAlgorithm
Since:
v0.3

getReturnType

protected Class getReturnType()
Return the overall return type for the chromosomes.

Specified by:
getReturnType in class AbstractGeneticAlgorithmGP
Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02