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

atmostOne.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2004
00007  *
00008  *  Last modified:
00009  *     $Date: 2005-11-24 18:03:01 +0100 (Thu, 24 Nov 2005) $ by $Author: tack $
00010  *     $Revision: 2639 $
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 namespace Gecode { namespace Set { namespace Distinct {
00023 
00024   /*
00025    * "AtMostOneIntersection" propagator
00026    *
00027    */
00028 
00029   forceinline
00030   AtmostOne::AtmostOne(Space* home, ViewArray<SetView>& x, unsigned int _c)
00031     : NaryPropagator<SetView, PC_SET_ANY>(home,x), c(_c) {}
00032 
00033   forceinline
00034   AtmostOne::AtmostOne(Space* home, bool share, AtmostOne& p)
00035     : NaryPropagator<SetView, PC_SET_ANY>(home,share,p), c(p.c) {}
00036 
00037   forceinline ExecStatus
00038   AtmostOne::post(Space* home, ViewArray<SetView> x, unsigned int c) {
00039     for (int i=x.size(); i--;) {
00040       GECODE_ES_CHECK(x[i].cardMin(home, c));
00041       GECODE_ES_CHECK(x[i].cardMax(home, c));
00042     }
00043 
00044     (void) new (home) AtmostOne(home,x,c);
00045     return ES_OK;
00046   }
00047 
00048 }}}
00049 
00050 // STATISTICS: set-prop