saealib.EpsilonConstraintHandler#
- class saealib.EpsilonConstraintHandler(schedule)[ソース]#
ベースクラス:
ConstraintHandlerDynamic ε-constraint handler.
The feasibility threshold ε starts at
schedule(0)and is updated toschedule(gen)at the end of each generation viaon_generation_end(). As ε decreases toward 0 the population is gradually driven into the feasible region.Each call to
on_generation_end()setscomparator.eps_cv = feasibility_thresholdvia the runner, so the comparator's feasibility criterion tightens in sync with ε.- パラメータ:
schedule (callable) -- Maps generation index (int) → current ε value (float).
schedule(0)is the initial ε; it should decrease toward 0 over generations.
メモ
compute_cv()aggregates violations as:Equality constraints:
|h(x)|(raw absolute value; theEqualityConstraint.tolerancefield is intentionally bypassed so that ε controls the feasibility threshold globally).Inequality constraints:
max(0, g(x) - threshold) ** 2(squared positive part; the constraint'sthresholdstill applies).
This follows the constraint-violation formulation summarized by Mezura-Montes & Coello Coello (2011): inequality violations are squared, equality violations are the unsquared absolute value. The cited survey states the formulation for constraint values that have been normalised beforehand; this handler aggregates the raw
g/hvalues without that normalisation, so constraints on very different scales will not contribute evenly tocv.The ε-constrained method itself originates from Takahama & Sakai (2006). The aggregation described above is the one given by the Mezura-Montes & Coello Coello (2011) survey, which attributes the method to them; it is not Takahama & Sakai's own, which raises the inequality and equality terms to one shared exponent rather than squaring only the inequalities.
参照
[1]: Mezura-Montes, E., & Coello Coello, C. A. (2011). Constraint-handling in nature-inspired numerical optimization: Past, present and future. Swarm and Evolutionary Computation, 1(4), 173-194.
Methods
Transform objective values using constraint information. |
|
Return |
|
Update internal ε to |
|
Repair a design vector before evaluation. |
Method Details
- EpsilonConstraintHandler.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
- EpsilonConstraintHandler.compute_cv(constraints, x, g)[ソース]#
Return
|h|for equality andmax(0, g-threshold)**2for inequality.- パラメータ:
constraints (list[InequalityConstraint])
x (ndarray)
g (ndarray)
- 戻り値の型:
float
- EpsilonConstraintHandler.on_generation_end(gen, population)[ソース]#
Update internal ε to
schedule(gen).- パラメータ:
gen (int)
population (Population)
- 戻り値の型:
None
- EpsilonConstraintHandler.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
xto[lb, ub], reproducing the behaviour ofrepair_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