52 static const int nl = 8;
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);
135 opt.iterations(20000);
137 Script::run<Money,DFS,Options>(
opt);
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Base-class for branchers.
Parametric base-class for scripts.
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.
static const int nl
Number of letters.
virtual Space * copy(void)
Copy during cloning.
Money(Money &s)
Constructor for cloning s.
@ MODEL_CARRY
Use carries.
@ MODEL_SINGLE
Use single linear equation.
Money(const Options &opt)
Actual model.
virtual void print(std::ostream &os) const
Print solution.
void parse(int argc, char *argv[])
Parse commandline arguments.
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te=(TE_INIT|TE_PRUNE|TE_FIX|TE_FAIL|TE_DONE), FloatTracer &t=StdFloatTracer::def)
Create a tracer for float variables.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
Gecode toplevel namespace
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Post propagator for for all .
Post propagator for SetVar SetOpType SetVar y
IntValBranch INT_VAL_MIN(void)
Select smallest value.
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr)
Select variable with smallest domain size.
Gecode::IntArgs i({1, 2, 3, 4})
#define GECODE_NEVER
Assert that this command is never executed.