ec.vector
Class IntegerVectorSpecies
- java.lang.Object
-
- ec.Species
-
- ec.vector.VectorSpecies
-
- ec.vector.IntegerVectorSpecies
-
- Direct Known Subclasses:
- GESpecies
public class IntegerVectorSpecies extends VectorSpecies
IntegerVectorSpecies is a subclass of VectorSpecies with special constraints for integral vectors, namely ByteVectorIndividual, ShortVectorIndividual, IntegerVectorIndividual, and LongVectorIndividual.IntegerVectorSpecies can specify a number of parameters globally, per-segment, and per-gene. See VectorSpecies for information on how to this works.
IntegerVectorSpecies defines a minimum and maximum gene value. These values are used during initialization and, depending on whether mutation-bounded is true, also during various mutation algorithms to guarantee that the gene value will not exceed these minimum and maximum bounds.
IntegerVectorSpecies provides support for two ways of mutating a gene.
- reset Replacing the gene's value with a value uniformly drawn from the gene's range (the default behavior).
- random-walkReplacing the gene's value by performing a random walk starting at the gene value. The random walk either adds 1 or subtracts 1 (chosen at random), then does a coin-flip to see whether to continue the random walk. When the coin-flip finally comes up false, the gene value is set to the current random walk position.
IntegerVectorSpecies performs gene initialization by resetting the gene.
Parameters
base.min-gene or
base.segment.segment-number.min-gene or
base.min-gene.gene-number
long (default=0)(the minimum gene value) base.max-gene or
base.segment.segment-number.max-gene or
base.max-gene.gene-number
long >= base.min-gene(the maximum gene value) base.mutation-type or
base.segment.segment-number.mutation-type or
base.mutation-prob.gene-number
reset or random-walk (default=reset)(the mutation type) base.random-walk-probability or
base.segment.segment-number.random-walk-probability or
base.random-walk-probability.gene-number
0.0 <= double <= 1.0(the probability that a random walk will continue. Random walks go up or down by 1.0 until the coin flip comes up false.) base.mutation-bounded or
base.segment.segment-number.mutation-bounded or
base.mutation-bounded.gene-number
boolean (default=true)(whether mutation is restricted to only being within the min/max gene values. Does not apply to SimulatedBinaryCrossover (which is always bounded)) - See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intC_RANDOM_WALK_MUTATIONstatic intC_RESET_MUTATIONstatic java.lang.StringP_MAXGENEstatic java.lang.StringP_MINGENEstatic java.lang.StringP_MUTATION_BOUNDEDstatic java.lang.StringP_MUTATIONTYPEstatic java.lang.StringP_NUM_SEGMENTSstatic java.lang.StringP_RANDOM_WALK_PROBABILITYstatic java.lang.StringP_SEGMENTstatic java.lang.StringP_SEGMENT_ENDstatic java.lang.StringP_SEGMENT_STARTstatic java.lang.StringP_SEGMENT_TYPEstatic java.lang.StringV_RANDOM_WALK_MUTATIONstatic java.lang.StringV_RESET_MUTATION-
Fields inherited from class ec.vector.VectorSpecies
C_ANY_POINT, C_GEOMETRIC, C_INTERMED_RECOMB, C_LINE_RECOMB, C_NONE, C_ONE_POINT, C_ONE_POINT_NO_NOP, C_SIMULATED_BINARY, C_TWO_POINT, C_TWO_POINT_NO_NOP, C_UNIFORM, chunksize, crossoverDistributionIndex, crossoverProbability, crossoverType, dynamicInitialSize, genomeIncreaseProbability, genomeResizeAlgorithm, genomeSize, lineDistance, maxInitialSize, minInitialSize, P_CHUNKSIZE, P_CROSSOVER_DISTRIBUTION_INDEX, P_CROSSOVERPROB, P_CROSSOVERTYPE, P_DUPLICATE_RETRIES, P_GENOMESIZE, P_GEOMETRIC_PROBABILITY, P_LINEDISTANCE, P_MUTATIONPROB, P_UNIFORM_MAX, P_UNIFORM_MIN, P_VECTORSPECIES, V_ANY_POINT, V_GEOMETRIC, V_INTERMED_RECOMB, V_LINE_RECOMB, V_ONE_POINT, V_ONE_POINT_NO_NOP, V_SIMULATED_BINARY, V_TWO_POINT, V_TWO_POINT_NO_NOP, V_UNIFORM
-
Fields inherited from class ec.Species
f_prototype, i_prototype, P_FITNESS, P_INDIVIDUAL, P_PIPE, pipe_prototype
-
-
Constructor Summary
Constructors Constructor and Description IntegerVectorSpecies()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleaninNumericalTypeRange(double geneVal)booleaninNumericalTypeRange(long geneVal)longmaxGene(int gene)longminGene(int gene)booleanmutationIsBounded(int gene)intmutationType(int gene)doublerandomWalkProbability(int gene)voidsetup(EvolutionState state, Parameter base)The default version of setup(...) loads requested pipelines and calls setup(...) on them and normalizes their probabilities.-
Methods inherited from class ec.vector.VectorSpecies
defaultBase, duplicateRetries, mutationProbability, newIndividual
-
Methods inherited from class ec.Species
clone, newIndividual, newIndividual
-
-
-
-
Field Detail
-
P_MINGENE
public static final java.lang.String P_MINGENE
- See Also:
- Constant Field Values
-
P_MAXGENE
public static final java.lang.String P_MAXGENE
- See Also:
- Constant Field Values
-
P_NUM_SEGMENTS
public static final java.lang.String P_NUM_SEGMENTS
- See Also:
- Constant Field Values
-
P_SEGMENT_TYPE
public static final java.lang.String P_SEGMENT_TYPE
- See Also:
- Constant Field Values
-
P_SEGMENT_START
public static final java.lang.String P_SEGMENT_START
- See Also:
- Constant Field Values
-
P_SEGMENT_END
public static final java.lang.String P_SEGMENT_END
- See Also:
- Constant Field Values
-
P_SEGMENT
public static final java.lang.String P_SEGMENT
- See Also:
- Constant Field Values
-
P_MUTATIONTYPE
public static final java.lang.String P_MUTATIONTYPE
- See Also:
- Constant Field Values
-
P_RANDOM_WALK_PROBABILITY
public static final java.lang.String P_RANDOM_WALK_PROBABILITY
- See Also:
- Constant Field Values
-
P_MUTATION_BOUNDED
public static final java.lang.String P_MUTATION_BOUNDED
- See Also:
- Constant Field Values
-
V_RESET_MUTATION
public static final java.lang.String V_RESET_MUTATION
- See Also:
- Constant Field Values
-
V_RANDOM_WALK_MUTATION
public static final java.lang.String V_RANDOM_WALK_MUTATION
- See Also:
- Constant Field Values
-
C_RESET_MUTATION
public static final int C_RESET_MUTATION
- See Also:
- Constant Field Values
-
C_RANDOM_WALK_MUTATION
public static final int C_RANDOM_WALK_MUTATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
maxGene
public long maxGene(int gene)
-
minGene
public long minGene(int gene)
-
mutationType
public int mutationType(int gene)
-
randomWalkProbability
public double randomWalkProbability(int gene)
-
mutationIsBounded
public boolean mutationIsBounded(int gene)
-
inNumericalTypeRange
public boolean inNumericalTypeRange(double geneVal)
-
inNumericalTypeRange
public boolean inNumericalTypeRange(long geneVal)
-
setup
public void setup(EvolutionState state, Parameter base)
Description copied from class:SpeciesThe default version of setup(...) loads requested pipelines and calls setup(...) on them and normalizes their probabilities. If your individual prototype might need to know special things about the species (like parameters stored in it), then when you override this setup method, you'll need to set those parameters BEFORE you call super.setup(...), because the setup(...) code in Species sets up the prototype.- Specified by:
setupin interfacePrototype- Specified by:
setupin interfaceSetup- Overrides:
setupin classVectorSpecies- See Also:
Prototype.setup(EvolutionState,Parameter)
-
-
DMelt 3.0 © DataMelt by jWork.ORG