Comparison (cpmpy.transformations.comparison)
Transforms non-equality comparisons into equality comparisons as needed.
Let <op> be one of == or !=, <, <=, >, >=. Numeric expressions in Flat Normal Form are of the kind:
NumExpr <op> IV
BoolVar == NumExpr <op> IV
BoolVar -> NumExpr <op> IV
NumExpr <op> IV -> BoolVar
The NumExpr can be a sum, wsum or global function with a non-bool return type.
- This file implements:
only_numexpr_equality(): transforms NumExpr <op> IV (also reified) to (NumExpr == A) & (A <op> IV) if not supported
- cpmpy.transformations.comparison.only_numexpr_equality(constraints, supported=frozenset({}), csemap=None)[source]
Transforms
NumExpr <op> IVto(NumExpr == A) & (A <op> IV)if not supported. Also for the reified uses of NumExpr- Parameters:
supported – a (frozen)set of expression names that supports all comparisons in the solver