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

cardinality.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Gabor Szokoli <szokoli@gecode.org>
00004  *     Guido Tack <tack@gecode.org>
00005  *     Christian Schulte <schulte@gecode.org>
00006  *
00007  *  Copyright:
00008  *     Gabor Szokoli, 2004
00009  *     Guido Tack, 2004
00010  *     Christian Schulte, 2004
00011  *
00012  *  Last modified:
00013  *     $Date: 2006-04-11 15:58:37 +0200 (Tue, 11 Apr 2006) $ by $Author: tack $
00014  *     $Revision: 3188 $
00015  *
00016  *  This file is part of Gecode, the generic constraint
00017  *  development environment:
00018  *     http://www.gecode.org
00019  *
00020  *  See the file "LICENSE" for information on usage and
00021  *  redistribution of this file, and for a
00022  *     DISCLAIMER OF ALL WARRANTIES.
00023  *
00024  */
00025 
00026 
00027 
00028 #include "gecode/set.hh"
00029 #include "gecode/set/int.hh"
00030 
00031 namespace Gecode {
00032 
00033   void
00034   cardinality(Space* home, SetVar x, unsigned int i, unsigned int j) {
00035     if (home->failed()) return;
00036     Set::SetView _x(x);
00037     GECODE_ME_FAIL(home,_x.cardMin(home, i));
00038     GECODE_ME_FAIL(home,_x.cardMax(home, j));
00039   }
00040 
00041   void
00042   cardinality(Space* home, SetVar s, IntVar x) {
00043     if (home->failed()) return;
00044     GECODE_ES_FAIL(home,Set::Int::Card::post(home,s, x));
00045   }
00046 
00047 }
00048 
00049 // STATISTICS: set-post