6.1 Constraint Satisfaction Problem
6.1 Constraint Satisfaction Problem
Constraints:
5 4 3 2 1 SOLUTION:
S E N D
+ M O R E 9 5 6 7
c3 c2 c1 + 1 0 8 5
---------------------- -----------------
M O N E Y 1 0 6 5 2
VALUES:
S=9
E=5
N=6
D=7
M=1
O=0
R=8
Y=2
1. From Column 5, M=1, since it is only carry-over possible from
sum of 2 single digit number in column 4.
2. To produce a carry from column 4 to column 5 'S + M' is at least
9 so 'S=8or9' so 'S+M=9or10' & so 'O = 0 or 1'. But 'M=1', so 'O
= 0'.
3. If there is carry from Column 3 to 4 then 'E=9' & so 'N=0'. But 'O
= 0' so there is no carry & 'S=9' & 'c3=0'.
4. If there is no carry from column 2 to 3 then 'E=N' which is
impossible, therefore there is carry & 'N=E+1' & 'c2=1'.
5. If there is carry from column 1 to 2 then 'N+R=E mod 10' &
'N=E+1‘ so 'E+1+R=E mod 10', so 'R=9' but 'S=9', so there must
be carry from column 1 to 2. Therefore 'c1=1' & 'R=8'.
6. To produce carry 'c1=1' from column 1 to 2, we must have
'D+E=10+Y‘ as Y cannot be 0/1 so D+E is atleast 12. As D is atmost
7 & E is atleast 5 (D cannot be 8 or 9 as it is already assigned). N is
atmost 7 & 'N=E+1' so 'E=5or6'.
7. If E were 6 & D+E atleast 12 then D would be 7, but 'N=E+1' &
N would also be 7 which is impossible. Therefore 'E=5' & 'N=6'.
8. D+E is atleast 12 for that we get 'D=7' & 'Y=2'.