Skip to main content

Module constraint

Module constraint 

Source
Expand description

Nonlinear constraint handling.

forge’s optimizers are box-constrained by design; real calibration and design problems add nonlinear constraints (parameter relationships in hydrological models, adjacency/budget rules in spatial planning). This module provides the two standard parameter-free techniques from the CEC constrained-optimization lineage as adapters: a ConstrainedProblem is converted into an ordinary Problem, so every forge optimizer — DE, L-SHADE, L-SRTDE, CMA-ES, DDS, SCE-UA, PSO, restarts, ensembles — handles constraints without modification.

  • DebRules — Deb’s feasibility rules (Deb 2000, CMAME 186:311–338): feasible beats infeasible; feasible candidates compare by objective; infeasible candidates compare by total violation. Encoded exactly as Deb’s original fitness transformation: an infeasible point scores FEASIBLE_CEILING + total_violation, above every feasible objective.
  • EpsilonLShade — the ε-constrained method (Takahama & Sakai lineage, the backbone of CEC winners such as LSHADE44 and εMAg-ES) lives inside the algorithm, not here: violations up to a shrinking tolerance ε(t) count as feasible, and the comparison is re-applied with the current ε each generation. An adapter cannot express that faithfully — optimizers cache fitness values, so a point accepted under an early, generous ε would keep its stale score after ε contracts and block genuinely feasible solutions.

Caveat: the DebRules transformation is exact as long as every feasible objective value is below FEASIBLE_CEILING (1e100).

Structs§

ConstrainedFunc
Closure-backed constrained problem produced by constrained_func.
DebRules
Deb’s feasibility rules (Deb 2000) as a Problem adapter.

Constants§

FEASIBLE_CEILING
Objective values at or above this are reserved for infeasible candidates (Deb’s transformation): score = FEASIBLE_CEILING · (1 + violation). The encoding is multiplicative because an additive 1e100 + violation would be absorbed by the ulp of 1e100 (~1.9e84) and erase the ranking between different violations.

Traits§

ConstrainedProblem
A box-constrained problem with additional nonlinear constraints.

Functions§

constrained_func
A ConstrainedProblem defined inline by closures.