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 "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
00053 distinct(this, le, opt.icl);
00054
00055 branch(this, le, BVAR_SIZE_MIN, BVAL_MIN);
00056 }
00057
00058 Donald(bool share, Donald& s) : Example(share,s) {
00059 le.update(this, share, s.le);
00060 }
00061
00062 virtual Space*
00063 copy(bool share) {
00064 return new Donald(share,*this);
00065 }
00066
00067 virtual void
00068 print(void) {
00069 std::cout << "\t";
00070 for (int i = 0; i < nl; i++)
00071 std::cout << le[i] << ' ';
00072 std::cout << std::endl;
00073 }
00074
00075 };
00076
00077
00081 int
00082 main(int argc, char** argv) {
00083 Options opt("Donald+Gerald=Robert");
00084 opt.solutions = 0;
00085 opt.iterations = 1500;
00086 opt.parse(argc,argv);
00087 Example::run<Donald,DFS>(opt);
00088 return 0;
00089 }
00090
00091
00092