Computes the crowding distance for each individual, measuring solution
density in objective space.
Usage
crowding_distance(fitness_values, ranks = NULL)
Arguments
- fitness_values
Matrix of fitness values (individuals x objectives).
- ranks
Vector of Pareto ranks (optional).
Value
Numeric vector of crowding distances.
Details
Crowding distance measures how close an individual is to its neighbors
in objective space. Higher values indicate more isolated solutions,
which are preferred for maintaining diversity. Boundary solutions
receive infinite crowding distance.
Examples
fitness <- matrix(runif(20), nrow = 10, ncol = 2)
crowding <- crowding_distance(fitness)