Skip to contents

Performs NSGA-II selection based on non-dominated sorting and crowding distance.

Usage

nsga2_select(fitness_values, n, weights)

Arguments

fitness_values

Matrix of fitness values (individuals x objectives).

n

Number of individuals to select.

weights

Vector of weights (-1 for minimization, 1 for maximization).

Value

Integer vector of selected indices.

Details

Selection proceeds by:

  1. Non-dominated sorting to assign Pareto ranks

  2. Computing crowding distance within each rank

  3. Selecting individuals by rank (ascending), breaking ties by crowding distance (descending)

References

Deb, K., Pratap, A., Agarwal, S., & Meyarivan, T. (2002). A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation, 6(2), 182-197.

Examples

fitness <- matrix(runif(20), nrow = 10, ncol = 2)
selected <- nsga2_select(fitness, n = 5, weights = c(-1, 1))