special_ordered_set_type_2
relationalai.semantics.reasoners.prescriptive.problem
special_ordered_set_type_2(index: Any, variables: Any) -> b.AggregateReturn an SOS2 constraint (at most two consecutive variables are non-zero).
Use this inside Model.require and
pass the resulting fragment to Problem.satisfy.
Arguments must reference decision variables declared via
Problem.solve_for.
The ordering in the set is defined by index (often a rank or position),
and the constraint is commonly used for piecewise-linear formulations.
For the SOS1 variant, see special_ordered_set_type_1.
Parameters
Section titled “Parameters”
(indexAny) - Ordering index that defines adjacency in the set.
(variablesAny) - Decision-variable expression(s) in the SOS2 set.
Returns
Section titled “Returns”Aggregate- A solver aggregate representing the SOS2 constraint.
Referenced By
Section titled “Referenced By”RelationalAI Documentation └── Build With RelationalAI └── Understand how PyRel works > Use advanced reasoning > Prescriptive reasoning > Choose a backend ├── Use HiGHS │ └── Limitations └── Use Ipopt └── Limitations