pareto_rank: Rank points according to Pareto-optimality (nondominated...

View source: R/nondominated.R

pareto_rankR Documentation

Rank points according to Pareto-optimality (nondominated sorting).

Description

pareto_rank() is meant to be used like rank(), but it assigns ranks according to Pareto dominance, where rank 1 indicates those solutions not dominated by any other solution in the input set. Duplicated points are assigned the same rank. The resulting ranking can be used to partition points into a list of matrices, each matrix representing a nondominated front \citepDeb02nsga2 (see examples below).

Usage

pareto_rank(x, maximise = FALSE)

Arguments

x

matrix()|data.frame()
Matrix or data frame of numerical values, where each row gives the coordinates of a point.

maximise

logical()
Whether the objectives must be maximised instead of minimised. Either a single logical value that applies to all objectives or a vector of logical values, with one value per objective.

Details

Given a finite set of points X \subset \mathbb{R}^m, the rank of a point x \in X is defined as:

\operatorname{rank}(x) = r \iff x \in F^c_{r} \land \nexists y \in F^c_{r}, y \prec x

where y \prec x means that y dominates x according to Pareto optimality, F^c_r = X \setminus \bigcup_{i=1}^{r-1} F_i and F_r = \{x \in X \land \operatorname{rank}(x) = r\}. The sets F_c, with c=1,\dots,k, partition X into k fronts, that is, mutually nondominated subsets of X.

With m=2, i.e., ncol(data)=2, the code uses the best-known O(n \log n) algorithm by \citetJen03. When m \geq 3, it uses the naive algorithm that identifies one front at a time, which requires O(n^2\log n) for m=3, and O(n^2 \log^{m-2} n) for m \geq 4.

Value

An integer vector of the same length as the number of rows of the input x, where each value gives the rank of each point (lower is better).

References

\insertAllCited

See Also

is_nondominated()

Examples

three_fronts = matrix(c(1, 2, 3,
                        3, 1, 2,
                        2, 3, 1,
                        10, 20, 30,
                        30, 10, 20,
                        20, 30, 10,
                        100, 200, 300,
                        300, 100, 200,
                        200, 300, 100), ncol=3, byrow=TRUE)
pareto_rank(three_fronts)

split.data.frame(three_fronts, pareto_rank(three_fronts))
path_A1 <- file.path(system.file(package="moocore"),"extdata","ALG_1_dat.xz")
set <- read_datasets(path_A1)[,1:2]
ranks <- pareto_rank(set)
str(ranks)
if (requireNamespace("graphics", quietly = TRUE)) {
   colors <- colorRampPalette(c("red","yellow","springgreen","royalblue"))(max(ranks))
   plot(set, col = colors[ranks], type = "p", pch = 20)
}

moocore documentation built on July 12, 2026, 5:06 p.m.