Donald + Gerald = Robert
We can write one long constraint for the sum:
- 100000*D + 10000*O + 1000*N + 100*A+ 10*L + D + 100000*G + 10000*E + 1000*R + 100*A+ 10*L + D = 100000*R + 10000*O + 1000*B + 100*E+ 10*R + T
But what about the difference between variables?
- Could write D =/= O, D=/=N, … B =/= T
- Or express it as a single constraint on all variables
- AllDifferent(D,O,N,A,L,G,E,R,B,T)
These two constraints
- express the problem precisely
- both involve all the 10 variables in the problem