gemseo.core.mdo_functions.collections.constraints module#
A mutable sequence of constraints.
- class Constraints(design_space, tolerances)[source]#
Bases:
Functions
A mutable sequence of constraints.
- Parameters:
design_space (DesignSpace) -- The design space.
tolerances (ConstraintTolerances) -- The constraint tolerances.
- AggregationFunction#
alias of
EvaluationFunction
- aggregate(constraint_index, method=EvaluationFunction.MAX, groups=(), **options)[source]#
Aggregate a constraint to generate a reduced dimension constraint.
- Parameters:
constraint_index (int) -- The index of the constraint in
constraints
.method (Callable[[RealArray], float] | AggregationFunction) --
The aggregation method, e.g.
"max"
,"lower_bound_KS"
,"upper_bound_KS"``or ``"IKS"
.By default it is set to "MAX".
groups (Iterable[Sequence[int]]) --
The groups of components of the constraint to aggregate to produce one aggregation constraint per group of components; if empty, a single aggregation constraint is produced.
By default it is set to ().
**options (Any) -- The options of the aggregation method.
- Raises:
KeyError -- When the given index is greater or equal to the number of constraints.
- Return type:
None
- format(function, value=0.0, constraint_type=None, positive=False)[source]#
Format a constraint.
An equality constraint is written as \(c(x)=a\), a positive inequality constraint is written as \(c(x)\geq a\) and a negative inequality constraint is written as \(c(x)\leq a\).
- Parameters:
function (MDOFunction) -- The function \(c\).
value (float) --
The value \(a\).
By default it is set to 0.0.
constraint_type (MDOFunction.ConstraintType | None) -- The type of the constraint. If
None
,function.f_type
must be eitherMDOFunction.ConstraintType.INEQ
orMDOFunction.ConstraintType.EQ
.positive (bool) --
Whether the inequality constraint is positive.
By default it is set to False.
- Returns:
A formatted constraint ready to be added to the sequence.
- Raises:
TypeError -- When the constraint of a linear optimization problem is not an
MDOLinearFunction
.ValueError -- When the type of the constraint is missing.
- Return type:
- get_active(x_vect, tol=1e-06)[source]#
Indicate the active components of the different inequality constraints.
- Parameters:
x_vect (RealArray) -- The vector of design variables.
tol (float) --
The tolerance for deciding whether a constraint is active.
By default it is set to 1e-06.
- Returns:
For each constraint, a boolean indicator of activation of its different components.
- Return type:
dict[MDOFunction, RealArray]
- get_equality_constraints()[source]#
Return the equality constraints.
- Yields:
The equality constraints.
- Return type:
Iterator[MDOFunction]
- get_inequality_constraints()[source]#
Return the inequality constraints.
- Yields:
The inequality constraints.
- Return type:
Iterator[MDOFunction]
- get_number_of_unsatisfied_constraints(values=mappingproxy({}))[source]#
Return the number of scalar constraints not satisfied by design variables.
- is_constraint_satisfied(constraint_type, constraint_value)[source]#
Determine if an evaluation satisfies a constraint within a given tolerance.
- Parameters:
constraint_type (MDOFunction.ConstraintType) -- The type of the constraint.
constraint_value (RealArray) -- The value of the constraint.
- Returns:
Whether a value satisfies a constraint.
- Return type:
- is_point_feasible(point)[source]#
Check if a point is feasible.
Note
If the value of a constraint is absent from this point, then this constraint will be considered satisfied.
- property tolerances: ConstraintTolerances#
The constraint tolerances.