docplex.mp.sosvarset module¶
- class docplex.mp.sosvarset.SOSVariableSet(model, variable_sequence, sos_type, weights=None, name=None)[source]¶
Bases:
IndexableObject
,_AbstractBendersAnnotated
This class models Special Ordered Sets (SOS) of decision variables. An SOS has a type (SOS1, SOS2) and an ordered list of variables.
This class is not meant to be instantiated directly. To create an SOS, use the
docplex.mp.model.Model.add_sos()
,docplex.mp.model.Model.add_sos1()
, anddocplex.mp.model.Model.add_sos2()
methods in Model.- property benders_annotation¶
This property is used to get or set the Benders annotation of a SOS variable set. The value of the annotation must be a positive integer
- iter_variables()[source]¶
Iterates over the variables in the SOS.
Note that the sequence of variables cannot be empty.
- Returns:
An iterator.
- property sos_type¶
This property returns the type of the SOS variable set.
- Returns:
An enumerated value of type
docplex.mp.constants.SOSType
.