donald.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "examples/support.hh"
00023 #include "gecode/minimodel.hh"
00024
00033 class Donald : public Example {
00034 private:
00036 static const int nl = 10;
00038 IntVarArray le;
00039 public:
00040 Donald(const Options& opt) :
00041 le(this,nl,0,9) {
00042 IntVar
00043 d(le[0]), o(le[1]), n(le[2]), a(le[3]), l(le[4]),
00044 g(le[5]), e(le[6]), r(le[7]), b(le[8]), t(le[9]);
00045 rel(this, d, IRT_NQ, 0);
00046 rel(this, g, IRT_NQ, 0);
00047 rel(this, r, IRT_NQ, 0);
00048
00049 post(this, 100000*d+10000*o+1000*n+100*a+10*l+d
00050 + 100000*g+10000*e+1000*r+100*a+10*l+d
00051 == 100000*r+10000*o+1000*b+100*e+10*r+t,
00052 opt.icl);
00053
00054 distinct(this, le, opt.icl);
00055
00056 branch(this, le, BVAR_SIZE_MIN, BVAL_MIN);
00057 }
00058
00059 Donald(bool share, Donald& s) : Example(share,s) {
00060 le.update(this, share, s.le);
00061 }
00062
00063 virtual Space*
00064 copy(bool share) {
00065 return new Donald(share,*this);
00066 }
00067
00068 virtual void
00069 print(void) {
00070 std::cout << "\t";
00071 for (int i = 0; i < nl; i++)
00072 std::cout << le[i] << ' ';
00073 std::cout << std::endl;
00074 }
00075
00076 };
00077
00078
00082 int
00083 main(int argc, char** argv) {
00084 Options opt("Donald+Gerald=Robert");
00085 opt.solutions = 0;
00086 opt.iterations = 1500;
00087 opt.parse(argc,argv);
00088 Example::run<Donald,DFS>(opt);
00089 return 0;
00090 }
00091
00092
00093