|
|||||||||
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.
VectorIndividual defines three common types of crossover 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 should belong to the species VectorSpecies (or some subclass of it).
Parameters
genome-size int >= 1 |
(size of the genome) |
chunk-size 1 <= int <= genome-size |
(the chunk size for crossover (crossover will only occur on chunk boundaries)) |
crossover-type string, one of: one, two, any |
(default crossover type (one-point, two-point, or any-point (uniform) crossover) |
crossover-prob 0.0 >= float >= 1.0 |
(probability that a gene will get crossed over during any-point crossover) |
mutation-prob 0.0 <= float <= 1.0 |
(probability that a gene will get mutated over default mutation) |
Field Summary | |
static int |
C_ANY_POINT
|
static int |
C_ONE_POINT
|
static int |
C_TWO_POINT
|
int |
chunksize
How big of chunks should we define for crossover? |
float |
crossoverProbability
Probability that a gene will cross over -- ONLY used in V_ANY_POINT crossover |
int |
crossoverType
What kind of crossover do we have? |
static java.lang.String |
EVALUATED_PREAMBLE
Evaluated string to appear when printed |
int |
genomeSize
How big of a genome should we create on initialization? |
float |
mutationProbability
Probability that a gene will mutate |
static java.lang.String |
P_CHUNKSIZE
|
static java.lang.String |
P_CROSSOVERPROB
|
static java.lang.String |
P_CROSSOVERTYPE
|
static java.lang.String |
P_GENOMESIZE
|
static java.lang.String |
P_MUTATIONPROB
|
static java.lang.String |
V_ANY_POINT
|
static java.lang.String |
V_ONE_POINT
|
static java.lang.String |
V_TWO_POINT
|
Fields inherited from class ec.Individual |
evaluated, fitness |
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. |
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. |
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 |
equals, hashCode, printIndividual, printIndividual, printIndividualForHumans, protoClone, protoCloneSimple, readIndividual |
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 int C_ONE_POINT
public static final int C_TWO_POINT
public static final int C_ANY_POINT
public static final java.lang.String P_CROSSOVERTYPE
public static final java.lang.String P_CHUNKSIZE
public static final java.lang.String V_ONE_POINT
public static final java.lang.String V_TWO_POINT
public static final java.lang.String V_ANY_POINT
public static final java.lang.String P_MUTATIONPROB
public static final java.lang.String P_CROSSOVERPROB
public static final java.lang.String P_GENOMESIZE
public static final java.lang.String EVALUATED_PREAMBLE
public float mutationProbability
public float crossoverProbability
public int crossoverType
public int genomeSize
public int chunksize
Constructor Detail |
public VectorIndividual()
Method Detail |
public void setup(EvolutionState state, Parameter base)
Individual
setup
in class Individual
ec.Individual
Prototype.setup(EvolutionState,Parameter)
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 |