org.encog.neural.neat.training.opp
Class NEATMutation
- java.lang.Object
-
- org.encog.neural.neat.training.opp.NEATMutation
-
- All Implemented Interfaces:
- java.io.Serializable, EvolutionaryOperator
- Direct Known Subclasses:
- NEATMutateAddLink, NEATMutateAddNode, NEATMutateRemoveLink, NEATMutateWeights
public abstract class NEATMutation extends java.lang.Object implements EvolutionaryOperator, java.io.Serializable
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- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description NEATMutation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description NEATNeuronGenechooseRandomNeuron(NEATGenome target, boolean choosingFrom)Choose a random neuron.voidcreateLink(NEATGenome target, long neuron1ID, long neuron2ID, double weight)Create a link between two neuron id's.intgetElementPos(NEATGenome target, long neuronID)Get the specified neuron's index.EvolutionaryAlgorithmgetOwner()voidinit(EvolutionaryAlgorithm theOwner)Called to setup the evolutionary operator.booleanisDuplicateLink(NEATGenome target, long fromNeuronID, long toNeuronID)Determine if this is a duplicate link.booleanisNeuronNeeded(NEATGenome target, long neuronID)Determines if a neuron is still needed.NEATGenomeobtainGenome(Genome[] parents, int parentIndex, Genome[] offspring, int offspringIndex)Obtain the NEATGenome that we will mutate.intoffspringProduced()intparentsNeeded()voidremoveNeuron(NEATGenome target, long neuronID)Remove the specified neuron.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.encog.ml.ea.opp.EvolutionaryOperator
performOperation
-
-
-
-
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:
target- The target genome.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:
initin interfaceEvolutionaryOperator- 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:
target- The target.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:
offspringProducedin interfaceEvolutionaryOperator- Returns:
- Returns 1, as NEAT mutations only produce one child.
-
parentsNeeded
public int parentsNeeded()
- Specified by:
parentsNeededin interfaceEvolutionaryOperator- 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG