Package ec.multiobjective.nsga2

# Class NSGA2Breeder

java.lang.Object
ec.Breeder
ec.simple.SimpleBreeder
ec.multiobjective.nsga2.NSGA2Breeder

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

public class NSGA2Breeder extends SimpleBreeder
This SimpleBreeder subclass breeds a set of children from the Population, then joins the original Population with the children in a (mu+mu) fashion. An NSGA2Breeder may have multiple threads for breeding.

NSGA-II has fixed archive size (the population size), and so ignores the 'elites' declaration. However it will adhere to the 'reevaluate-elites' parameter in SimpleBreeder to determine whether to force fitness reevaluation.

See Also:
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `NSGA2Breeder.BreedingState`
  We use a state variable to make sure that the nextSubpopulationSize() method is only called at the appropriate time.

- ## Field Summary

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

  `backupPopulation, clonePipelineAndPopulation, elite, eliteFrac, newIndividuals, NOT_SET, 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
  `NSGA2Breeder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ArrayList<ArrayList<Individual>>`
  `assignFrontRanks(Subpopulation subpop)`
  Divides inds into ranks and assigns each individual's rank to be the rank it was placed into.
  `Population`
  `breedPopulation(EvolutionState state)`
  Use super's breeding, but also set our local state to record that breeding is complete.
  `ArrayList<Individual>`
  `buildArchive(EvolutionState state, int subpop)`
  Build the auxiliary fitness data and reduce the subpopulation to just the archive, which is returned.
  `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)`
  `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`

- ## Constructor Details

  - ### NSGA2Breeder

    public NSGA2Breeder()

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

  - ### numElites

    public int numElites(EvolutionState state, int subpopulation)
    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 NSGA-II 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`

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

  - ### buildArchive

    public ArrayList<Individual> buildArchive(EvolutionState state, int subpop)
    Build the auxiliary fitness data and reduce the subpopulation to just the archive, which is returned.

  - ### assignFrontRanks

    public ArrayList<ArrayList<Individual>> assignFrontRanks(Subpopulation subpop)
    Divides inds into ranks and assigns each individual's rank to be the rank it was placed into. Each front is an ArrayList.