Generated on Wed Nov 1 15:04:33 2006 for Gecode by doxygen 1.4.5

dom.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2004
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-04-11 15:58:37 +0200 (Tue, 11 Apr 2006) $ by $Author: tack $
00010  *     $Revision: 3188 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
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 // STATISTICS: int-post
00081