|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectec.Individual
ec.gp.GPIndividual
public class GPIndividual
GPIndividual is an Individual used for GP evolution runs. GPIndividuals contain, at the very least, a nonempty array of GPTrees. You can use GPIndividual directly, or subclass it to extend it as you see fit.
GPIndividuals have two clone methods: clone() and lightClone(). clone() is a deep clone method as usual. lightClone() is a light clone which does not copy the trees.
In addition to serialization for checkpointing, Individuals may read and write themselves to streams in three ways.
In general, the various readers and writers do three things: they tell the Fitness to read/write itself, they read/write the evaluated flag, and they read/write the GPTree array (by having each GPTree read/write itself). If you add instance variables to GPIndividual, you'll need to read/write those variables as well.
Parameters
base.numtrees int >= 1 |
(number of trees in the GPIndividual) |
base.tree.n classname, inherits or = ec.gp.GPTree |
(class of tree n in the individual) |
Default Base
gp.individual
Parameter bases
base.tree.n | tree n in the individual |
Field Summary | |
---|---|
static java.lang.String |
P_NUMTREES
|
static java.lang.String |
P_TREE
|
GPTree[] |
trees
|
Fields inherited from class ec.Individual |
---|
evaluated, EVALUATED_PREAMBLE, fitness, P_INDIVIDUAL, species |
Constructor Summary | |
---|---|
GPIndividual()
|
Method Summary | |
---|---|
java.lang.Object |
clone()
Deep-clones the GPIndividual. |
Parameter |
defaultBase()
Returns the default base for this prototype. |
boolean |
equals(java.lang.Object ind)
Returns true if I am genetically "equal" to ind. |
int |
hashCode()
Returns a hashcode for the individual, such that individuals which are equals(...) each other always return the same hash code. |
GPIndividual |
lightClone()
Like clone(), but doesn't force the GPTrees to deep-clone themselves. |
void |
parseGenotype(EvolutionState state,
java.io.LineNumberReader reader)
This method is used only by the default version of readIndividual(state,reader), and it is intended to be overridden to parse in that part of the individual that was outputted in the genotypeToString() method. |
void |
printIndividual(EvolutionState state,
int log,
int verbosity)
Overridden for the GPIndividual genotype, writing each tree in turn. |
void |
printIndividual(EvolutionState state,
java.io.PrintWriter writer)
Overridden for the GPIndividual genotype, writing each tree in turn. |
void |
printIndividualForHumans(EvolutionState state,
int log,
int verbosity)
Overridden for the GPIndividual genotype, writing each tree in turn. |
void |
readGenotype(EvolutionState state,
java.io.DataInput dataInput)
Overridden for the GPIndividual genotype. |
void |
setup(EvolutionState state,
Parameter base)
Sets up a prototypical GPIndividual with those features which it shares with other GPIndividuals in its species, and nothing more. |
long |
size()
Returns the "size" of the individual, namely, the number of nodes in all of its subtrees. |
void |
verify(EvolutionState state)
Verification of validity of the GPIndividual -- strictly for debugging purposes only |
void |
writeGenotype(EvolutionState state,
java.io.DataOutput dataOutput)
Overridden for the GPIndividual genotype. |
Methods inherited from class ec.Individual |
---|
distanceTo, genotypeToString, genotypeToStringForHumans, readIndividual, readIndividual, toString, writeIndividual |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String P_NUMTREES
public static final java.lang.String P_TREE
public GPTree[] trees
Constructor Detail |
---|
public GPIndividual()
Method Detail |
---|
public Parameter defaultBase()
Prototype
public boolean equals(java.lang.Object ind)
Individual
equals
in class Individual
public int hashCode()
Individual
hashCode
in class Individual
public void setup(EvolutionState state, Parameter base)
public final void verify(EvolutionState state)
public void printIndividualForHumans(EvolutionState state, int log, int verbosity)
printIndividualForHumans
in class Individual
public void printIndividual(EvolutionState state, int log, int verbosity)
printIndividual
in class Individual
public void printIndividual(EvolutionState state, java.io.PrintWriter writer)
printIndividual
in class Individual
public void writeGenotype(EvolutionState state, java.io.DataOutput dataOutput) throws java.io.IOException
writeGenotype
in class Individual
java.io.IOException
public void readGenotype(EvolutionState state, java.io.DataInput dataInput) throws java.io.IOException
readGenotype
in class Individual
java.io.IOException
public void parseGenotype(EvolutionState state, java.io.LineNumberReader reader) throws java.io.IOException
Individual
parseGenotype
in class Individual
java.io.IOException
public java.lang.Object clone()
clone
in interface Prototype
clone
in class Individual
public GPIndividual lightClone()
public long size()
size
in class Individual
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |