38 using namespace Gecode;
52 static const int nl = 8;
64 s(le[0]), e(le[1]),
n(le[2]),
d(le[3]),
65 m(le[4]), o(le[5]),
r(le[6]),
y(le[7]);
77 switch (
opt.model()) {
79 rel(*
this, 1000*s+100*e+10*
n+
d
81 == 10000*m+1000*o+100*
n+10*e+
y,
86 IntVar c0(*
this,0,1), c1(*
this,0,1), c2(*
this,0,1), c3(*
this,0,1);
87 rel(*
this,
d+e ==
y+10*c0,
opt.ipl());
88 rel(*
this, c0+
n+
r == e+10*c1,
opt.ipl());
89 rel(*
this, c1+e+o ==
n+10*c2,
opt.ipl());
90 rel(*
this, c2+s+m == o+10*c3,
opt.ipl());
91 rel(*
this, c3 == m,
opt.ipl());
101 static char name[8] = {
's',
'e',
'n',
'd',
104 << ((
a == 0) ?
" = " :
" != ")
111 os <<
"\t" << le << std::endl;
121 return new Money(*
this);
137 Script::run<Money,DFS,Options>(
opt);
int n
Number of negative literals for node type.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Base-class for branchers.
Parametric base-class for scripts.
void iterations(unsigned int i)
Set default number of iterations.
void solutions(unsigned int n)
Set default number of solutions to search for.
void model(int v)
Set default model value.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
Example: SEND+MORE=MONEY puzzle
int main(int argc, char *argv[])
Main-function.
IntVarArray le
Array of letters.
Money(Money &s)
Constructor for cloning s.
@ MODEL_CARRY
Use carries.
@ MODEL_SINGLE
Use single linear equation.
virtual Space * copy(void)
Copy during cloning.
Money(const Options &opt)
Actual model.
virtual void print(std::ostream &os) const
Print solution.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
Post propagator for SetVar SetOpType SetVar y
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
IntValBranch INT_VAL_MIN(void)
Select smallest value.
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Gecode::IntArgs i({1, 2, 3, 4})
#define GECODE_NEVER
Assert that this command is never executed.