saealib.DecompositionComparator#
- class saealib.DecompositionComparator(decomposition, weights, ideal_point=None, direction=None, *, eps_cv=1e-06, eps_obj=1e-06)[ソース]#
ベースクラス:
ComparatorComparator that ranks solutions by a scalarization (decomposition) score.
Implements MOEA/D-style decomposition: each sub-problem is defined by a weight vector
weightsand an ideal pointideal_point. The ordering follows the library convention (feasibility first, then score).Ordering rules:
Infeasible individuals (
cv > eps_cv) are always placed after feasible ones, sorted by ascending constraint violation (Deb 2000).Among feasible individuals, the individual with the lower aggregate score (as returned by
decomposition.aggregate) is ranked first.Two individuals with scores within
eps_objare considered equal.
Direction handling:
weightscontains non-negative magnitudes only. Sign conventions (minimize vs. maximize) are expressed viadirection. Before callingdecomposition.aggregate, objectives are transformed asf_min = f * (-direction)so that all objectives are in the minimization frame.Ideal-point tracking: when
ideal_point=None,sort_populationcomputes the per-objective minimum of the feasible set at each call (dynamic tracking). Forcompare, the pair-wise minimum is used as a local approximation — consistent but not globally optimal.- パラメータ:
decomposition (Decomposition) -- Scalarization function (e.g.
TchebycheffDecomposition).weights (np.ndarray) -- Non-negative weight vector, shape
(n_obj,).ideal_point (np.ndarray or None) -- Reference minimum per objective, shape
(n_obj,).None(the default) activates dynamic computation from the population.direction (np.ndarray or None) -- Per-objective optimization direction:
+1= maximize,-1= minimize.Nonemeans minimize all objectives.eps_cv (float) -- Feasibility threshold for constraint violation.
eps_obj (float) -- Score tolerance: differences smaller than this are treated as equal.
参照
[9]: Zhang, Q., & Li, H. (2007). MOEA/D: A multiobjective evolutionary algorithm based on decomposition. IEEE Transactions on Evolutionary Computation, 11(6), 712-731.
[10]: Deb, K. (2000). An efficient constraint handling method for genetic algorithms. Computer Methods in Applied Mechanics and Engineering, 186(2-4), 311-338.
Methods
Compare two solutions directly without a Population object. |
|
Compare two individuals using feasibility rule then aggregate score. |
|
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 aggregate score; infeasible individuals come last. |
Method Details
- DecompositionComparator.__init__(decomposition, weights, ideal_point=None, direction=None, *, eps_cv=1e-06, eps_obj=1e-06)[ソース]#
- パラメータ:
decomposition (Decomposition)
weights (ndarray)
ideal_point (ndarray | None)
direction (ndarray | None)
eps_cv (float)
eps_obj (float)
- 戻り値の型:
None
- DecompositionComparator.compare(fa, cv_a, fb, cv_b)[ソース]#
Compare two solutions directly without a Population object.
When
ideal_pointwas not provided at construction time, the pair-wise minimummin(fa_min, fb_min)is used as a local approximation of the ideal point. This is consistent for pairwise comparison but may differ fromsort_populationresults (which use the population-wide minimum).- パラメータ:
fa (np.ndarray) -- Objective vectors, shape
(n_obj,).fb (np.ndarray) -- Objective vectors, shape
(n_obj,).cv_a (float) -- Constraint violations.
cv_b (float) -- Constraint violations.
- 戻り値:
-1ifais better,1ifbis better,0if equal.- 戻り値の型:
int
- DecompositionComparator.compare_population(population, idx_a, idx_b)[ソース]#
Compare two individuals using feasibility rule then aggregate score.
Returns
-1ifais better,1ifbis better,0if equal (withineps_obj).- パラメータ:
population (Population)
idx_a (int)
idx_b (int)
- 戻り値の型:
int
- DecompositionComparator.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]
- DecompositionComparator.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
- DecompositionComparator.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
- DecompositionComparator.sort_population(population)[ソース]#
Sort by aggregate score; infeasible individuals come last.
- パラメータ:
population (Population) -- The population to sort.
- 戻り値:
Sorted population indices (int).
- 戻り値の型:
np.ndarray