56 static const int nl = 8;
68 s(le[0]), e(le[1]),
n(le[2]),
d(le[3]),
69 m(le[4]), o(le[5]),
r(le[6]), y(le[7]);
76 switch (opt.
model()) {
78 rel(*
this, 1000*s+100*e+10*
n+
d
80 == 10000*m+1000*o+100*
n+10*e+y,
85 IntVar c0(*
this,0,1), c1(*
this,0,1), c2(*
this,0,1), c3(*
this,0,1);
86 rel(*
this,
d+e == y+10*c0, opt.
icl());
87 rel(*
this, c0+
n+
r == e+10*c1, opt.
icl());
88 rel(*
this, c1+e+o ==
n+10*c2, opt.
icl());
89 rel(*
this, c2+s+m == o+10*c3, opt.
icl());
90 rel(*
this, c3 == m, opt.
icl());
101 os <<
"\t" << le << std::endl;
111 return new Money(share,*
this);
126 opt.
parse(argc,argv);
127 Script::run<Money,DFS,Options>(
opt);
int main(int argc, char *argv[])
Main-function.
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Money(bool share, Money &s)
Constructor for cloning s.
Money(const Options &opt)
Actual model.
Parametric base-class for scripts.
void iterations(unsigned int i)
Set default number of iterations.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
int n
Number of negative literals for node type.
IntVarArray le
Array of letters.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
void distinct(Home home, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
void solutions(unsigned int n)
Set default number of solutions to search for.
Example: SEND+MORE=MONEY puzzle
void model(int v)
Set default model value.
Gecode toplevel namespace
virtual Space * copy(bool share)
Copy during cloning.
BrancherHandle branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
Use single linear equation.
#define GECODE_NEVER
Assert that this command is never executed.
void icl(IntConLevel i)
Set default integer consistency level.
virtual void print(std::ostream &os) const
Print solution.