saealib.ParetoComparator#
- class saealib.ParetoComparator(direction=None, *, eps_cv=1e-06, eps_obj=1e-06, sorter=<function non_dominated_sort>, dominator=None)[ソース]#
ベースクラス:
ComparatorComparator for multi-objective optimization via non-dominated sorting only.
Implements rank-only Pareto ordering:
sort_population: Pareto front rank order (no crowding distance tiebreaking). Infeasible individuals (cv > eps) are always ranked after feasible ones, ordered by ascending constraint violation.
compare_population: Pareto dominance (-1 = a dominates b, 1 = b dominates a, 0 = non-dominated). Infeasibility is handled with the standard constraint-domination rule.
NaN objective values are treated as non-dominating and placed last within the feasible block (consistent with non_dominated_sort).
This class is a concrete base for Pareto-based comparators. NSGA2Comparator inherits from it and overrides sort_population to add crowding-distance-based secondary ordering within each front.
- パラメータ:
direction (np.ndarray or None) -- Per-objective optimization directions (+1 = maximize, -1 = minimize). None means all objectives are minimized (standard Pareto dominance).
eps_cv (float)
eps_obj (float)
sorter (NonDominatedSorter)
dominator (Dominator | None)
Methods
Compare two solutions directly without a Population object. |
|
Compare via Pareto dominance; -1=a dominates, 1=b dominates, 0=equal. |
|
Return population attributes this comparator needs to persist. |
|
Freshly recompute and materialize population-relative ranking state. |
|
Prepare population-relative ranking state, then sort. |
|
Sort by Pareto front rank; infeasible individuals come last. |
Method Details
- ParetoComparator.__init__(direction=None, *, eps_cv=1e-06, eps_obj=1e-06, sorter=<function non_dominated_sort>, dominator=None)[ソース]#
- パラメータ:
direction (ndarray | None)
eps_cv (float)
eps_obj (float)
sorter (NonDominatedSorter)
dominator (Dominator | None)
- ParetoComparator.compare(fa, cv_a, fb, cv_b)[ソース]#
Compare two solutions directly without a Population object.
- パラメータ:
fa (ndarray)
cv_a (float)
fb (ndarray)
cv_b (float)
- 戻り値の型:
int
- ParetoComparator.compare_population(population, idx_a, idx_b)[ソース]#
Compare via Pareto dominance; -1=a dominates, 1=b dominates, 0=equal.
- パラメータ:
population (Population)
idx_a (int)
idx_b (int)
- 戻り値の型:
int
- ParetoComparator.get_required_attrs(problem)#
Return population attributes this comparator needs to persist.
Population-relative ranking state (e.g. SPEA2 fitness) that must survive across selections belongs here as a named, typed attribute rather than in the population's transient cache. Default: no additional attributes.
- パラメータ:
problem (Problem) -- The optimization problem.
- 戻り値:
Empty by default.
- 戻り値の型:
list[PopulationAttribute]
- ParetoComparator.prepare_population(population)#
Freshly recompute and materialize population-relative ranking state.
Default is a no-op — comparators whose ranking depends only on per-individual values already stored in
f/cvdo not need this. Comparators that declare attributes viaget_required_attrs()should override this to recompute and write those attributes for the given population, unconditionally (not reusing any prior cached value).- パラメータ:
population (Population) -- The population to prepare ranking state for.
- 戻り値の型:
None
- ParetoComparator.rank_population(population)#
Prepare population-relative ranking state, then sort.
Equivalent to calling
prepare_population()followed bysort_population(). Callers performing environmental selection on a freshly assembled pool (e.g. survivor selection merging population and offspring) should call this instead ofsort_population()directly, so any population-relative state declared viaget_required_attrs()is recomputed for the new set before ranking.- パラメータ:
population (Population) -- The population to rank.
- 戻り値:
Sorted population indices, as returned by
sort_population().- 戻り値の型:
np.ndarray
- ParetoComparator.sort_population(population)[ソース]#
Sort by Pareto front rank; infeasible individuals come last.
- パラメータ:
population (Population)
- 戻り値の型:
np.ndarray