friendlysam.opt.SOS1

class friendlysam.opt.SOS1(variables, **kwargs)

Special ordered set, type 1

An ordered set of variables, of which at most one may be nonzero.

Add a SOS1 instance to an optimization problem just like a Constraint to enforce this condition.

Parameters:
  • variables (sequence of Variable instances) – The variables in the ordered set. Must be an ordered sequence (today list and tuple are allowed).
  • desc (str, optional) – A text describing the constraint.
  • origin (anything, optional) – Some object describing where the constraint comes from.
SOS1.desc A description of the constraint, for debugging.
SOS1.level A number indicating SOS1 (level=1) or SOS2 (level=2).
SOS1.origin The origin of the description.
SOS1.variables The ordered list of variables as a tuple.