saealib.StaticToleranceHandler#

class saealib.StaticToleranceHandler(eps_cv=1e-06)[ソース]#

ベースクラス: ConstraintHandler

Default constraint handler reproducing the static-tolerance behavior.

The constraint violation is the sum of per-constraint violations sum(c_i.violation_from_value(g_i)) and the feasibility threshold is a fixed eps_cv. Each constraint maps its own raw value to a violation, so inequality (max(0, g - threshold)) and equality (max(0, |h| - tolerance)) constraints can be mixed freely. Objectives are not augmented.

パラメータ:

eps_cv (float, optional) -- Feasibility threshold returned by feasibility_threshold. Default: 1e-6.

Methods

__init__

augment_objective

Transform objective values using constraint information.

compute_cv

Return the sum of per-constraint c_i.violation_from_value(g_i).

on_generation_end

Run end-of-generation bookkeeping.

repair

Repair a design vector before evaluation.

Method Details

StaticToleranceHandler.__init__(eps_cv=1e-06)[ソース]#
パラメータ:

eps_cv (float)

StaticToleranceHandler.augment_objective(f, constraints, x, g)#

Transform objective values using constraint information.

Used by penalty-based or augmented-Lagrangian strategies. The default is the identity (objectives are returned unchanged).

パラメータ:
  • f (np.ndarray) -- Raw objective values. shape = (n_obj, )

  • constraints (list[InequalityConstraint]) -- The problem's inequality constraints, aligned with g.

  • x (np.ndarray) -- The evaluated design vector. shape = (dim, )

  • g (np.ndarray) -- Raw constraint values g(x). shape = (n_constraints, )

戻り値:

The (possibly) augmented objective values. shape = (n_obj, )

戻り値の型:

np.ndarray

StaticToleranceHandler.compute_cv(constraints, x, g)[ソース]#

Return the sum of per-constraint c_i.violation_from_value(g_i).

パラメータ:
戻り値の型:

float

StaticToleranceHandler.on_generation_end(gen, population)#

Run end-of-generation bookkeeping.

Used by adaptive strategies (e.g. ε-level control) that update their internal state between generations. The default is a no-op.

パラメータ:
  • gen (int) -- The generation index that just finished.

  • population (Population) -- The current population.

戻り値の型:

None

StaticToleranceHandler.repair(x, constraints, lb, ub, **kwargs)#

Repair a design vector before evaluation.

Called by the algorithm after each variation operator (crossover / mutation) and before objective evaluation. The default clips x to [lb, ub], reproducing the behaviour of repair_clipping.

Subclasses override this to add domain-constraint repair (e.g. a Newton step toward an equality-constraint manifold) on top of—or instead of—bounds clipping.

パラメータ:
  • x (np.ndarray) -- The design vector to repair. shape = (dim, )

  • constraints (list[InequalityConstraint]) -- The problem's domain constraints.

  • lb (np.ndarray) -- Lower bounds. shape = (dim, )

  • ub (np.ndarray) -- Upper bounds. shape = (dim, )

  • **kwargs -- Reserved for future use (e.g. parent solution for reflection repair).

戻り値:

The repaired design vector. shape = (dim, )

戻り値の型:

np.ndarray