cpltset.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 #ifndef __GECODE_TEST_CPLTSET_HH__
00040 #define __GECODE_TEST_CPLTSET_HH__
00041
00042 #include "gecode/cpltset.hh"
00043
00044 #include "test/test.hh"
00045 #include "test/set.hh"
00046 #include "test/int.hh"
00047
00048 namespace Test {
00049
00051 namespace CpltSet {
00052
00063
00068 class CpltSetTest : public Base {
00069 private:
00070 int arity;
00071 Gecode::IntSet lub;
00072 bool reified;
00073 int withInt;
00074 int ivs;
00075 int ics;
00076
00077 void removeFromLub(int, Gecode::CpltSetVar&, int,
00078 const Gecode::IntSet&);
00079 void addToGlb(int, Gecode::CpltSetVar&, int, const Gecode::IntSet&);
00080 public:
00081 CpltSetTest(const std::string& s, int a, const Gecode::IntSet& d,
00082 bool r=false, int w=0, int mn=10000, int mc=1000)
00083 : Base("CpltSet::"+s), arity(a), lub(d), reified(r), withInt(w),
00084 ivs(mn), ics(mc) {
00085 Gecode::CpltSet::manager.dispose();
00086 Gecode::CpltSet::manager.init(mn, mc);
00087 }
00088
00090 virtual bool solution(const Test::Set::SetAssignment&) const = 0;
00092 virtual void post(Gecode::Space* home, Gecode::CpltSetVarArray& x,
00093 Gecode::IntVarArray& y) = 0;
00095 virtual void post(Gecode::Space*, Gecode::CpltSetVarArray&,
00096 Gecode::IntVarArray&, Gecode::BoolVar) {}
00098 virtual bool run(void);
00099
00100 template <class I>
00101 int iter2int(I& r, int) const{
00102 if (!r()) {
00103 return 0;
00104 }
00105 int v = 0;
00106
00107
00108 while(r()) {
00109 v |= (1 << r.val());
00110 ++r;
00111 }
00112 return v;
00113 }
00114
00116 int varsize(void) { return ivs; }
00117 int cachesize(void) { return ics; }
00118
00119 };
00121 }}
00122
00123 #endif
00124
00125