Generic constraints¶
AbstractConstraint (Abstract class)¶
Constraint¶
- class disropt.constraints.constraints.Constraint(fn, sign='==')[source]¶
Bases:
disropt.constraints.constraints.AbstractConstraint
Constraint build from a AbstractFunction object. Constraints are represented in the canonical forms \(f(x)=0\) and \(f(x)\leq 0\).
- Parameters
fn (AbstractFunction) – constraint function
sign (bool) – type of constraint: “==”, “<=” or “>=”
- fn¶
constraint function
- Type
- property function¶
- get_parameters()[source]¶
Return the parameters of the function if it is affine or quadratic
- Returns
A, b for affine constraints, P, q, r for quadratic
- Return type
- property is_affine¶
Return true if the function is affine.
- Returns
true if the function is affine
- Return type
- property is_equality¶
- property is_inequality¶
- property is_quadratic¶
Return true if the function is affine.
- Returns
true if the function is affine
- Return type
ExtendedConstraint¶
- class disropt.constraints.extended_constraint.ExtendedConstraint(fn, sign='==')[source]¶
Bases:
disropt.constraints.constraints.Constraint
Constraint with extended variable
- Parameters
constr (Constraint or list of Constraint) – original constraint(s)
n_var – number of additional variables. Defaults to 1
axis – axis along which the additional variables are appended. Defaults to -1 (the last valid one)
pos – position index of the old variable vector. Defaults to 0
- Raises