org.encog.neural.neat.training.opp

## Class NEATMutation

- java.lang.Object
- - org.encog.neural.neat.training.opp.NEATMutation

- All Implemented Interfaces:
    EvolutionaryOperator
  Direct Known Subclasses:
    NEATMutateAddLink, NEATMutateAddNode, NEATMutateRemoveLink, NEATMutateWeights

      public abstract class NEATMutation
      extends Object
      implements EvolutionaryOperator

  This class represents a NEAT mutation. NEAT supports several different types of mutations. This class provides common utility needed by any sort of a NEAT mutation. This class is abstract and cannot be used by itself. ----------------------------------------------------------------------------- http://www.cs.ucf.edu/~kstanley/ Encog's NEAT implementation was drawn from the following three Journal Articles. For more complete BibTeX sources, see NEATNetwork.java. Evolving Neural Networks Through Augmenting Topologies Generating Large-Scale Neural Networks Through Discovering Geometric Regularities Automatic feature selection in neuroevolution

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NEATMutation()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `NEATNeuronGene` | `chooseRandomNeuron(NEATGenome target, boolean choosingFrom)` Choose a random neuron.
    `void` | `createLink(NEATGenome target, long neuron1ID, long neuron2ID, double weight)` Create a link between two neuron id's.
    `int` | `getElementPos(NEATGenome target, long neuronID)` Get the specified neuron's index.
    `EvolutionaryAlgorithm` | `getOwner()`
    `void` | `init(EvolutionaryAlgorithm theOwner)` Called to setup the evolutionary operator.
    `boolean` | `isDuplicateLink(NEATGenome target, long fromNeuronID, long toNeuronID)` Determine if this is a duplicate link.
    `boolean` | `isNeuronNeeded(NEATGenome target, long neuronID)` Determines if a neuron is still needed.
    `NEATGenome` | `obtainGenome(Genome[] parents, int parentIndex, Genome[] offspring, int offspringIndex)` Obtain the NEATGenome that we will mutate.
    `int` | `offspringProduced()`
    `int` | `parentsNeeded()`
    `void` | `removeNeuron(NEATGenome target, long neuronID)` Remove the specified neuron.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.encog.ml.ea.opp.EvolutionaryOperator

      `performOperation`

- - ### Constructor Detail

    - #### NEATMutation

          public NEATMutation()

  - ### Method Detail

    - #### chooseRandomNeuron

          public NEATNeuronGene chooseRandomNeuron(NEATGenome target,
                                          boolean choosingFrom)

      Choose a random neuron.
      Parameters:
        `target` - The target genome. Should the input and bias neurons be included.
        `choosingFrom` - True if we are chosing from all neurons, false if we exclude the input and bias.
      Returns:
        The random neuron.

    - #### createLink

          public void createLink(NEATGenome target,
                        long neuron1ID,
                        long neuron2ID,
                        double weight)

      Create a link between two neuron id's. Create or find any necessary innovation records.
      Parameters:
        `target` - The target genome.
        `neuron1ID` - The id of the source neuron.
        `neuron2ID` - The id of the target neuron.
        `weight` - The weight of this new link.

    - #### getElementPos

          public int getElementPos(NEATGenome target,
                          long neuronID)

      Get the specified neuron's index.
      Parameters:
        `neuronID` - The neuron id to check for.
      Returns:
        The index.

    - #### getOwner

          public EvolutionaryAlgorithm getOwner()

      Returns:
        the owner

    - #### init

          public void init(EvolutionaryAlgorithm theOwner)

      Called to setup the evolutionary operator.
      Specified by:
        `init` in interface `EvolutionaryOperator`
      Parameters:
        `theOwner` - The evolutionary algorithm used with this operator.

    - #### isDuplicateLink

          public boolean isDuplicateLink(NEATGenome target,
                                long fromNeuronID,
                                long toNeuronID)

      Determine if this is a duplicate link.
      Parameters:
        `fromNeuronID` - The from neuron id.
        `toNeuronID` - The to neuron id.
      Returns:
        True if this is a duplicate link.

    - #### isNeuronNeeded

          public boolean isNeuronNeeded(NEATGenome target,
                               long neuronID)

      Determines if a neuron is still needed. If all links to/from a neuron have been removed, then the neuron is no longer needed.
      Parameters:
        `target` - The target genome.
        `neuronID` - The neuron id to check for.
      Returns:
        Returns true, if the neuron is still needed.

    - #### obtainGenome

          public NEATGenome obtainGenome(Genome[] parents,
                                int parentIndex,
                                Genome[] offspring,
                                int offspringIndex)

      Obtain the NEATGenome that we will mutate. NEAT mutates the genomes in place. So the parent and child genome must be the same literal object. Throw an exception, if this is not the case.
      Parameters:
        `parents` - The parents.
        `parentIndex` - The parent index.
        `offspring` - The offspring.
        `offspringIndex` - The offspring index.
      Returns:
        The genome that we will mutate.

    - #### offspringProduced

          public int offspringProduced()

      Specified by:
        `offspringProduced` in interface `EvolutionaryOperator`
      Returns:
        Returns 1, as NEAT mutations only produce one child.

    - #### parentsNeeded

          public int parentsNeeded()

      Specified by:
        `parentsNeeded` in interface `EvolutionaryOperator`
      Returns:
        Returns 1, as mutations typically are asexual and only require a single parent.

    - #### removeNeuron

          public void removeNeuron(NEATGenome target,
                          long neuronID)

      Remove the specified neuron.
      Parameters:
        `target` - The target genome.
        `neuronID` - The neuron to remove.

Copyright © 2014. All Rights Reserved.