Constraint implementation¶
Low-level constraint strategies and violation helpers. For user-defined constrained problems, use the public problem-definition workflow instead.
Internal implementation API
These deep modules are not stable public imports. Documentation does not create a compatibility guarantee. See the stability policy.
Public problem definition ยท Constraints guide
ConstraintInfo
dataclass
¶
FeasibilityFirstStrategy
¶
Bases: ConstraintHandlingStrategy
PenaltyCVStrategy
¶
Bases: ConstraintHandlingStrategy
CVAsObjectiveStrategy
¶
Bases: ConstraintHandlingStrategy
EpsilonConstraintStrategy
¶
Bases: ConstraintHandlingStrategy
compute_constraint_info(G, eps=0.0)
¶
Compute aggregate constraint violation and feasibility mask.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
G
|
ndarray | None
|
Constraint values where |
required |
eps
|
float
|
Feasibility tolerance. Constraints |
``0.0``
|
get_constraint_strategy(name, **kwargs)
¶
Utility helpers for constraint handling.
compute_violation(G, *, n=None)
¶
Sum of positive parts per-solution; assumes G shape (N, n_constraints), g<=0 satisfied.
When G is None (unconstrained), n must be provided so the output
length is explicit.
is_feasible(G, *, n=None, eps=0.0)
¶
Boolean feasibility mask; assumes G shape (N, n_constraints).
When G is None (unconstrained), n must be provided so the output
length is explicit.
eps is a feasibility tolerance: constraints with g(x) <= eps are
treated as satisfied (default 0.0).