src/scBONITA/classDefinitions.py
def selNSGA2(self, individuals, k):
        # NSGA2 selection taken from deap
        """Apply NSGA-II selection operator on the *individuals*. Usually, the
        size of *individuals* will be larger than *k* because any individual
        present in *individuals* will appear in the returned list at most once.
        Having the size of *individuals* equals to *k* will have no effect other
        than sorting the population according to their front rank. The
        list returned contains references to the input *individuals*. For more
        details on the NSGA-II operator see [Deb2002]_.

        :param individuals: A list of individuals to select from.
        :param k: The number of individuals to select.
        :returns: A list of selected individuals.

        .. [Deb2002] Deb, Pratab, Agarwal, and Meyarivan, "A fast elitist
        non-dominated sorting genetic algorithm for multi-objective
        optimization: NSGA-II", 2002.
        """
        pareto_fronts = self.sortNondominatedAdapt(individuals, k)
        for front in pareto_fronts:
            self.assignCrowdingDist(front)

        chosen = list(chain(*pareto_fronts[:-1]))
        k = k - len(chosen)
        if k > 0:
            sorted_front = sorted(
                pareto_fronts[-1], key=attrgetter("fitness.crowding_dist"), reverse=True
            )
            chosen.extend(sorted_front[:k])

        return chosen
Apply NSGA-II selection operator on the *individuals*. Usually, the
        size of *individuals* will be larger than *k* because any individual
        present in *individuals* will appear in the returned list at most once.
        Having the size of *individuals* equals to *k* will have no effect other
        than sorting the population according to their front rank. The
        list returned contains references to the input *individuals*. For more
        details on the NSGA-II operator see [Deb2002]_.

        :param individuals: A list of individuals to select from.
        :param k: The number of individuals to select.
        :returns: A list of selected individuals.

        .. [Deb2002] Deb, Pratab, Agarwal, and Meyarivan, "A fast elitist
        non-dominated sorting genetic algorithm for multi-objective
        optimization: NSGA-II", 2002.
        
Apply NSGA-II selection operator on the *individuals*.
Apply NSGA - II selection operator on the * individuals * .
def selNSGA2(self, individuals, k):
        pareto_fronts = self.sortNondominatedAdapt(individuals, k)
        for front in pareto_fronts:
            self.assignCrowdingDist(front)
        chosen = list(chain(*pareto_fronts[:-1]))
        k = k - len(chosen)
        if k > 0:
            sorted_front = sorted(
                pareto_fronts[-1], key=attrgetter("fitness.crowding_dist"), reverse=True
            )
            chosen.extend(sorted_front[:k])
        return chosen
def selNSGA2 ( self , individuals , k ) : pareto_fronts = self . sortNondominatedAdapt ( individuals , k ) for front in pareto_fronts : self . assignCrowdingDist ( front ) chosen = list ( chain ( * pareto_fronts [ : - 1 ] ) ) k = k - len ( chosen ) if k > 0 : sorted_front = sorted ( pareto_fronts [ - 1 ] , key = attrgetter ( "fitness.crowding_dist" ) , reverse = True ) chosen . extend ( sorted_front [ : k ] ) return chosen
Apply NSGA-II selection operator on the *individuals*.
Apply NSGA - II selection operator on the * individuals * .
# NSGA2 selection taken from deap """Apply NSGA-II selection operator on the *individuals*. Usually, the
        size of *individuals* will be larger than *k* because any individual
        present in *individuals* will appear in the returned list at most once.
        Having the size of *individuals* equals to *k* will have no effect other
        than sorting the population according to their front rank. The
        list returned contains references to the input *individuals*. For more
        details on the NSGA-II operator see [Deb2002]_.

        :param individuals: A list of individuals to select from.
        :param k: The number of individuals to select.
        :returns: A list of selected individuals.

        .. [Deb2002] Deb, Pratab, Agarwal, and Meyarivan, "A fast elitist
        non-dominated sorting genetic algorithm for multi-objective
        optimization: NSGA-II", 2002.
        """
A list of selected individuals.
[Deb2002] Deb, Pratab, Agarwal, and Meyarivan, "A fast elitist
non-dominated sorting genetic algorithm for multi-objective
optimization: NSGA-II", 2002.
A list of selected individuals . [ Deb2002 ] Deb Pratab Agarwal and Meyarivan " A fast elitist non - dominated sorting genetic algorithm for multi - objective optimization : NSGA - II " 2002 .
self
individuals
A list of individuals to select from.
A list of individuals to select from .
k
The number of individuals to select.
The number of individuals to select .