Skip to content

special_ordered_set_type_2

relationalai.semantics.reasoners.prescriptive
special_ordered_set_type_2(index: Any, variables: Any) -> b.Aggregate

Return 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

  • index

    (Any) - Ordering index that defines adjacency in the set.
  • variables

    (Any) - Decision-variable expression(s) in the SOS2 set.

Returns

  • Aggregate - A solver aggregate representing the SOS2 constraint.

Examples

See special_ordered_set_type_1 for a usage example; the call shape is identical (special_ordered_set_type_2(index, variables)).