Dears,
I have a model with two boolean decision variable, avere only one can be equal ti 1.
Is it the solver faster if I use AddAllDifferent or It i use a simple constraint (ADD) x+y=1?
Dears,
I have a model with two boolean decision variable, avere only one can be equal ti 1.
Is it the solver faster if I use AddAllDifferent or It i use a simple constraint (ADD) x+y=1?
In this case, i would drop both ideas and stick to boolean-clauses:
x.Not() OR y.Not()
AND
x OR y
or if ortools supports it:
x XOR y
(= pseudocode -> not necessarily any sane syntax)
This is as simple as it gets and can be very efficiently reasoned about by unit-propagation. Furthermore, 2-SAT things might be at work internally (implication-graph and so on).
No need to reason about integer-arithmetic (including potential channeling of bool/int) or global-constraints.
The above is something which is sometimes even used in SAT when decomposing all-different by prohibit all possible pairs.
(ortools might be clever to analyze your approaches to get to the same boiled-down formulation; but maybe not -> why not help if it's so simple)