ec.vector
Class IntegerVectorSpecies

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

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 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

Parameters

base.n.min-gene
long (default=0)
(the minimum gene value)
base.n.max-gene
long >= base.n.min-gene
(the maximum gene value)
base.n.min-gene.i
long (default=base.n.min-gene)
(the minimum gene value for gene i)
base.n.max-gene.i
long >= base.n.min-gene.i (default=base.n.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)

Version:
1.0
Author:
Sean Luke, Rafal Kicinger
See Also:
Serialized Form

Field Summary
 long maxGene
           
 long[] maxGenes
          Set to null if not specified
 long minGene
           
 long[] minGenes
          Set to null if not specified
static java.lang.String P_MAXGENE
           
static java.lang.String P_MINGENE
           
static java.lang.String P_NUM_SEGMENTS
           
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
           
 
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
IntegerVectorSpecies()
           
 
Method Summary
 boolean individualGeneMinMaxUsed()
           
protected  void initializeGenomeSegment(EvolutionState state, Parameter base, Parameter def, int numSegments)
           
 boolean inNumericalTypeRange(long geneVal)
           
 long maxGene(int gene)
           
 long minGene(int gene)
           
 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_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 long minGene

maxGene

public long maxGene

minGenes

public long[] minGenes
Set to null if not specified


maxGenes

public long[] maxGenes
Set to null if not specified

Constructor Detail

IntegerVectorSpecies

public IntegerVectorSpecies()
Method Detail

individualGeneMinMaxUsed

public final boolean individualGeneMinMaxUsed()

maxGene

public final long maxGene(int gene)

minGene

public final long minGene(int gene)

inNumericalTypeRange

public boolean inNumericalTypeRange(long 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)

initializeGenomeSegment

protected void initializeGenomeSegment(EvolutionState state,
                                       Parameter base,
                                       Parameter def,
                                       int numSegments)
Parameters:
state -
base -
def -
numSegments -