org.vizzini.ai.geneticalgorithm.example
Class PrimeGA

java.lang.Object
  extended by org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
      extended by org.vizzini.ai.geneticalgorithm.example.PrimeGA
All Implemented Interfaces:
IGeneticAlgorithm

public class PrimeGA
extends AbstractGeneticAlgorithm

Provides an example genetic algorithm which searches for prime numbers. This example excercises the ChromosomeInt and AbstractGeneticAlgorithm.

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

Field Summary
 
Fields inherited from class org.vizzini.ai.geneticalgorithm.AbstractGeneticAlgorithm
_crossoverFraction, _crossoverType, _elapsedTime, _generation
 
Constructor Summary
PrimeGA()
           
 
Method Summary
protected  IChromosome createChromosome()
          Create a new chromosome.
protected  void evaluateFitness()
          Evaluate the fitness of all chromosomes in the population.
protected  int getPerfectFitness()
          Return the perfect fitness.
static boolean isPrime(int value)
          Return true if the given value is a prime number.
static void main(String[] args)
          Application method.
 
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, onePointCrossover, 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
 

Constructor Detail

PrimeGA

public PrimeGA()
Method Detail

isPrime

public static boolean isPrime(int value)
Return true if the given value is a prime number.

Since:
v0.3

main

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

Since:
v0.3

createChromosome

protected IChromosome createChromosome()
Create a new chromosome.

Specified by:
createChromosome in class AbstractGeneticAlgorithm
Since:
v0.2

evaluateFitness

protected void evaluateFitness()
Evaluate the fitness of all chromosomes in the population.

Specified by:
evaluateFitness in class AbstractGeneticAlgorithm
Since:
v0.3

getPerfectFitness

protected int getPerfectFitness()
Return the perfect fitness.

Overrides:
getPerfectFitness in class AbstractGeneticAlgorithm
Since:
v0.2


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