public class NEATIndividual extends GeneVectorIndividual
Parameters
| base.network Classname, = ec.neat.NEATNetwork |
Class of network in the individual |
Parameter bases
| base.network | network in the individual |
Default Base
neat.individual
| Modifier and Type | Field and Description |
|---|---|
double |
adjustedFitness
Fitness after the adjustment.
|
boolean |
champion
Marks the subspecies champion, which is the individual who has the
highest fitness with the subspecies.
|
boolean |
eliminate
Marker for destruction of inferior individual.
|
double |
expectedOffspring
Number of children this individual may have for next generation.
|
int |
generation
Tells which generation this individual is from.
|
double |
highFit
debug variable, highest fitness of champion
|
java.util.ArrayList<NEATNode> |
nodes
All the node of this individual.
|
boolean |
popChampion
Marks the best individual in current generation of the population.
|
boolean |
popChampionChild
Marks the duplicate child of a champion (for tracking purposes).
|
NEATSubspecies |
subspecies
The individual's subpecies
|
int |
superChampionOffspring
Number of reserved offspring for a population leader.
|
int |
timeAlive
When playing in real-time allows knowing the maturity of an individual
|
genome, P_GENEVECTORINDIVIDUALevaluated, EVALUATED_PREAMBLE, fitness, P_INDIVIDUAL, species| Constructor and Description |
|---|
NEATIndividual() |
| Modifier and Type | Method and Description |
|---|---|
void |
addGene(NEATGene[] appendGenes)
We append new gene(s) to the current genome
|
java.lang.Object |
clone()
Creates a new individual cloned from a prototype,
and suitable to begin use in its own evolutionary
context.
|
NEATNetwork |
createNetwork() |
void |
createNodeCopyIfMissing(java.util.ArrayList<NEATNode> nodeList,
NEATNode node)
Create the node if the nodeList do not have that node.The nodes in the
nodeList is guarantee in ascending order according to node's nodeId.
|
NEATIndividual |
crossover(EvolutionState state,
int thread,
NEATIndividual secondParent)
Crossover function.
|
Parameter |
defaultBase()
Returns the default base for this prototype.
|
void |
defaultMutate(EvolutionState state,
int thread)
Mutation function, determine which mutation is going to proceed with
certain probabilities parameters.
|
boolean |
equals(java.lang.Object obj)
Returns true if I am genetically "equal" to ind.
|
java.lang.String |
genotypeToString()
This method is used to output a individual that is same as the format in
start genome file.
|
int |
getGeneInnovationNumberSup()
Get the upperbound for the innovation number, used in Initializer.
|
int |
getNodeIdSup()
Get the upperbound for the node id, used in Initializer.
|
boolean |
hasGene(java.util.ArrayList<Gene> genome,
Gene gene)
Test if a genome has certain gene.
|
int |
hashCode()
Returns a hashcode for the individual, such that individuals which
are equals(...) each other always return the same
hash code.
|
NEATIndividual |
mateMultipoint(EvolutionState state,
int thread,
NEATIndividual secondParent,
boolean averageFlag)
Doing crossover from two parent at multiple points in the genome.
|
NEATIndividual |
mateSinglepoint(EvolutionState state,
int thread,
NEATIndividual secondParent)
Deprecated.
|
void |
mutateAddLink(EvolutionState state,
int thread)
Try to add a new gene (link) into the current genome.
|
void |
mutateAddNode(EvolutionState state,
int thread)
Add a new node into this individual.
|
void |
mutateGeneReenable()
Reenable a gene if it's disabled.
|
void |
mutateLinkWeights(EvolutionState state,
int thread,
NEATSpecies species,
double power,
double rate,
NEATSpecies.MutationType mutationType)
Mutate the weights of the genes
|
void |
mutateToggleEnable(EvolutionState state,
int thread,
int times)
Randomly enable or disable a gene.
|
protected void |
parseGenotype(EvolutionState state,
java.io.LineNumberReader reader)
This method is used to read a gene in start genome from file.
|
void |
parseNodes(EvolutionState state,
java.io.LineNumberReader reader)
Create the nodes from the reader, and calls readNode method on each node.
|
void |
reset(java.util.ArrayList<NEATNode> nodeList,
java.util.ArrayList<Gene> genes)
Reset the individual with given nodes and genome
|
void |
reset(EvolutionState state,
int thread)
Initializes an individual with minimal structure.
|
void |
setGeneration(EvolutionState state)
Set the born generation of this individual.
|
void |
setup(EvolutionState state,
Parameter base)
This should be used to set up only those things which you share in common
with all other individuals in your species; individual-specific items
which make you you should be filled in by Species.newIndividual(...),
and modified by breeders.
|
java.lang.String |
toString()
This method convert the individual in to human readable format.
|
cloneGenes, defaultCrossover, genomeLength, genotypeToStringForHumans, getGenome, join, readGenotype, setGenome, setGenomeLength, split, writeGenotypereset, sizecompareTo, distanceTo, merge, printIndividual, printIndividual, printIndividual, printIndividualForHumans, printIndividualForHumans, readIndividual, readIndividual, writeIndividualpublic double adjustedFitness
public NEATSubspecies subspecies
public double expectedOffspring
public int generation
public boolean eliminate
public boolean champion
public int superChampionOffspring
public boolean popChampion
public boolean popChampionChild
public double highFit
public int timeAlive
public java.util.ArrayList<NEATNode> nodes
public void setup(EvolutionState state, Parameter base)
Individualsetup in interface Prototypesetup in interface Setupsetup in class GeneVectorIndividualPrototype.setup(EvolutionState,Parameter)public Parameter defaultBase()
PrototypedefaultBase in interface PrototypedefaultBase in class GeneVectorIndividualpublic void reset(EvolutionState state, int thread)
reset in class GeneVectorIndividualpublic void reset(java.util.ArrayList<NEATNode> nodeList, java.util.ArrayList<Gene> genes)
public int hashCode()
IndividualhashCode in class GeneVectorIndividualpublic boolean equals(java.lang.Object obj)
Individualequals in class GeneVectorIndividualpublic void setGeneration(EvolutionState state)
public int getNodeIdSup()
public int getGeneInnovationNumberSup()
public java.lang.Object clone()
PrototypeTypically this should be a full "deep" clone. However, you may share certain elements with other objects rather than clone hem, depending on the situation:
Implementations.
public Object clone()
{
try
{
return super.clone();
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
}
public Object clone()
{
try
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
return myobj;
}
public Object clone()
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
return myobj;
}
clone in interface Prototypeclone in class GeneVectorIndividualpublic java.lang.String genotypeToString()
genotypeToString in class GeneVectorIndividualprotected void parseGenotype(EvolutionState state, java.io.LineNumberReader reader) throws java.io.IOException
parseGenotype in class GeneVectorIndividualjava.io.IOExceptionpublic void parseNodes(EvolutionState state, java.io.LineNumberReader reader) throws java.io.IOException
java.io.IOExceptionpublic void addGene(NEATGene[] appendGenes)
public void mutateLinkWeights(EvolutionState state, int thread, NEATSpecies species, double power, double rate, NEATSpecies.MutationType mutationType)
public void mutateAddLink(EvolutionState state, int thread)
public void mutateAddNode(EvolutionState state, int thread)
public void mutateToggleEnable(EvolutionState state, int thread, int times)
public void mutateGeneReenable()
public void defaultMutate(EvolutionState state, int thread)
defaultMutate in class GeneVectorIndividualpublic NEATIndividual crossover(EvolutionState state, int thread, NEATIndividual secondParent)
@Deprecated public NEATIndividual mateSinglepoint(EvolutionState state, int thread, NEATIndividual secondParent)
public boolean hasGene(java.util.ArrayList<Gene> genome, Gene gene)
public void createNodeCopyIfMissing(java.util.ArrayList<NEATNode> nodeList, NEATNode node)
public NEATIndividual mateMultipoint(EvolutionState state, int thread, NEATIndividual secondParent, boolean averageFlag)
public NEATNetwork createNetwork()
public java.lang.String toString()
toString in class Individual