saealib.Dominator#
- class saealib.Dominator[source]#
Bases:
ABCAbstract base for dominance predicates.
A
Dominatorencapsulates the definition of dominance between objective vectors independently of the sorting algorithm. Two primitive operations are required:dominance_matrix— an NxN boolean matrix used by non-dominated sorting.dominates_many— a one-vs-many comparison used by incremental archive updates.
These primitives are independent and MUST agree on overlapping cases. The scalar
dominatespredicate is derived fromdominates_manyand therefore has no independent implementation for subclasses to keep in sync.Parameters are shared across these operations:
- Parameters:
f (np.ndarray) – Objective matrix. shape: (n, n_obj) [
dominance_matrix]fa (np.ndarray) – Objective vectors. shape: (n_obj,) [
dominates]fb (np.ndarray) – Objective vectors. shape: (n_obj,) [
dominates]f_matrix (np.ndarray) – Objective matrix. shape: (n, n_obj) [
dominates_many]direction (np.ndarray or None) – Per-objective optimization direction: +1 = maximize, -1 = minimize.
Nonedefaults to minimization for all objectives.
Methods
Compute the NxN boolean dominance matrix. |
|
Return True if fa dominates fb. |
|
One-vs-many dominance check, batched over |
Method Details
- Dominator.__init__()#
- abstractmethod Dominator.dominance_matrix(f, direction=None)[source]#
Compute the NxN boolean dominance matrix.
D[i, j]is True if row i dominates row j.- Parameters:
f (np.ndarray) – Objective matrix. shape: (n, n_obj). Must contain no NaN values (callers are responsible for pre-filtering).
direction (np.ndarray or None) – Per-objective direction.
None→ minimize all.
- Returns:
Boolean matrix of shape (n, n).
- Return type:
np.ndarray
- Dominator.dominates(fa, fb, direction=None)[source]#
Return True if fa dominates fb.
Derived from
dominates_manywith a single-row objective matrix. NaN values in fa always return False. NaN values in fb are treated as infinitely bad.- Parameters:
fa (np.ndarray) – Objective vectors. shape: (n_obj,)
fb (np.ndarray) – Objective vectors. shape: (n_obj,)
direction (np.ndarray or None) – Per-objective direction.
None→ minimize all.
- Return type:
bool
- abstractmethod Dominator.dominates_many(fa, f_matrix, direction=None)[source]#
One-vs-many dominance check, batched over
f_matrix’s rows.Required primitive from which
dominates()is derived.- Parameters:
fa (np.ndarray) – A single objective vector. shape: (n_obj,)
f_matrix (np.ndarray) – Objective matrix to compare fa against, one row at a time. shape: (n, n_obj). Must contain no NaN values (callers are responsible for pre-filtering, same convention as
dominance_matrix).direction (np.ndarray or None) – Per-objective direction.
None-> minimize all.
- Returns:
(fa_dominates, dominates_fa), each shape(n,):fa_dominates[i]is True ifffadominatesf_matrix[i];dominates_fa[i]is True ifff_matrix[i]dominatesfa.- Return type:
tuple[np.ndarray, np.ndarray]