org.encog.solve.genetic
Class GeneticAlgorithm

java.lang.Object
  extended by org.encog.solve.genetic.GeneticAlgorithm
Direct Known Subclasses:
NEATTraining, NeuralGeneticAlgorithm.NeuralGeneticAlgorithmHelper

public class GeneticAlgorithm
extends Object

Implements a genetic algorithm. This is an abstract class. Other classes are provided by Encog use this base class to train neural networks or provide an answer to the traveling salesman problem. The genetic algorithm is also capable of using a thread pool to speed execution.


Constructor Summary
GeneticAlgorithm()
           
 
Method Summary
 void addSpeciesMember(Species species, Genome genome)
          Add a genome.
 void calculateScore(Genome g)
          Calculate the score for this genome.
 CalculateGenomeScore getCalculateScore()
           
 GenomeComparator getComparator()
           
 Crossover getCrossover()
           
 double getMatingPopulation()
          Get the mating population.
 Mutate getMutate()
           
 double getMutationPercent()
          Get the mutation percent.
 double getPercentToMate()
          Get the percent to mate.
 Population getPopulation()
           
 void iteration()
          Modify the weight matrix and bias values based on the last call to calcError.
 void setCalculateScore(CalculateGenomeScore calculateScore)
          Set the score calculation object.
 void setComparator(GenomeComparator comparator)
          Set the comparator.
 void setCrossover(Crossover crossover)
          Set the crossover object.
 void setMatingPopulation(double matingPopulation)
          Set the mating population percent.
 void setMutate(Mutate mutate)
          Set the mutate object.
 void setMutationPercent(double mutationPercent)
          Set the mutation percent.
 void setPercentToMate(double percentToMate)
          Set the percent to mate.
 void setPopulation(Population population)
          Set the population.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneticAlgorithm

public GeneticAlgorithm()
Method Detail

calculateScore

public void calculateScore(Genome g)
Calculate the score for this genome. The genome's score will be set.

Parameters:
g - The genome to calculate for.

getCalculateScore

public CalculateGenomeScore getCalculateScore()
Returns:
The score calculation object.

getComparator

public GenomeComparator getComparator()
Returns:
The comparator.

getCrossover

public Crossover getCrossover()
Returns:
The crossover object.

getMatingPopulation

public double getMatingPopulation()
Get the mating population.

Returns:
The mating population percent.

getMutate

public Mutate getMutate()
Returns:
The mutate object.

getMutationPercent

public double getMutationPercent()
Get the mutation percent.

Returns:
The mutation percent.

getPercentToMate

public double getPercentToMate()
Get the percent to mate.

Returns:
The percent to mate.

getPopulation

public Population getPopulation()
Returns:
The population.

iteration

public void iteration()
Modify the weight matrix and bias values based on the last call to calcError.

Throws:
NeuralNetworkException

setCalculateScore

public void setCalculateScore(CalculateGenomeScore calculateScore)
Set the score calculation object.

Parameters:
calculateScore - The score calculation object.

setComparator

public void setComparator(GenomeComparator comparator)
Set the comparator.

Parameters:
comparator - The comparator.

setCrossover

public void setCrossover(Crossover crossover)
Set the crossover object.

Parameters:
crossover - The crossover object.

setMatingPopulation

public void setMatingPopulation(double matingPopulation)
Set the mating population percent.

Parameters:
matingPopulation - The mating population percent.

setMutate

public void setMutate(Mutate mutate)
Set the mutate object.

Parameters:
mutate - The mutate object.

setMutationPercent

public void setMutationPercent(double mutationPercent)
Set the mutation percent.

Parameters:
mutationPercent - The percent to mutate.

setPercentToMate

public void setPercentToMate(double percentToMate)
Set the percent to mate.

Parameters:
percentToMate - The percent to mate.

setPopulation

public void setPopulation(Population population)
Set the population.

Parameters:
population - The population.

addSpeciesMember

public void addSpeciesMember(Species species,
                             Genome genome)
Add a genome.

Parameters:
species - The species to add.
genome - The genome to add.


Copyright © 2011. All Rights Reserved.