Closed ahyangyi closed 2 years ago
I note the request. Do not expect anything in the short to medium term.
For the AddMultiplicationEquality (and Mod, and Div), the best way is to duplicate the target variable, use the copy in the AddMultiplicationEquality, and add an enforced equality between the original target variable and its copy.
What language and solver does this apply to? All, but I am describing the issue using the Python API
Describe the problem you are trying to solve. We are using ortools to check satisfiability of certain constraints. In a section of the constraint specification, we have two modes: in mode A, the constaint is best described with
AddAllowedAssignments
; in mode B, the constaint is best described withAddMultiplicationEquality
.The obvious API for this case is
OnlyEnforceIf
. However,OnlyEnforceIf
does not support the two above-mentioned types of constaints.Describe the solution you'd like The protobuf declaration has the following comments:
which leads me to believe that a direct request for supporting these combinations would be the best.
Describe alternatives you've considered I could probably try to assemble
AddAllowedAssignments
andAddMultiplicationEquality
with extra intermediate variables. However, that would both obscure the intention of the code (which defeats the purpose of usingortools
in the first place) and would probably risk a slowdown.Additional context N/A