|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ec.Individual | +--ec.vector.VectorIndividual
VectorIndividual is the abstract superclass of simple individual representations which consist of vectors of values (booleans, integers, floating-point, etc.)
This class contains two methods, defaultCrossover and defaultMutate, which can be overridden if all you need is a simple crossover and a simple mutate mechanism. the VectorCrossoverPipeline and VectorMutationPipeline classes use these methods to do their handiwork. For more sophisticated crossover and mutation, you'll need to write a custom breeding pipeline.
The kind of default crossover and mutation, and associated information, is stored in the VectorIndividual's VectorSpecies object, which is obtained through the species variable. For example, VectorIndividual assumes three common types of crossover as defined in VectorSpecies which you should implement in your defaultCrossover method: one-point, two-point, and any-point (otherwise known as "uniform") crossover.
VectorIndividual is typically used for fixed-length vector representations; however, it can also be used with variable-length representations. Two methods have been provided in all subclasses of VectorIndividual to help you there: split and join, which you can use to break up and reconnect VectorIndividuals in a variety of ways. Note that you may want to override the reset() method to create individuals with different initial lengths.
VectorIndividuals must belong to the species VectorSpecies (or some subclass of it).
Field Summary | |
static java.lang.String |
EVALUATED_PREAMBLE
Evaluated string to appear when printed |
Fields inherited from class ec.Individual |
evaluated, fitness, species |
Constructor Summary | |
VectorIndividual()
|
Method Summary | |
void |
defaultCrossover(EvolutionState state,
int thread,
VectorIndividual ind)
Destructively crosses over the individual with another in some default manner. |
void |
defaultMutate(EvolutionState state,
int thread)
Destructively mutates the individual in some default manner. |
long |
genomeLength()
Returns the length of the gene array. |
java.lang.Object |
getGenome()
Returns the gene array. |
void |
join(java.lang.Object[] pieces)
Joins the n pieces and sets the genome to their concatenation. |
abstract void |
reset(EvolutionState state,
int thread)
Initializes the individual. |
void |
setGenome(java.lang.Object gen)
Sets the gene array. |
long |
size()
Returns the "size" of the individual. |
void |
split(int[] points,
java.lang.Object[] pieces)
Splits the genome into n pieces, according to points, which *must* be sorted. |
Methods inherited from class ec.Individual |
deepClone, equals, hashCode, printIndividual, printIndividual, printIndividualForHumans, protoClone, protoCloneSimple, readIndividual, setup |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ec.Prototype |
defaultBase |
Field Detail |
public static final java.lang.String EVALUATED_PREAMBLE
Constructor Detail |
public VectorIndividual()
Method Detail |
public void defaultCrossover(EvolutionState state, int thread, VectorIndividual ind)
public void defaultMutate(EvolutionState state, int thread)
public abstract void reset(EvolutionState state, int thread)
public java.lang.Object getGenome()
public void setGenome(java.lang.Object gen)
getGenome()
public long genomeLength()
public void split(int[] points, java.lang.Object[] pieces)
public void join(java.lang.Object[] pieces)
public long size()
Individual
size
in class Individual
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |