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]);
81 switch (
opt.model()) {
83 rel(*
this, 1000*s+100*e+10*
n+
d 85 == 10000*m+1000*o+100*
n+10*e+
y,
90 IntVar c0(*
this,0,1), c1(*
this,0,1), c2(*
this,0,1), c3(*
this,0,1);
91 rel(*
this,
d+e ==
y+10*c0,
opt.ipl());
92 rel(*
this, c0+
n+
r == e+10*c1,
opt.ipl());
93 rel(*
this, c1+e+o ==
n+10*c2,
opt.ipl());
94 rel(*
this, c2+s+m == o+10*c3,
opt.ipl());
95 rel(*
this, c3 == m,
opt.ipl());
106 os <<
"\t" << le << std::endl;
116 return new Money(share,*
this);
132 Script::run<Money,DFS,Options>(
opt);
int main(int argc, char *argv[])
Main-function.
void 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.
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.
virtual void print(std::ostream &os) const
Print solution.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
Post propagator for SetVar SetOpType SetVar SetRelType r
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
Post propagator for SetVar SetOpType SetVar y
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
void solutions(unsigned int n)
Set default number of solutions to search for.
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
Example: SEND+MORE=MONEY puzzle
void model(int v)
Set default model value.
Gecode toplevel namespace
virtual Space * copy(bool share)
Copy during cloning.
#define GECODE_NEVER
Assert that this command is never executed.