Class Nsga2

  • All Implemented Interfaces:
    Selector
    Direct Known Subclasses:
    SelectorDefault

    public class Nsga2
    extends java.lang.Object
    implements Selector
    The Nsga2 Selector, see "A Fast Elitist Non-Dominated Sorting Genetic Algorithm for Multi-Objective Optimization: NSGA-II, K. Deb, Samir Agrawal, Amrit Pratap, and T. Meyarivan, Parallel MockProblem Solving from Nature, 2000".
    See Also:
    Nsga2Module
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.opt4j.core.common.archive.FrontDensityIndicator indicator  
      protected java.util.Random random  
      protected int tournament  
    • Constructor Summary

      Constructors 
      Constructor Description
      Nsga2​(org.opt4j.core.common.random.Rand random, int tournament, org.opt4j.core.common.archive.FrontDensityIndicator indicator)
      Constructs a Nsga2 Selector.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<org.opt4j.core.Individual> getLames​(int size, java.util.Collection<org.opt4j.core.Individual> population)
      Selects a subset of lambda Individuals and returns it as a new Collection.
      java.util.Collection<org.opt4j.core.Individual> getParents​(int mu, java.util.Collection<org.opt4j.core.Individual> population)
      Selects a subset of Individuals and returns it as a new Collection.
      protected java.util.Map<org.opt4j.core.Individual,​java.lang.Integer> getRank​(NonDominatedFronts fronts)
      Determine the ranks of fronts.
      void init​(int maxsize)
      Sets the maximal number of Individuals.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • random

        protected final java.util.Random random
      • tournament

        protected final int tournament
      • indicator

        protected final org.opt4j.core.common.archive.FrontDensityIndicator indicator
    • Constructor Detail

      • Nsga2

        @Inject
        public Nsga2​(org.opt4j.core.common.random.Rand random,
                     int tournament,
                     org.opt4j.core.common.archive.FrontDensityIndicator indicator)
        Constructs a Nsga2 Selector.
        Parameters:
        random - the random number generator
        tournament - the tournament value
    • Method Detail

      • init

        public void init​(int maxsize)
        Description copied from interface: Selector
        Sets the maximal number of Individuals.
        Specified by:
        init in interface Selector
        Parameters:
        maxsize - the number of individuals
      • getParents

        public java.util.Collection<org.opt4j.core.Individual> getParents​(int mu,
                                                                          java.util.Collection<org.opt4j.core.Individual> population)
        Description copied from interface: Selector
        Selects a subset of Individuals and returns it as a new Collection. These so called parents can be used to form the next generation.
        Specified by:
        getParents in interface Selector
        Parameters:
        mu - the number of parents to select
        population - the list of individuals
        Returns:
        the parents
      • getLames

        public java.util.Collection<org.opt4j.core.Individual> getLames​(int size,
                                                                        java.util.Collection<org.opt4j.core.Individual> population)
        Description copied from interface: Selector
        Selects a subset of lambda Individuals and returns it as a new Collection. These individuals can be erased in the next generation.
        Specified by:
        getLames in interface Selector
        Parameters:
        size - the number of lames to select
        population - the list of individuals
        Returns:
        the worst lambda individuals
      • getRank

        protected java.util.Map<org.opt4j.core.Individual,​java.lang.Integer> getRank​(NonDominatedFronts fronts)
        Determine the ranks of fronts.
        Parameters:
        fronts - the fronts
        Returns:
        the ranks