saealib.ParetoMixin#

class saealib.ParetoMixin(attrs, init_capacity=100, direction=None, dominator=None, eps_cv=0.0, key_attr='x', atol=0.0, rtol=0.0, duplicate_policy='keep_first', genomes=None, dense_numeric_view=None, dense_view=None, **kwargs)[source]#

Bases: object

A mixin that maintains a Pareto-non-dominated archive.

Must be used via multiple inheritance together with Population (or a subclass thereof). Only non-dominated solutions are retained: when a new solution is added any existing solutions it dominates are removed, and if the new solution is itself dominated it is discarded.

Feasibility-first dominance is applied:

  • A feasible solution (cv ≤ eps_cv) dominates every infeasible one.

  • Among two infeasible solutions the one with lower cv dominates.

  • Among two feasible solutions dominator.dominates is used.

Parameters:
  • attrs (list[PopulationAttribute]) – Forwarded to Population.__init__.

  • init_capacity (int, optional) – Forwarded to Population.__init__.

  • direction (np.ndarray or None, optional) – Per-objective direction (+1 maximize, -1 minimize). None defaults to all-minimize.

  • dominator (Dominator or None, optional) – Dominance predicate. None defaults to ParetoDominator().

  • eps_cv (float, optional) – Feasibility threshold for constraint violation, by default 0.0. Under Optimizer execution this value is overwritten every generation from problem.handler.feasibility_threshold; the default of 0.0 (strictly feasible only) is only meaningful for standalone (non-Optimizer) use of ParetoArchive.

  • key_attr (str)

  • atol (float)

  • rtol (float)

  • duplicate_policy (str)

  • genomes (GenomeBatch | None)

  • dense_numeric_view (DenseNumericView | None)

  • dense_view (DenseNumericView | None)

Methods

__init__

add

Add a solution to the Pareto archive.

Method Details

ParetoMixin.__init__(attrs, init_capacity=100, direction=None, dominator=None, eps_cv=0.0, key_attr='x', atol=0.0, rtol=0.0, duplicate_policy='keep_first', genomes=None, dense_numeric_view=None, dense_view=None, **kwargs)[source]#
Parameters:
  • attrs (list[PopulationAttribute])

  • init_capacity (int)

  • direction (ndarray | None)

  • dominator (Dominator | None)

  • eps_cv (float)

  • key_attr (str)

  • atol (float)

  • rtol (float)

  • duplicate_policy (str)

  • genomes (GenomeBatch | None)

  • dense_numeric_view (DenseNumericView | None)

  • dense_view (DenseNumericView | None)

ParetoMixin.add(element=None, **kwargs)[source]#

Add a solution to the Pareto archive.

The solution is accepted only if it is not dominated by any existing member. After insertion all existing members that are dominated by the new solution are removed.

Parameters:
  • element (Individual | dict | None) – Data for the new solution.

  • **kwargs – Attribute values that override or supplement element.

Returns:

idx – Index assigned to the new solution, or -1 when it was rejected.

Return type:

int

Examples

>>> archive.add(ind)
>>> archive.add({"x": x_val, "f": f_val})
>>> archive.add(x=x_val, f=f_val)