00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "gecode/int/dom.hh"
00024
00025 namespace Gecode {
00026
00027 using namespace Int;
00028
00029 void
00030 dom(Space* home, IntVar x, int min, int max, IntConLevel) {
00031 if (home->failed()) return;
00032 IntView xv(x);
00033 GECODE_ME_FAIL(home,xv.gq(home,min));
00034 GECODE_ME_FAIL(home,xv.lq(home,max));
00035 }
00036
00037 void
00038 dom(Space* home, IntVarArgs& x, int min, int max, IntConLevel) {
00039 if (home->failed()) return;
00040 for (int i=x.size(); i--; ) {
00041 IntView xv(x[i]);
00042 GECODE_ME_FAIL(home,xv.gq(home,min));
00043 GECODE_ME_FAIL(home,xv.lq(home,max));
00044 }
00045 }
00046
00047 void
00048 dom(Space* home, IntVar x, const IntSet& is, IntConLevel) {
00049 if (home->failed()) return;
00050 IntView xv(x);
00051 IntSetRanges ris(is);
00052 GECODE_ME_FAIL(home,xv.inter(home,ris));
00053 }
00054
00055 void
00056 dom(Space* home, IntVarArgs& x, const IntSet& is, IntConLevel) {
00057 if (home->failed()) return;
00058 for (int i = x.size(); i--; ) {
00059 IntSetRanges ris(is);
00060 IntView xv(x[i]);
00061 GECODE_ME_FAIL(home,xv.inter(home,ris));
00062 }
00063 }
00064
00065 void
00066 dom(Space* home, IntVar x, int min, int max, BoolVar b, IntConLevel) {
00067 if (home->failed()) return;
00068 GECODE_ES_FAIL(home,Dom::ReRange<IntView>::post(home,x,min,max,b));
00069 }
00070
00071
00072 void
00073 dom(Space* home, IntVar x, const IntSet& is, BoolVar b, IntConLevel) {
00074 if (home->failed()) return;
00075 GECODE_ES_FAIL(home,Dom::ReIntSet<IntView>::post(home,x,is,b));
00076 }
00077
00078 }
00079
00080
00081