int.hh
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
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __GECODE_TEST_INT_HH__
00041 #define __GECODE_TEST_INT_HH__
00042
00043 #include "test/test.hh"
00044
00045 #include "gecode/int.hh"
00046
00047 namespace Test {
00048
00050 namespace Int {
00051
00062
00063 class Assignment {
00064 protected:
00065 int n;
00066 Gecode::IntSet d;
00067 public:
00069 Assignment(int n0, const Gecode::IntSet& d0);
00071 virtual bool operator()(void) const = 0;
00073 virtual void operator++(void) = 0;
00075 virtual int operator[](int i) const = 0;
00077 int size(void) const;
00079 virtual ~Assignment(void);
00080 };
00081
00083 class CpltAssignment : public Assignment {
00084 protected:
00085 Gecode::IntSetValues* dsv;
00086 public:
00088 CpltAssignment(int n, const Gecode::IntSet& d);
00090 virtual bool operator()(void) const;
00092 virtual void operator++(void);
00094 virtual int operator[](int i) const;
00096 virtual ~CpltAssignment(void);
00097 };
00098
00100 class RandomAssignment : public Assignment {
00101 protected:
00102 int* vals;
00103 int a;
00104
00105 int randval(void);
00106 public:
00108 RandomAssignment(int n, const Gecode::IntSet& d, int a);
00110 virtual bool operator()(void) const;
00112 virtual void operator++(void);
00114 virtual int operator[](int i) const;
00116 virtual ~RandomAssignment(void);
00117 };
00118
00123 class Test : public Base {
00124 protected:
00126 int arity;
00128 Gecode::IntSet dom;
00130 bool reified;
00132 Gecode::IntConLevel icl;
00134 Gecode::PropKind pk;
00136 bool testdomcon;
00138 bool testsearch;
00139
00140 public:
00149 Test(const std::string& s, int a, const Gecode::IntSet& d, bool r=false,
00150 Gecode::IntConLevel i=Gecode::ICL_DEF,
00151 Gecode::PropKind p=Gecode::PK_DEF);
00160 Test(const std::string& s, int a, int min, int max, bool r=false,
00161 Gecode::IntConLevel i=Gecode::ICL_DEF,
00162 Gecode::PropKind p=Gecode::PK_DEF);
00164 virtual Assignment* assignment(void) const;
00166 virtual bool solution(const Assignment&) const = 0;
00168 virtual bool ignore(const Assignment&) const;
00170 virtual void post(Gecode::Space* home, Gecode::IntVarArray& x) = 0;
00172 virtual void post(Gecode::Space* home, Gecode::IntVarArray& x,
00173 Gecode::BoolVar b);
00175 virtual bool run(void);
00177
00178
00179 static std::string str(Gecode::PropKind pk);
00181 static std::string str(Gecode::IntConLevel icl);
00183 static std::string str(Gecode::IntRelType pk);
00185 static std::string str(Gecode::BoolOpType bot);
00187 static std::string str(int i);
00189
00190
00191
00192 template <class T> static bool cmp(T x, Gecode::IntRelType r, T y);
00194 };
00196
00198 class IntConLevels {
00199 private:
00201 static const Gecode::IntConLevel icls[3];
00203 int i;
00204 public:
00206 IntConLevels(void);
00208 bool operator()(void) const;
00210 void operator++(void);
00212 Gecode::IntConLevel icl(void) const;
00213 };
00214
00216 class IntRelTypes {
00217 private:
00219 static const Gecode::IntRelType irts[6];
00221 int i;
00222 public:
00224 IntRelTypes(void);
00226 void reset(void);
00228 bool operator()(void) const;
00230 void operator++(void);
00232 Gecode::IntRelType irt(void) const;
00233 };
00234
00236 class BoolOpTypes {
00237 private:
00239 static const Gecode::BoolOpType bots[5];
00241 int i;
00242 public:
00244 BoolOpTypes(void);
00246 bool operator()(void) const;
00248 void operator++(void);
00250 Gecode::BoolOpType bot(void) const;
00251 };
00252
00253 }
00254 }
00255
00260 std::ostream& operator<<(std::ostream& os, const Test::Int::Assignment& a);
00261
00262 #include "test/int.icc"
00263
00264 #endif
00265
00266
00267