Unify the implementations of non-dominated sort #5089
Labels
code-fix
Change that does not change the behavior, such as code refactoring.
needs-discussion
Issue/PR which needs discussion.
Motivation
Currently, the
Optuna
codebase has implementations of fast non-dominated sort in three different places:optuna.study._multi_objective._get_pareto_front_trials_2d()
andoptuna.study._multi_objective._get_pareto_front_trials_nd()
optuna.samplers._tpe.sampler._calculate_nondomination_rank()
optuna.samplers.nsgaii._elite_population_selection_strategy._fast_non_dominated_sort()
This issue aims to unify those implementation to make the codebase simpler.
Suggestion
One of the possible steps are
_fast_non_dominated_sort()
and_calculate_nondomination_rank()
intooptuna.study._multi_objective._fast_non_dominated_sort()
. The new function willtrial
list or anp.ndarray
,_constrained_dominates
._get_pareto_front_trials_nd()
intooptuna.study._multi_objective._fast_non_dominated_sort()
. This might makes pareto front calculation slower, so it will be necessary to run some benchmarks._get_pareto_front_trials_nd()
by using Kung's algorithm or eliminating unnecessary comparison between new item and dominated items. Note that this will also needs to confirm benchmarks before merging.Additional context (optional)
Non dominated sorts
optuna/optuna/study/_multi_objective.py
Lines 11 to 57 in e54ae1f
optuna/optuna/samplers/_tpe/sampler.py
Lines 564 to 576 in e54ae1f
optuna/optuna/samplers/nsgaii/_elite_population_selection_strategy.py
Lines 112 to 150 in e54ae1f
The above functions have some difference:
_get_pareto_front_trials_2d()
and_get_pareto_front_trials_nd()
_get_pareto_front_trials_2d()
is_get_pareto_front_trials_nd()
performs comparison of trials_calculate_nondomination_rank()
n_below
trials, which enables to early return before the ranks of all trials are settled,_fast_non_dominated_sort()
_constrained_dominates
,The text was updated successfully, but these errors were encountered: