Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.encog.ml.genetic
Class GeneticAlgorithm

    java.lang.Object
      org.encog.ml.genetic.GeneticAlgorithm

All Implemented Interfaces:
  MultiThreadable

Direct Known Subclasses:
  BasicGeneticAlgorithm, NEATTraining

    public abstract class GeneticAlgorithm

extends Object
implements MultiThreadable

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()`
`int` | `getThreadCount()`
`abstract void` | `iteration()` Perform one training iteration.
`void` | `setCalculateScore(CalculateGenomeScore theCalculateScore)` Set the score calculation object.
`void` | `setComparator(GenomeComparator theComparator)` Set the comparator.
`void` | `setCrossover(Crossover theCrossover)` Set the crossover object.
`void` | `setMatingPopulation(double theMatingPopulation)` Set the mating population percent.
`void` | `setMutate(Mutate theMutate)` Set the mutate object.
`void` | `setMutationPercent(double theMutationPercent)` Set the mutation percent.
`void` | `setPercentToMate(double thePercentToMate)` Set the percent to mate.
`void` | `setPopulation(Population thePopulation)` Set the population.
`void` | `setThreadCount(int numThreads)` Set the number of threads to use.

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

### addSpeciesMember

    public final void addSpeciesMember(Species species,
                                       Genome genome)

  Add a genome.

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

### calculateScore

    public final 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 final CalculateGenomeScore getCalculateScore()

  Returns:
    The score calculation object.

### getComparator

    public final GenomeComparator getComparator()

  Returns:
    The comparator.

### getCrossover

    public final Crossover getCrossover()

  Returns:
    The crossover object.

### getMatingPopulation

    public final double getMatingPopulation()

  Get the mating population.

  Returns:
    The mating population percent.

### getMutate

    public final Mutate getMutate()

  Returns:
    The mutate object.

### getMutationPercent

    public final double getMutationPercent()

  Get the mutation percent.

  Returns:
    The mutation percent.

### getPercentToMate

    public final double getPercentToMate()

  Get the percent to mate.

  Returns:
    The percent to mate.

### getPopulation

    public final Population getPopulation()

  Returns:
    The population.

### setCalculateScore

    public final void setCalculateScore(CalculateGenomeScore theCalculateScore)

  Set the score calculation object.

  Parameters:
    `theCalculateScore` - The score calculation object.

### setComparator

    public final void setComparator(GenomeComparator theComparator)

  Set the comparator.

  Parameters:
    `theComparator` - The comparator.

### setCrossover

    public final void setCrossover(Crossover theCrossover)

  Set the crossover object.

  Parameters:
    `theCrossover` - The crossover object.

### setMatingPopulation

    public final void setMatingPopulation(double theMatingPopulation)

  Set the mating population percent.

  Parameters:
    `theMatingPopulation` - The mating population percent.

### setMutate

    public final void setMutate(Mutate theMutate)

  Set the mutate object.

  Parameters:
    `theMutate` - The mutate object.

### setMutationPercent

    public final void setMutationPercent(double theMutationPercent)

  Set the mutation percent.

  Parameters:
    `theMutationPercent` - The percent to mutate.

### setPercentToMate

    public final void setPercentToMate(double thePercentToMate)

  Set the percent to mate.

  Parameters:
    `thePercentToMate` - The percent to mate.

### setPopulation

    public final void setPopulation(Population thePopulation)

  Set the population.

  Parameters:
    `thePopulation` - The population.

### iteration

    public abstract void iteration()

  Perform one training iteration.

### getThreadCount

    public int getThreadCount()

  Specified by:
    `getThreadCount` in interface `MultiThreadable`
  Returns:
    The number of threads to use, 0 to automatically determine based on core count.

### setThreadCount

    public void setThreadCount(int numThreads)

  Set the number of threads to use.

  Specified by:
    `setThreadCount` in interface `MultiThreadable`
  Parameters:
    `numThreads` - The number of threads to use, or zero to automatically determine based on core count.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.