Class 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:
  • Field Details

    • P_AMALGAM_SPECIES

      public static final String P_AMALGAM_SPECIES
      See Also:
    • P_TAU

      public static final String P_TAU
      See Also:
    • P_ETA_DEC

      public static final String P_ETA_DEC
      See Also:
    • P_THETA_SDR

      public static final String P_THETA_SDR
      See Also:
    • P_ETA_SHIFT

      public static final String P_ETA_SHIFT
      See Also:
    • P_ETA_SIGMA

      public static final String P_ETA_SIGMA
      See Also:
    • P_NIS_MAX

      public static final String P_NIS_MAX
      See Also:
    • P_VARIANCE_TOLERANCE

      public static final String P_VARIANCE_TOLERANCE
      See Also:
    • P_DELTA_AMS

      public static final String P_DELTA_AMS
      See Also:
    • P_ALPHA_AMS

      public static final String P_ALPHA_AMS
      See Also:
    • P_ALTERNATIVE_TERMINATION

      public static final String P_ALTERNATIVE_TERMINATION
      See Also:
    • P_PARAMETER_MISSING

      public static final int P_PARAMETER_MISSING
      See Also:
    • 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:
    • 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)