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 #include "test/cpltset.hh"
00038
00039 using namespace Gecode;
00040 using namespace Test::Set;
00041
00042 namespace Test { namespace CpltSet {
00043
00045 namespace Rel {
00046
00052
00053 static const int d1r[4][2] = {
00054 {-4,-3},{-1,-1},{1,1},{3,5}
00055 };
00056 static IntSet d1(d1r,4);
00057
00058 static IntSet ds_33(-3,3);
00059 static IntSet ds_4(4,4);
00060 static IntSet ds_13(1,3);
00061
00063 class CpltSetRelLe : public CpltSetTest {
00064 public:
00066 CpltSetRelLe(const char* t) : CpltSetTest(t,2,ds_13,false) {}
00067
00069 virtual bool solution(const SetAssignment& x) const {
00070 CountableSetValues xr1(x.lub, x[0]);
00071 CountableSetValues xr2(x.lub, x[1]);
00072
00073 int a = (iter2int(xr1, 3));
00074 int b = (iter2int(xr2, 3));
00075 return a < b;
00076 }
00078 virtual void post(Space* home, CpltSetVarArray& x, IntVarArray&) {
00079
00080 Gecode::rel(home, x[0], SRT_LE, x[1]);
00081 }
00082 };
00083 CpltSetRelLe _cpltsetrelle("Rel::Le");
00084
00086 class CpltSetRelLq : public CpltSetTest {
00087 public:
00089 CpltSetRelLq(const char* t) : CpltSetTest(t,2,ds_13,false) {}
00090
00092 virtual bool solution(const SetAssignment& x) const {
00093 CountableSetValues xr1(x.lub, x[0]);
00094 CountableSetValues xr2(x.lub, x[1]);
00095
00096 int a = (iter2int(xr1, 3));
00097 int b = (iter2int(xr2, 3));
00098 return a <= b;
00099 }
00101 virtual void post(Space* home, CpltSetVarArray& x, IntVarArray&) {
00102
00103 Gecode::rel(home, x[0], SRT_LQ, x[1]);
00104 }
00105 };
00106 CpltSetRelLq _cpltsetrellq("Rel::Lq");
00107
00109 class CpltSetRelLeDiff : public CpltSetTest {
00110 public:
00112 CpltSetRelLeDiff(const char* t) : CpltSetTest(t,2,ds_33,false) {}
00114 virtual bool solution(const SetAssignment& x) const {
00115 CountableSetValues xr1(x.lub, x[0]);
00116 CountableSetValues xr2(x.lub, x[1]);
00117
00118 int a = (iter2int(xr1,3));
00119 int b = (iter2int(xr2,3));
00120 return a < b;
00121 }
00123 virtual void post(Space* home, CpltSetVarArray& x, IntVarArray&) {
00124
00125 Gecode::dom(home, x[0], SRT_DISJ, ds_13);
00126 Gecode::dom(home, x[1], SRT_SUB, ds_13);
00127 Gecode::rel(home, x[0], SRT_LE, x[1]);
00128 }
00129 };
00130 CpltSetRelLe _cpltsetrellediff("Rel::Le::Diff");
00131
00133 class CpltSetRelDisj : public CpltSetTest {
00134 public:
00136 CpltSetRelDisj(const char* t) : CpltSetTest(t,2,ds_13,false) {}
00137
00139 virtual bool solution(const SetAssignment& x) const {
00140 CountableSetRanges xr1(x.lub, x[0]);
00141 CountableSetRanges xr2(x.lub, x[1]);
00142 Gecode::Iter::Ranges::Inter<CountableSetRanges, CountableSetRanges>
00143 inter(xr1, xr2);
00144 return !inter();
00145 }
00147 virtual void post(Space* home, CpltSetVarArray& x, IntVarArray&) {
00148
00149 Gecode::rel(home, x[0], SRT_DISJ, x[1]);
00150 }
00151 };
00152 CpltSetRelDisj _cpltsetreldisj("Rel::Disj");
00153
00155
00156 }}}
00157
00158