org.encog.ml.ea.train

## Interface EvolutionaryAlgorithm

- All Known Implementing Classes:
    BasicEA, MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper, TrainEA

      public interface EvolutionaryAlgorithm

  This interface defines the basic functionality of an Evolutionary Algorithm. An evolutionary algorithm is one that applies operations to a population of potential "solutions".

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOperation(double probability, EvolutionaryOperator opp)` Add an operation.
    `void` | `addScoreAdjuster(AdjustScore scoreAdjust)` Add a score adjuster.
    `void` | `calculateScore(Genome g)` Calculate the score for a genome.
    `void` | `finishTraining()` Called when training is finished.
    `GenomeComparator` | `getBestComparator()` Get the comparator that is used to choose the "true best" genome.
    `Genome` | `getBestGenome()`
    `GeneticCODEC` | `getCODEC()`
    `double` | `getError()`
    `int` | `getIteration()`
    `int` | `getMaxIndividualSize()`
    `int` | `getMaxTries()`
    `OperationList` | `getOperators()`
    `Population` | `getPopulation()`
    `RuleHolder` | `getRules()`
    `List<AdjustScore>` | `getScoreAdjusters()`
    `CalculateScore` | `getScoreFunction()`
    `SelectionOperator` | `getSelection()`
    `GenomeComparator` | `getSelectionComparator()` Get the comparator that is used to choose the "best" genome for selection, as opposed to the "true best".
    `boolean` | `getShouldIgnoreExceptions()`
    `Speciation` | `getSpeciation()`
    `boolean` | `isValidationMode()`
    `void` | `iteration()` Perform a training iteration.
    `void` | `setBestComparator(GenomeComparator bestComparator)` Set the comparator that is used to choose the "true best" genome.
    `void` | `setPopulation(Population thePopulation)` Set the population.
    `void` | `setRules(RuleHolder rules)` Set the rules holder to use.
    `void` | `setSelection(SelectionOperator selection)` Set the selection operator.
    `void` | `setSelectionComparator(GenomeComparator selectionComparator)` Set the comparator that is used to choose the "best" genome for selection, as opposed to the "true best".
    `void` | `setShouldIgnoreExceptions(boolean b)` Determines if genetic operator exceptions should be ignored.
    `void` | `setSpeciation(Speciation m)` Set the speciation method.
    `void` | `setValidationMode(boolean validationMode)` Determine if the genomes should be validated.

- - ### Method Detail

    - #### addOperation

          void addOperation(double probability,
                          EvolutionaryOperator opp)

      Add an operation.
      Parameters:
        `probability` - The probability of using this operator.
        `opp` - The operator to add.

    - #### addScoreAdjuster

          void addScoreAdjuster(AdjustScore scoreAdjust)

      Add a score adjuster. Score adjusters are used to adjust the adjusted score of a genome. This allows bonuses and penalties to be applied for desirable or undesirable traits.
      Parameters:
        `scoreAdjust` - The score adjustor to add.

    - #### calculateScore

          void calculateScore(Genome g)

      Calculate the score for a genome.
      Parameters:
        `g` - The genome to calculate the score for.

    - #### finishTraining

          void finishTraining()

      Called when training is finished. This allows the EA to properly shut down.

    - #### getBestComparator

          GenomeComparator getBestComparator()

      Get the comparator that is used to choose the "true best" genome. This uses the real score, and not the adjusted score.
      Returns:
        The best comparator.

    - #### getBestGenome

          Genome getBestGenome()

      Returns:
        The current best genome. This genome is safe to use while the EA is running. Genomes are not modified. They simply produce "offspring".

    - #### getCODEC

          GeneticCODEC getCODEC()

      Returns:
        The CODEC that is used to transform between genome and phenome.

    - #### getError

          double getError()

      Returns:
        The current score. This value should either be minimized or maximized, depending on the score function.

    - #### getIteration

          int getIteration()

      Returns:
        The current iteration number. Also sometimes referred to as generation or epoch.

    - #### getMaxIndividualSize

          int getMaxIndividualSize()

      Returns:
        The maximum size an individual genome can be. This is an arbitrary number defined by the genome. Lower numbers are less complex.

    - #### getMaxTries

          int getMaxTries()

      Returns:
        The maximum number to try certain genetic operations. This prevents endless loops.

    - #### getOperators

          OperationList getOperators()

      Returns:
        The operators.

    - #### getPopulation

          Population getPopulation()

      Returns:
        The population.

    - #### getRules

          RuleHolder getRules()

      Returns:
        The rules holder, contains rewrite and constraint rules.

    - #### getScoreAdjusters

          List<AdjustScore> getScoreAdjusters()

      Returns:
        The score adjusters. This allows bonuses and penalties to be applied for desirable or undesirable traits.

    - #### getScoreFunction

          CalculateScore getScoreFunction()

      Returns:
        The score function.

    - #### getSelection

          SelectionOperator getSelection()

      Returns:
        The selection operator. Used to choose genomes.

    - #### getSelectionComparator

          GenomeComparator getSelectionComparator()

      Get the comparator that is used to choose the "best" genome for selection, as opposed to the "true best". This uses the adjusted score, and not the score.
      Returns:
        The selection comparator.

    - #### getShouldIgnoreExceptions

          boolean getShouldIgnoreExceptions()

      Returns:
        True if exceptions that occur during genetic operations should be ignored.

    - #### getSpeciation

          Speciation getSpeciation()

      Returns:
        The speciation method.

    - #### isValidationMode

          boolean isValidationMode()

      Returns:
        True if any genome validators should be applied.

    - #### iteration

          void iteration()

      Perform a training iteration. Also called generations or epochs.

    - #### setBestComparator

          void setBestComparator(GenomeComparator bestComparator)

      Set the comparator that is used to choose the "true best" genome. This uses the real score, and not the adjusted score.
      Parameters:
        `bestComparator` - The best comparator.

    - #### setPopulation

          void setPopulation(Population thePopulation)

      Set the population.
      Parameters:
        `thePopulation` - The population.

    - #### setRules

          void setRules(RuleHolder rules)

      Set the rules holder to use.
      Parameters:
        `rules` - The rules holder.

    - #### setSelection

          void setSelection(SelectionOperator selection)

      Set the selection operator.
      Parameters:
        `selection` - The selection operator.

    - #### setSelectionComparator

          void setSelectionComparator(GenomeComparator selectionComparator)

      Set the comparator that is used to choose the "best" genome for selection, as opposed to the "true best". This uses the adjusted score, and not the score.
      Parameters:
        `selectionComparator` - The selection comparator.

    - #### setShouldIgnoreExceptions

          void setShouldIgnoreExceptions(boolean b)

      Determines if genetic operator exceptions should be ignored.
      Parameters:
        `b` - True if exceptions should be ignored.

    - #### setSpeciation

          void setSpeciation(Speciation m)

      Set the speciation method.
      Parameters:
        `m` - The speciation method.

    - #### setValidationMode

          void setValidationMode(boolean validationMode)

      Determine if the genomes should be validated. This takes more time but can help isolate a problem.
      Parameters:
        `validationMode` - True, if validation mode is enabled.

Copyright © 2014. All Rights Reserved.