this repo has no description
1% RUNS ON mzn20_fd
2% RUNS ON mzn-fzn_fd
3% RUNS ON mzn20_fd_linear
4% RUNS ON mzn20_mip
5%-----------------------------------------------------------------------------
6% Alphabet puzzle, a well-known cryptoarithmetic puzzle
7%
8% Guido Tack, tack@gecode.org
9% 2007-02-22
10%
11% Ported from the Gecode example
12%
13%-----------------------------------------------------------------------------
14
15include "globals.mzn";
16
17var 1..26: a;
18var 1..26: b;
19var 1..26: c;
20var 1..26: d;
21var 1..26: e;
22var 1..26: f;
23var 1..26: g;
24var 1..26: h;
25var 1..26: i;
26var 1..26: j;
27var 1..26: k;
28var 1..26: l;
29var 1..26: m;
30var 1..26: n;
31var 1..26: o;
32var 1..26: p;
33var 1..26: q;
34var 1..26: r;
35var 1..26: s;
36var 1..26: t;
37var 1..26: u;
38var 1..26: v;
39var 1..26: w;
40var 1..26: x;
41var 1..26: y;
42var 1..26: z;
43
44constraint
45 b+a+l+l+e+t = 45 /\
46 c+e+l+l+o = 43 /\
47 c+o+n+c+e+r+t = 74 /\
48 f+l+u+t+e = 30 /\
49 f+u+g+u+e = 50 /\
50 g+l+e+e = 66 /\
51 j+a+z+z = 58 /\
52 l+y+r+e = 47 /\
53 o+b+o+e = 53 /\
54 o+p+e+r+a = 65 /\
55 p+o+l+k+a = 59 /\
56 q+u+a+r+t+e+t = 50 /\
57 s+a+x+o+p+h+o+n+e = 134 /\
58 s+c+a+l+e = 51 /\
59 s+o+l+o = 37 /\
60 s+o+n+g = 61 /\
61 s+o+p+r+a+n+o = 82 /\
62 t+h+e+m+e = 72 /\
63 v+i+o+l+i+n = 100 /\
64 w+a+l+t+z = 34;
65
66constraint
67 alldifferent([a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]);
68
69solve satisfy;
70
71output [
72 "a = ", show(a),
73 "\tb = ", show(b),
74 "\tc = ", show(c),
75 "\td = ", show(d),
76 "\te = ", show(e),
77 "\tf = ", show(f),
78 "\ng = ", show(g),
79 "\th = ", show(h),
80 "\ti = ", show(i),
81 "\tj = ", show(j),
82 "\tk = ", show(k),
83 "\tl = ", show(l),
84 "\nm = ", show(m),
85 "\tn = ", show(n),
86 "\to = ", show(o),
87 "\tp = ", show(p),
88 "\tq = ", show(q),
89 "\tr = ", show(r),
90 "\ns = ", show(s),
91 "\tt = ", show(t),
92 "\tu = ", show(u),
93 "\tv = ", show(v),
94 "\tw = ", show(w),
95 "\tx = ", show(x),
96 "\ny = ", show(y),
97 "\tz = ", show(z),
98 "\n"
99];