Pseudo-boolean >=: sum of (coeff * bool) >= k.
(args: Sequence[tuple[BoolRef, int]], k: int)
| 2133 | |
| 2134 | |
| 2135 | def PbGe(args: Sequence[tuple[BoolRef, int]], k: int) -> BoolRef: |
| 2136 | """Pseudo-boolean >=: sum of (coeff * bool) >= k.""" |
| 2137 | if not args: |
| 2138 | return BoolVal(0 >= k) |
| 2139 | int_args = [_bool_to_int(b, c) for b, c in args] |
| 2140 | total = Sum(*int_args) |
| 2141 | return total >= k |
| 2142 | |
| 2143 | |
| 2144 | # --------------------------------------------------------------------------- |