ec.vector
Class FloatVectorSpecies

java.lang.Object
  extended by ec.Species
      extended by ec.vector.VectorSpecies
          extended by ec.vector.FloatVectorSpecies
All Implemented Interfaces:
Prototype, Setup, java.io.Serializable, java.lang.Cloneable

public class FloatVectorSpecies
extends VectorSpecies

FloatVectorSpecies is a subclass of VectorSpecies with special constraints for floating-point vectors, namely FloatVectorIndividual and DoubleVectorIndividual.

FloatVectorSpecies can specify min/max numeric constraints on gene values in three different ways.

  1. You may provide a default min and max value. This is done by specifying:

    base.n.min-gene
    base.n.max-gene

    Note: you must provide these values even if you don't use them, as they're used as defaults by #2 and #3 below.

  2. You may provide min and max values for genes in segments (regions) along the genome. If not all genes are specified in this way, the default (#1) min and max value is used, and you receive a warning. ECJ will check and use this method before it checks and uses #3 below. This is done by specifying:

    base.num-segments The segments may be defined by either start or end indices of genes. This is controlled by specifying the value of:

    base.segment-type which can assume the value of start or end, with start being the default. The indices are defined using Java array style, i.e. the first gene has the index of 0, and the last gene has the index of genome-size - 1.

    Using this method, each segment is specified byj...

    base.segment.j.start
    base.segment.j.min-gene
    base.segment.j.max-gene if segment-type value was chosen as start or by:

    base.segment.j.end
    base.segment.j.min-gene
    base.segment.j.max-gene if segment-type value is equal to end.

  3. You may provide min and max values for each separate gene. If not all genes are specified in this way, the default (#1) min and max value is used, and you receive a warning. This is done by specifying (for each gene location i you wish to specify)

    base.n.min-gene.i
    base.n.max-gene.i

FloatVectorSpecies provides support for two ways of mutating a gene:

Parameters

base.min-gene
double (default=0.0)
(the minimum gene value)
base.max-gene
double >= base.min-gene
(the maximum gene value)
base.min-gene.i
double (default=base.min-gene)
(the minimum gene value for gene i)
base.max-gene.i
double >= base.min-gene.i (default=base.max-gene)
(the maximum gene value for gene i)
base..num-segments
int >= 1 (default=no segments used)
(the number of gene segments defined)
base..segment-type
int >= 1 (default=start)
(defines the way in which segments are defined: either by providing start indices (segment-type=start) or by providing end indices (segment-type=end)
base..segment.j.start
0 <= int < genome length
(the start index of gene segment j -- the end of a segment is before the start of the next segment) (used when the value of segment-type parameter is equal to start)
base..segment.j.end
0 <= int < genome length
(the end of gene segment j -- the start of a segment is after the end of the previous segment) (used when the value of segment-type parameter is equal to end)
base..segment.j.min-gene
double (default=0.0)
(the minimum gene value for segment j)
base..segment.j.max-gene
double >= base..segment.j.min-gene
(the maximum gene value for segment j)
base.mutation-type
reset or gauss (default=reset)
(the mutation type)
base.mutation-stdev
double ≥ 0
(the standard deviation or the gauss perturbation)
base.out-of-bounds-retries
int ≥ 0 (default=100)
(number of times the gaussian mutation got the gene out of range before we give up and reset the gene's value; 0 means "never give up")

Version:
2.0
Author:
Sean Luke, Gabriel Balan, Rafal Kicinger
See Also:
Serialized Form

Field Summary
static int C_GAUSS_MUTATION
           
static int C_RESET_MUTATION
           
 double gaussMutationStdev
           
 double[] gaussMutationStdevs
          Set to null if not specified If individualGeneMinMaxUsed, that this is used too.
 double maxGene
           
 double[] maxGenes
          Set to null if not specified
 double minGene
           
 double[] minGenes
          Set to null if not specified
 int mutationType
          What kind of mutation do we have?
 int outOfRangeRetries
           
static java.lang.String P_MAXGENE
           
static java.lang.String P_MINGENE
           
static java.lang.String P_MUTATIONTYPE
           
static java.lang.String P_NUM_SEGMENTS
           
static java.lang.String P_OUTOFBOUNDS_RETRIES
           
static java.lang.String P_SEGMENT
           
static java.lang.String P_SEGMENT_END
           
static java.lang.String P_SEGMENT_START
           
static java.lang.String P_SEGMENT_TYPE
           
static java.lang.String P_STDEV
           
static java.lang.String V_GAUSS_MUTATION
           
static java.lang.String V_RESET_MUTATION
           
 
Fields inherited from class ec.vector.VectorSpecies
C_ANY_POINT, C_ONE_POINT, C_TWO_POINT, chunksize, crossoverProbability, crossoverType, genomeSize, mutationProbability, P_CHUNKSIZE, P_CROSSOVERPROB, P_CROSSOVERTYPE, P_GENOMESIZE, P_MUTATIONPROB, P_VECTORSPECIES, V_ANY_POINT, V_ONE_POINT, V_TWO_POINT
 
Fields inherited from class ec.Species
f_prototype, i_prototype, P_FITNESS, P_INDIVIDUAL, P_PIPE, pipe_prototype
 
Constructor Summary
FloatVectorSpecies()
           
 
Method Summary
 double gaussMutationStdev(int gene)
           
 boolean individualGeneMinMaxUsed()
           
 boolean inNumericalTypeRange(double geneVal)
           
 double maxGene(int gene)
           
 double minGene(int gene)
           
 void outOfRangeRetryLimitReached(EvolutionState state)
           
 void setup(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, newIndividual
 
Methods inherited from class ec.Species
clone, newIndividual, newIndividual
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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_MUTATIONTYPE

public static final java.lang.String P_MUTATIONTYPE
See Also:
Constant Field Values

P_STDEV

public static java.lang.String P_STDEV

V_RESET_MUTATION

public static final java.lang.String V_RESET_MUTATION
See Also:
Constant Field Values

V_GAUSS_MUTATION

public static final java.lang.String V_GAUSS_MUTATION
See Also:
Constant Field Values

C_RESET_MUTATION

public static final int C_RESET_MUTATION
See Also:
Constant Field Values

C_GAUSS_MUTATION

public static final int C_GAUSS_MUTATION
See Also:
Constant Field Values

P_OUTOFBOUNDS_RETRIES

public static final java.lang.String P_OUTOFBOUNDS_RETRIES
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

minGene

public double minGene

maxGene

public double maxGene

minGenes

public double[] minGenes
Set to null if not specified


maxGenes

public double[] maxGenes
Set to null if not specified


mutationType

public int mutationType
What kind of mutation do we have?


gaussMutationStdev

public double gaussMutationStdev

gaussMutationStdevs

public double[] gaussMutationStdevs
Set to null if not specified If individualGeneMinMaxUsed, that this is used too.


outOfRangeRetries

public int outOfRangeRetries
Constructor Detail

FloatVectorSpecies

public FloatVectorSpecies()
Method Detail

outOfRangeRetryLimitReached

public void outOfRangeRetryLimitReached(EvolutionState state)

individualGeneMinMaxUsed

public final boolean individualGeneMinMaxUsed()

maxGene

public final double maxGene(int gene)

minGene

public final double minGene(int gene)

gaussMutationStdev

public final double gaussMutationStdev(int gene)

inNumericalTypeRange

public boolean inNumericalTypeRange(double geneVal)

setup

public void setup(EvolutionState state,
                  Parameter base)
Description copied from class: Species
The 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:
setup in interface Prototype
Specified by:
setup in interface Setup
Overrides:
setup in class VectorSpecies
See Also:
Prototype.setup(EvolutionState,Parameter)