Package ec.multiobjective.spea2

# Class SPEA2Breeder

java.lang.Object
ec.Breeder
ec.simple.SimpleBreeder
ec.multiobjective.spea2.SPEA2Breeder

All Implemented Interfaces:
  `Setup`, `Singleton`, `Serializable`

public class SPEA2Breeder extends SimpleBreeder
This subclass of SimpleBreeder overrides the loadElites method to build an archive in the top elites[subpopnum] of each subpopulation. It computes the sparsity metric, then constructs the archive.

See Also:
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `SPEA2Breeder.BreedingState`
  We use a state variable to make sure that the archive isn't built twice in a row.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `P_K`
  `static final String`
  `P_NORMALIZE`

  ### Fields inherited from class ec.simple.SimpleBreeder

  `backupPopulation, clonePipelineAndPopulation, elite, eliteFrac, newIndividuals, P_CLONE_PIPELINE_AND_POPULATION, P_ELITE, P_ELITE_FRAC, P_REEVALUATE_ELITES, P_SEQUENTIAL_BREEDING, pool, reevaluateElites`

  ### Fields inherited from class ec.Breeder

  `sequentialBreeding`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SPEA2Breeder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Population`
  `breedPopulation(EvolutionState state)`
  Use super's breeding, but also set our local state to record that breeding is complete.
  `double[]`
  `calculateDistancesFromIndividual(Individual ind, ArrayList<Individual> inds)`
  `protected void`
  `loadElites(EvolutionState state, Population newpop)`
  Extract the elite individuals from the current population and both place in newpop and replace the current population with the archive.
  `int`
  `numElites(EvolutionState state, int subpopulation)`
  Return the number of individuals that we aim to see in the elitist archive.
  `void`
  `postProcess(EvolutionState state)`
  A hook to do final modifications as necessary to the population after breeding has concluded.
  `void`
  `setup(EvolutionState state, Parameter base)`
  Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.

  ### Methods inherited from class ec.simple.SimpleBreeder

  `breedPopChunk, breedPopChunkProduce, nextSubpopulationSize, shouldBreedSubpop, unmarkElitesEvaluated, usingElitism`

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

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

- ## Field Details

  - ### P_K

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

  - ### P_NORMALIZE

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

- ## Constructor Details

  - ### SPEA2Breeder

    public SPEA2Breeder()

- ## Method Details

  - ### setup

    public void setup(EvolutionState state, Parameter base)
    Description copied from interface: `Setup`
    Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.
    Specified by:
      `setup` in interface `Setup`
    Overrides:
      `setup` in class `SimpleBreeder`

  - ### breedPopulation

    public Population breedPopulation(EvolutionState state)
    Use super's breeding, but also set our local state to record that breeding is complete.
    Overrides:
      `breedPopulation` in class `SimpleBreeder`

  - ### numElites

    public int numElites(EvolutionState state, int subpopulation)
    Return the number of individuals that we aim to see in the elitist archive. This can only be called after loadArchive() and before breedPopulation().
    Overrides:
      `numElites` in class `SimpleBreeder`

  - ### loadElites

    protected void loadElites(EvolutionState state, Population newpop)
    Extract the elite individuals from the current population and both place in newpop and replace the current population with the archive. We place the elites straight into the current population because breeding is the next thing that happens right after loadElites() is called, and SPEA breeds children from the elitist archive.
    Overrides:
      `loadElites` in class `SimpleBreeder`

  - ### postProcess

    public void postProcess(EvolutionState state)
    Description copied from class: `SimpleBreeder`
    A hook to do final modifications as necessary to the population after breeding has concluded. By default this does nothing, but multiobjective breeders, which temporarily replace the old population while it's being breeded, may use this to put the popuplation back again just in case statistics needs it.
    Overrides:
      `postProcess` in class `SimpleBreeder`

  - ### calculateDistancesFromIndividual

    public double[] calculateDistancesFromIndividual(Individual ind, ArrayList<Individual> inds)