saealib.Result#

class saealib.Result(x, f, fe, gen, ctx, history=None)[source]#

Bases: object

Optimization result returned by minimize() / maximize().

x/f/fe/gen are fixed at creation time (the arrays are copied). ctx/history/archive/pareto_archive/population are references derived from the state and may change while iteration is still in progress.

Parameters:
  • x (np.ndarray | None)

  • f (np.ndarray)

  • fe (int)

  • gen (int)

  • ctx (OptimizationState)

  • history (History | None)

x#

Best design variables. Shape (dim,) for single-objective, (n_pareto, dim) for multi-objective. None for non-dense spaces; use problem.space.services to convert result.ctx.archive.genomes when dense design variables are needed.

Type:

np.ndarray or None

f#

Best objective values. Shape (n_obj,) for single-objective, (n_pareto, n_obj) for multi-objective.

Type:

np.ndarray

fe#

Total number of true function evaluations used.

Type:

int

gen#

Total number of generations completed.

Type:

int

history#

Execution history recorded during the run.

Type:

History or None

ctx#

Full optimization context providing access to the archive and more.

Type:

OptimizationState

Methods

__init__

from_state

Build a result from the final or currently observed state.

history_series

Return one scalar value per recorded history generation.

Method Details

Result.__init__(x, f, fe, gen, ctx, history=None)#
Parameters:
  • x (np.ndarray | None)

  • f (np.ndarray)

  • fe (int)

  • gen (int)

  • ctx (OptimizationState)

  • history (History | None)

Return type:

None

classmethod Result.from_state(state)[source]#

Build a result from the final or currently observed state.

Result feasibility uses problem.eps_cv and intentionally differs from problem.handler.feasibility_threshold.

Parameters:

state (OptimizationState)

Return type:

Result

Result.history_series(value, *, x='fe', channel=None, **value_kwargs)[source]#

Return one scalar value per recorded history generation.

Parameters:
  • value (str or callable) – Registered value name, or a callable mapping one history record to a scalar. A callable also requires channel.

  • x ({"fe", "gen", "decision_count"}, optional) – Column supplying the independent coordinate.

  • channel (str, optional) – History channel whose records feed a callable value.

  • **value_kwargs – Arguments required by the registered value: reference_point for "hypervolume", reference_front for "gd", "gd_plus", "igd", "igd_plus" and "spread".

Returns:

The series and the display names of its two coordinates.

Return type:

HistorySeries

Raises:

ValidationError – If x or value is unknown, the channel the value needs was not recorded, or a reference argument has the wrong shape.

Notes

A reference is supplied in the objective space of the problem, the same orientation as Result.f. Front and reference are both converted to minimize-space before an indicator runs, and neither is normalized, so an indicator value keeps raw objective units.

Indicators read the front channel, a per-generation snapshot of the Pareto archive holding objective values alone, with no constraint violation column. That archive judges feasibility by its own eps_cv, which the built-in algorithms leave at 0.0, so it admits a solution as feasible only at exactly zero violation. While it holds no such solution, constrained dominance reduces the front to the lowest-cv solutions and an indicator over that generation describes an infeasible front; front_size collapsing to a single point is the visible sign.

Feasibility elsewhere in the series rests on different thresholds: "best" selects from the archive under problem.eps_cv, and "feasible_ratio" counts the population under the running problem.handler.feasibility_threshold. The three are independent and can disagree, most visibly while epsilon is relaxed.