Skip to content

special_ordered_set_type_2

relationalai.semantics.reasoners.prescriptive.problem
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.

  • index

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

    (Any) - Decision-variable expression(s) in the SOS2 set.
  • Aggregate - A solver aggregate representing the SOS2 constraint.
RelationalAI Documentation
└──  Build With RelationalAI
    └──  Understand how PyRel works > Use advanced reasoning > Prescriptive reasoning > Choose a backend
        ├──  Use HiGHS
        │   └──  Limitations
        └──  Use Ipopt
            └──  Limitations