Title: gerald
1 gerald donald --------- robert ---------
2 gerald donald --------- robert ---------
Variables g e r a l d o n b t
Domains value in range 0..9
Observations g cant be zero d cant be
zero r cant be zero t is even
(observation due to Christine)
These are unary constraints
All variables take different values binary
constraints?
3 gerald donald --------- robert ---------
d 10.l 100.a 1000.r 10000.e 100000.g
d 10.l
100.a 1000.n 10000.o 100000.d
t 10.r 100.e
1000.b 10000.o 100000.r
4 d 10.l 100.a 1000.r 10000.e 100000.g
d 10.l
100.a 1000.n 10000.o 100000.d
t 10.r 100.e
1000.b 10000.o 100000.r
gerald donald --------- robert ---------
Observations g cant be zero d cant be
zero r cant be zero t is even
(observation due to Christine)
Introduce carries t 10.carry1 2.d r
10.carry2 l l carry1 e 10.carry3 a a
carry2 b 10.carry4 r n carry3 o
10.carry5 e o carry4 r
g d carry5
5gerald() Problem -gt let p
makeProblem("CRYPT-ARITHMETIC gerald donald
robert",13), g makeIntVar(p,"g",0
,9), e makeIntVar(p,"e",0 ,9),
r makeIntVar(p,"r",0 ,9), a
makeIntVar(p,"a",0 ,9), l
makeIntVar(p,"l",0 ,9), d
makeIntVar(p,"d",0, 9), o
makeIntVar(p,"o",0 ,9), n
makeIntVar(p,"n",0 ,9), b
makeIntVar(p,"b",0 ,9), t
makeIntVar(p,"t",0, 9), letters
set(g,e,r,a,l,d,o,n,b,t), word1
makeBoundIntVar(p,"gerald",0,999999),
word2 makeBoundIntVar(p,"donald",0,999999),
word3 makeBoundIntVar(p,"robert",0,999999)
in (for i in (1 .. 9) for j in (i
1 .. 10) post(p,lettersi !
lettersj), post(p, list(100000,10000,100
0,100,10,1) scalar list(g,e,r,a,l,d) word1),
post(p, list(100000,10000,1000,100,10,1)
scalar list(d,o,n,a,l,d) word2),
post(p, list(100000,10000,1000,100,10,1) scalar
list(r,o,b,e,r,t) word3), post(p,
word1 word2 word3), p)
6(No Transcript)