friendlysam.opt.piecewise_affine_constraints¶
-
friendlysam.opt.piecewise_affine_constraints(variables, include_lb=True)¶ Constrains for a piecewise affine expression.
For some variables
, this function creates- A
SOS2constraint for the variables. - A constraint that
. - For each variable
, a constraint that
.
It is used by
piecewise_affine().Parameters: - (sequence of (variables) – class:Variable instances)
- include_lb (boolean, optional) – If
True(the default), lower bound constraintsx[i] >= 0are created for the variables. Set toFalseif your variables already have lower bounds>= 0and you want to avoid a few redundant constraints.
Returns: A set of
SOS2andConstraintinstances.Return type: set
- A