saealib.Dominator#

class saealib.Dominator[source]#

Bases: ABC

Abstract base for dominance predicates.

A Dominator encapsulates 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 dominates predicate is derived from dominates_many and 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. None defaults to minimization for all objectives.

Methods

__init__

dominance_matrix

Compute the NxN boolean dominance matrix.

dominates

Return True if fa dominates fb.

dominates_many

One-vs-many dominance check, batched over f_matrix's rows.

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_many with 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 iff fa dominates f_matrix[i]; dominates_fa[i] is True iff f_matrix[i] dominates fa.

Return type:

tuple[np.ndarray, np.ndarray]