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
SOS2
constraint 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] >= 0
are created for the variables. Set toFalse
if your variables already have lower bounds>= 0
and you want to avoid a few redundant constraints.
Returns: A set of
SOS2
andConstraint
instances.Return type: set
- A