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

spec.icc

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-07-19 14:57:38 +0200 (Wed, 19 Jul 2006) $ by $Author: schulte $
00010  *     $Revision: 3413 $
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 Int { namespace Dom {
00023 
00024   template <class View>
00025   forceinline
00026   ReIntSet<View>::ReIntSet
00027   (Space* home, View x, const IntSet& s, BoolView b)
00028     : ReUnaryPropagator<View,PC_INT_DOM,BoolView>(home,x,b,true), is(s) {}
00029 
00030   template <class View>
00031   ExecStatus
00032   ReIntSet<View>::post(Space* home, View x, const IntSet& s, BoolView b) {
00033     if (s.size() == 0) {
00034       GECODE_ME_CHECK(b.t_zero(home));
00035     } else if (s.size() == 1) {
00036       return ReRange<View>::post(home,x,s.min(),s.max(),b);
00037     } else {
00038       (void) new (home) ReIntSet<View>(home,x,s,b);
00039     }
00040     return ES_OK;
00041   }
00042 
00043 
00044   template <class View>
00045   forceinline
00046   ReIntSet<View>::ReIntSet(Space* home, bool share, ReIntSet& p)
00047     : ReUnaryPropagator<View,PC_INT_DOM,BoolView>(home,share,p) {
00048     is.update(share,p.is);
00049   }
00050 
00051   template <class View>
00052   Actor*
00053   ReIntSet<View>::copy(Space* home, bool share) {
00054     return new (home) ReIntSet(home,share,*this);
00055   }
00056 
00057   template <class View>
00058   ExecStatus
00059   ReIntSet<View>::propagate(Space* home) {
00060     IntSetRanges i_is(is);
00061     if (b.one()) {
00062       GECODE_ME_CHECK(x0.inter(home,i_is)); return ES_SUBSUMED;
00063     }
00064     if (b.zero()) {
00065       GECODE_ME_CHECK(x0.minus(home,i_is)); return ES_SUBSUMED;
00066     }
00067 
00068     ViewRanges<View> i_x(x0);
00069 
00070     switch (Iter::Ranges::subsumes(i_is,i_x)) {
00071     case Iter::Ranges::SS_SUBSUMED:
00072       b.t_one_none(home); return ES_SUBSUMED;
00073     case Iter::Ranges::SS_EMPTY:
00074       b.t_zero_none(home); return ES_SUBSUMED;
00075     case Iter::Ranges::SS_NONE:
00076       break;
00077     default: GECODE_NEVER;
00078     }
00079     return ES_FIX;
00080   }
00081 
00082 }}}
00083 
00084 // STATISTICS: int-prop
00085