Package ec.eda.amalgam

# Class AMALGAMSpecies

java.lang.Object
ec.Species
ec.vector.VectorSpecies
ec.vector.FloatVectorSpecies
ec.eda.amalgam.AMALGAMSpecies

All Implemented Interfaces:
  `Prototype`, `Setup`, `Serializable`, `Cloneable`

public class AMALGAMSpecies extends FloatVectorSpecies
AMALGAMSpecies is a FloatVectorSpecies which implements a faithful version of the iAMaLGaM IDEA algorithm. The class has two basic methods. The newIndividual(...) method generates a new random individual underneath the current AMALGAM distribution. The updateDistribution(...) method revises the distribution to reflect the fitness results of the population. In many respects this approach is similar to how it's done in CMA-ES [and in fact you'll find that these comments are similar to the CMA-ES comments].

AMALGAMSpecies must be used in combination with AMALGAMBreeder, which will call it at appropriate times to revise the distribution and to generate a new subpopulation of individuals. Unlike CMA-ES, AMALGAM does not require its own special initializer (we use SimpleInitializer).

AMALAGAMSpecies has nine numeric parameters that you can set; five of them have standard default constant values, and four have values which, if you don't specify them, are updated every step via excessively complex equations.

AMALGAMSpecies also has an "alternative termination" option, by default turned off. Normally ECJ terminates when the optimal individual is discovered or when the generations or maximum number of evaluations has been exceeded. AMALGAM will also terminate when the "distribution multiplier" is lower than 10^(-10), or when the distribution variance is less than the fitness variance tolerance.

AMALGAMSpecies relies on the EJML matrix library, available at http://ejml.org/

Parameters

base.`tau` 0 <= Floating-point value <= 1 | (proportion of elite individuals) If not provided, defaults to 0.35
base.`variance-tolerance` 0 <= Floating-point value | (termination condition: if the variance is less than this amount) If not provided, defaults to 0.0
base.`nis-max` 0 <= Floating-point value | (number of generations with no improvement beyond which the distribution multiplier begins to decrease) If not provided, defaults to 25 + genome size
base.`alpha-ams` 0 < Floating-point value | (the proportion of individuals to be shifted in the direction of the anticipated mean shift) If not provided, defaults to 0.5 * tau * subpopulation size / (subpopulation size - 1)
base.`delta-ams` 0 < Floating-point value | (controls how much selected individuals are shifted) If not provided, defaults to 2.0
base.`eta-shift` 0 <= Floating-point value <= 1 | (learning rate of the anticipated mean shift) If not provided, defaults to 1.0 - (e ^ (-1.2 * (floor(tau * subpopulation size))^0.31) / (genome size ^ 0.5))
base.`eta-sigma` 0 <= Floating-point value <= 1 | (learning rate of the covariance matrix) If not provided, defaults to 1.0 - e ^ (-1.1 * (floor(tau * subpopulation size)^1.20) / (genome size ^ 1.6))
base.`eta-dec` 0 <= Floating-point value <= 1 | (degree to which the distribution multipler is decreased in certain conditions) If not provided, defaults to 0.9
base.`theta-sdr` 0 <= Floating-point value | (threshold for the standard deviation ratio) If not provided, defaults to 1.0
base.`alternative-termination` boolean, default false | Should we also terminate on AMALGAM's additional termination conditions?.

Default Base
eda.amalgam.species

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `org.ejml.data.DenseMatrix64F`
  `aggCovarMatrix`
  `double`
  `alphaAMS`
  `org.ejml.data.DenseMatrix64F`
  `choleskyLower`
  `IdentityHashMap<Individual,Integer>`
  `constraintViolations`
  `org.ejml.data.DenseMatrix64F`
  `covarMatrix`
  `double`
  `deltaAMS`
  `double`
  `distributionMultiplier`
  `double`
  `distributionMultiplierDecrease`
  `double`
  `distributionMultiplierIncrease`
  `double`
  `etaP`
  `double`
  `etaS`
  `boolean`
  `firstGeneration`
  `double`
  `fitnessVarianceTolerance`
  `org.ejml.data.DenseMatrix64F`
  `genCovarMatrix`
  `int`
  `maximumNoImprovementStretch`
  `org.ejml.data.DenseMatrix64F`
  `mean`
  The mean of the distribution.
  `org.ejml.data.DenseMatrix64F`
  `meanShift`
  `int`
  `noImprovementStretch`
  `static final String`
  `P_ALPHA_AMS`
  `static final String`
  `P_ALTERNATIVE_TERMINATION`
  `static final String`
  `P_AMALGAM_SPECIES`
  `static final String`
  `P_DELTA_AMS`
  `static final String`
  `P_ETA_DEC`
  `static final String`
  `P_ETA_SHIFT`
  `static final String`
  `P_ETA_SIGMA`
  `static final String`
  `P_NIS_MAX`
  `static final int`
  `P_PARAMETER_MISSING`
  `static final String`
  `P_TAU`
  `static final String`
  `P_THETA_SDR`
  `static final String`
  `P_VARIANCE_TOLERANCE`
  `org.ejml.data.DenseMatrix64F`
  `prevMean`
  `double`
  `stDevRatioThresh`
  `double`
  `tau`
  `org.ejml.data.DenseMatrix64F`
  `temp`
  `org.ejml.data.DenseMatrix64F`
  `temp2`
  `org.ejml.data.DenseMatrix64F`
  `temp3`
  `org.ejml.data.DenseMatrix64F`
  `tempMatrix`
  `boolean`
  `useAltTermination`
  `double`
  `userAlphaAMS`
  `double`
  `userEtaP`
  `double`
  `userEtaS`
  `org.ejml.data.DenseMatrix64F`
  `xAvgImp`

  ### Fields inherited from class ec.vector.FloatVectorSpecies

  `C_GAUSS_MUTATION, C_INTEGER_RANDOM_WALK_MUTATION, C_INTEGER_RESET_MUTATION, C_POLYNOMIAL_MUTATION, C_RESET_MUTATION, DEFAULT_OUT_OF_BOUNDS_RETRIES, gaussMutationStdev, maxGene, minGene, mutationDistributionIndex, mutationIsBounded, mutationType, outOfBoundsRetries, P_MAXGENE, P_MINGENE, P_MUTATION_BOUNDED, P_MUTATION_DISTRIBUTION_INDEX, P_MUTATIONTYPE, P_OUTOFBOUNDS_RETRIES, P_POLYNOMIAL_ALTERNATIVE, P_RANDOM_WALK_PROBABILITY, P_STDEV, polynomialIsAlternative, randomWalkProbability, V_GAUSS_MUTATION, V_INTEGER_RANDOM_WALK_MUTATION, V_INTEGER_RESET_MUTATION, V_POLYNOMIAL_MUTATION, V_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, duplicateRetries, dynamicInitialSize, genomeIncreaseProbability, genomeResizeAlgorithm, genomeSize, lineDistance, maxInitialSize, minInitialSize, mutationProbability, P_CHUNKSIZE, P_CROSSOVER_DISTRIBUTION_INDEX, P_CROSSOVERPROB, P_CROSSOVERTYPE, P_DUPLICATE_RETRIES, P_GENOMESIZE, P_GEOMETRIC_PROBABILITY, P_LINEDISTANCE, P_MUTATIONPROB, P_NUM_SEGMENTS, P_SEGMENT, P_SEGMENT_END, P_SEGMENT_START, P_SEGMENT_TYPE, 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
  Description
  `AMALGAMSpecies()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `adaptDistributionMultiplier(EvolutionState state, Subpopulation subpop)`
  `boolean`
  `checkTerminationConditions(EvolutionState state, Subpopulation subpop)`
  `Object`
  `clone()`
  Creates a new individual cloned from a prototype, and suitable to begin use in its own evolutionary context.
  `int`
  `compareIndividuals(Individual a, Individual b)`
  `void`
  `computeAMS(EvolutionState state, Subpopulation subpop)`
  `void`
  `computeConstraintViolations(EvolutionState state, Subpopulation subpop)`
  `void`
  `computeCovariance(EvolutionState state, Subpopulation subpop)`
  `void`
  `computeMean(EvolutionState state, Subpopulation subpop)`
  `Parameter`
  `defaultBase()`
  Returns the default base for this prototype.
  `boolean`
  `isValid(DoubleVectorIndividual dvind)`
  `Individual`
  `newIndividual(EvolutionState state, int thread)`
  Provides a brand-new individual to fill in a population.
  `void`
  `selectForDiversity(EvolutionState state, Subpopulation subpop)`
  `void`
  `setup(EvolutionState state, Parameter base)`
  The default version of setup(...) loads requested pipelines and calls setup(...) on them and normalizes their probabilities.
  `void`
  `shiftIndividual(EvolutionState state, DoubleVectorIndividual ind)`
  `void`
  `updateDistribution(EvolutionState state, Subpopulation subpop)`

  ### Methods inherited from class ec.vector.FloatVectorSpecies

  `gaussMutationStdev, inNumericalTypeRange, loadParametersForGene, maxGene, minGene, mutationDistributionIndex, mutationIsBounded, mutationType, outOfRangeRetryLimitReached, polynomialIsAlternative, randomWalkProbability`

  ### Methods inherited from class ec.vector.VectorSpecies

  `contains, contains, contains, contains, duplicateRetries, fill, fill, fill, fill, initializeGenomeSegmentsByEndIndices, initializeGenomeSegmentsByStartIndices, mutationProbability, setupGenome`

  ### Methods inherited from class ec.Species

  `buildMisc, newIndividual, newIndividual, updateIndividual, updateSubpopulation`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### P_AMALGAM_SPECIES

    public static final String P_AMALGAM_SPECIES
    See Also:
      - Constant Field Values

  - ### P_TAU

    public static final String P_TAU
    See Also:
      - Constant Field Values

  - ### P_ETA_DEC

    public static final String P_ETA_DEC
    See Also:
      - Constant Field Values

  - ### P_THETA_SDR

    public static final String P_THETA_SDR
    See Also:
      - Constant Field Values

  - ### P_ETA_SHIFT

    public static final String P_ETA_SHIFT
    See Also:
      - Constant Field Values

  - ### P_ETA_SIGMA

    public static final String P_ETA_SIGMA
    See Also:
      - Constant Field Values

  - ### P_NIS_MAX

    public static final String P_NIS_MAX
    See Also:
      - Constant Field Values

  - ### P_VARIANCE_TOLERANCE

    public static final String P_VARIANCE_TOLERANCE
    See Also:
      - Constant Field Values

  - ### P_DELTA_AMS

    public static final String P_DELTA_AMS
    See Also:
      - Constant Field Values

  - ### P_ALPHA_AMS

    public static final String P_ALPHA_AMS
    See Also:
      - Constant Field Values

  - ### P_ALTERNATIVE_TERMINATION

    public static final String P_ALTERNATIVE_TERMINATION
    See Also:
      - Constant Field Values

  - ### P_PARAMETER_MISSING

    public static final int P_PARAMETER_MISSING
    See Also:
      - Constant Field Values

  - ### useAltTermination

    public boolean useAltTermination

  - ### tau

    public double tau

  - ### fitnessVarianceTolerance

    public double fitnessVarianceTolerance

  - ### maximumNoImprovementStretch

    public int maximumNoImprovementStretch

  - ### noImprovementStretch

    public int noImprovementStretch

  - ### alphaAMS

    public double alphaAMS

  - ### userAlphaAMS

    public double userAlphaAMS

  - ### deltaAMS

    public double deltaAMS

  - ### etaP

    public double etaP

  - ### userEtaP

    public double userEtaP

  - ### etaS

    public double etaS

  - ### userEtaS

    public double userEtaS

  - ### distributionMultiplierDecrease

    public double distributionMultiplierDecrease

  - ### distributionMultiplierIncrease

    public double distributionMultiplierIncrease

  - ### distributionMultiplier

    public double distributionMultiplier

  - ### stDevRatioThresh

    public double stDevRatioThresh

  - ### mean

    public org.ejml.data.DenseMatrix64F mean
    The mean of the distribution.

  - ### prevMean

    public org.ejml.data.DenseMatrix64F prevMean

  - ### xAvgImp

    public org.ejml.data.DenseMatrix64F xAvgImp

  - ### meanShift

    public org.ejml.data.DenseMatrix64F meanShift

  - ### genCovarMatrix

    public org.ejml.data.DenseMatrix64F genCovarMatrix

  - ### aggCovarMatrix

    public org.ejml.data.DenseMatrix64F aggCovarMatrix

  - ### covarMatrix

    public org.ejml.data.DenseMatrix64F covarMatrix

  - ### choleskyLower

    public org.ejml.data.DenseMatrix64F choleskyLower

  - ### temp

    public org.ejml.data.DenseMatrix64F temp

  - ### temp2

    public org.ejml.data.DenseMatrix64F temp2

  - ### temp3

    public org.ejml.data.DenseMatrix64F temp3

  - ### tempMatrix

    public org.ejml.data.DenseMatrix64F tempMatrix

  - ### constraintViolations

    public IdentityHashMap<Individual,Integer> constraintViolations

  - ### firstGeneration

    public boolean firstGeneration

- ## Constructor Details

  - ### AMALGAMSpecies

    public AMALGAMSpecies()

- ## Method Details

  - ### defaultBase

    public Parameter defaultBase()
    Description copied from interface: `Prototype`
    Returns the default base for this prototype. This should generally be implemented by building off of the static base() method on the DefaultsForm object for the prototype's package. This should be callable during setup(...).
    Specified by:
      `defaultBase` in interface `Prototype`
    Overrides:
      `defaultBase` in class `VectorSpecies`

  - ### 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 `FloatVectorSpecies`
    See Also:
      - `Prototype.setup(EvolutionState,Parameter)`

  - ### clone

    public Object clone()
    Description copied from interface: `Prototype`
    Creates a new individual cloned from a prototype, and suitable to begin use in its own evolutionary context.

    Typically this should be a full "deep" clone. However, you may share certain elements with other objects rather than clone hem, depending on the situation:

    - If you hold objects which are shared with other instances, don't clone them.
    - If you hold objects which must be unique, clone them.
    - If you hold objects which were given to you as a gesture of kindness, and aren't owned by you, you probably shouldn't clone them.
    - DON'T attempt to clone: Singletons, Cliques, or Populations, or Subpopulation.
    - Arrays are not cloned automatically; you may need to clone an array if you're not sharing it with other instances. Arrays have the nice feature of being copyable by calling clone() on them.

    Implementations.

    - If no ancestor of yours implements clone(), and you have no need to do clone deeply, and you are abstract, then you should not declare clone().
    - If no ancestor of yours implements clone(), and you have no need to do clone deeply, and you are not abstract, then you should implement it as follows:

      ``

           public Object clone()
               {
               try
                   {
                   return super.clone();
                   }
               catch ((CloneNotSupportedException e)
                   { throw new InternalError(); } // never happens
               }

    - If no ancestor of yours implements clone(), but you need to deep-clone some things, then you should implement it as follows:

      ``

           public Object clone()
               {
               try
                   {
                   MyObject myobj = (MyObject) (super.clone());

                   // put your deep-cloning code here...
                   }
               catch ((CloneNotSupportedException e)
                   { throw new InternalError(); } // never happens
               return myobj;
               }

    - If an ancestor has implemented clone(), and you also need to deep clone some things, then you should implement it as follows:

      ``

           public Object clone()
               {
               MyObject myobj = (MyObject) (super.clone());

               // put your deep-cloning code here...

               return myobj;
               }

    Specified by:
      `clone` in interface `Prototype`
    Overrides:
      `clone` in class `Species`

  - ### computeConstraintViolations

    public void computeConstraintViolations(EvolutionState state, Subpopulation subpop)

  - ### compareIndividuals

    public int compareIndividuals(Individual a, Individual b)

  - ### isValid

    public boolean isValid(DoubleVectorIndividual dvind)

  - ### newIndividual

    public Individual newIndividual(EvolutionState state, int thread)
    Description copied from class: `Species`
    Provides a brand-new individual to fill in a population. The default form simply calls clone(), creates a fitness, sets evaluated to false, and sets the species. If you need to make a more custom genotype (as is the case for GPSpecies, which requires a light rather than deep clone), you will need to override this method as you see fit.
    Overrides:
      `newIndividual` in class `VectorSpecies`

  - ### adaptDistributionMultiplier

    public void adaptDistributionMultiplier(EvolutionState state, Subpopulation subpop)

  - ### selectForDiversity

    public void selectForDiversity(EvolutionState state, Subpopulation subpop)

  - ### computeMean

    public void computeMean(EvolutionState state, Subpopulation subpop)

  - ### computeCovariance

    public void computeCovariance(EvolutionState state, Subpopulation subpop)

  - ### computeAMS

    public void computeAMS(EvolutionState state, Subpopulation subpop)

  - ### updateDistribution

    public void updateDistribution(EvolutionState state, Subpopulation subpop)

  - ### checkTerminationConditions

    public boolean checkTerminationConditions(EvolutionState state, Subpopulation subpop)

  - ### shiftIndividual

    public void shiftIndividual(EvolutionState state, DoubleVectorIndividual ind)