evomo.operators.selection.non_dominate#
Functions#
|
Return the domination relation matrix A, where A_{ij} is True if x_i dominates y_j. |
|
Update the dominate count and ranks for the current Pareto front. |
|
Compute the non-domination rank for a set of solutions in multi-objective optimization. |
|
Compute the crowding distance for a set of solutions in multi-objective optimization. |
|
Perform environmental selection based on non-domination rank and crowding distance. |
Module Contents#
- evomo.operators.selection.non_dominate.dominate_relation(x: torch.Tensor, y: torch.Tensor, cv_x: torch.Tensor = None, cv_y: torch.Tensor = None) torch.Tensor#
Return the domination relation matrix A, where A_{ij} is True if x_i dominates y_j.
- Parameters:
x – An array with shape (n1, m) where n1 is the population size and m is the number of objectives.
y – An array with shape (n2, m) where n2 is the population size and m is the number of objectives.
- Returns:
The domination relation matrix of x and y.
- evomo.operators.selection.non_dominate.update_dc_and_rank(dominate_relation_matrix: torch.Tensor, dominate_count: torch.Tensor, pareto_front: torch.BoolTensor, rank: torch.Tensor, current_rank: int)#
Update the dominate count and ranks for the current Pareto front.
- Parameters:
dominate_relation_matrix – The domination relation matrix between individuals.
dominate_count – The count of how many individuals dominate each individual.
pareto_front – A tensor indicating which individuals are in the current Pareto front.
rank – A tensor storing the rank of each individual.
current_rank – The current Pareto front rank.
- Returns:
rank: Updated rank tensor.
dominate_count: Updated dominate count tensor.
- evomo.operators.selection.non_dominate.non_dominate_rank(x: torch.Tensor, cv: torch.Tensor = None) torch.Tensor#
Compute the non-domination rank for a set of solutions in multi-objective optimization.
The non-domination rank is a measure of the Pareto optimality of each solution.
- Parameters:
x – A 2D tensor where each row represents a solution, and each column represents an objective.
cv – An optional tensor containing the constraint violations of the solutions.
- Returns:
A 1D tensor containing the zero-based non-domination rank for each solution. Solutions in the first Pareto front have rank 0.
- evomo.operators.selection.non_dominate.crowding_distance(costs: torch.Tensor, mask: torch.Tensor)#
Compute the crowding distance for a set of solutions in multi-objective optimization.
The crowding distance is a measure of the diversity of solutions within a Pareto front.
- Parameters:
costs – A 2D tensor where each row represents a solution, and each column represents an objective.
mask – A 1D boolean tensor indicating which solutions should be considered.
- Returns:
A 1D tensor containing the crowding distance for each solution.
- evomo.operators.selection.non_dominate.nd_environmental_selection(x: torch.Tensor, f: torch.Tensor, topk: int, cv: torch.Tensor = None)#
Perform environmental selection based on non-domination rank and crowding distance.
Ranking stops after the complete front containing the topk-th solution. Negative or nonfinite total constraint violations require full ranking to preserve the CV-first selection order. Returned ranks are always complete for the selected individuals; use non_dominate_rank for all input ranks.
- Parameters:
x – A 2D tensor where each row represents a solution, and each column represents a decision variable.
f – A 2D tensor where each row represents a solution, and each column represents an objective.
topk – The number of solutions to select.
cv – An optional tensor containing the constraint violations of the solutions.
- Returns:
A tuple of five values: - x: The selected solutions. - f: The corresponding objective values. - rank: The non-domination rank of the selected solutions. - crowding_dis: The crowding distance of the selected solutions. - cv: The selected constraint violations, or
Nonefor an unconstrained problem.