Generated on Thu Jul 6 07:06:46 2006 for Gecode by doxygen 1.4.7

nq.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: 2005-10-27 21:01:30 +0200 (Thu, 27 Oct 2005) $ by $Author: schulte $
00010  *     $Revision: 2420 $
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 Rel {
00023 
00024   /*
00025    * Disequality
00026    *
00027    */
00028 
00029   template <class View>
00030   forceinline
00031   Nq<View>::Nq(Space* home, View x0, View x1)
00032     : BinaryPropagator<View,PC_INT_VAL>(home,x0,x1) {}
00033 
00034   template <class View>
00035   ExecStatus
00036   Nq<View>::post(Space* home, View x0, View x1){
00037     if (x0.assigned()) {
00038       GECODE_ME_CHECK(x1.nq(home,x0.val()));
00039     } else if (x1.assigned()) {
00040       GECODE_ME_CHECK(x0.nq(home,x1.val()));
00041     } else if (same(x0,x1)) {
00042       return ES_FAILED;
00043     } else {
00044       (void) new (home) Nq<View>(home,x0,x1);
00045     }
00046     return ES_OK;
00047   }
00048 
00049   template <class View>
00050   forceinline
00051   Nq<View>::Nq(Space* home, bool share, Nq<View>& p)
00052     : BinaryPropagator<View,PC_INT_VAL>(home,share,p) {}
00053 
00054   template <class View>
00055   Actor*
00056   Nq<View>::copy(Space* home, bool share) {
00057     return new (home) Nq<View>(home,share,*this);
00058   }
00059 
00060   template <class View>
00061   PropCost
00062   Nq<View>::cost(void) const {
00063     return PC_UNARY_LO;
00064   }
00065 
00066   template <class View>
00067   ExecStatus
00068   Nq<View>::propagate(Space* home) {
00069     if (x0.assigned()) {
00070       GECODE_ME_CHECK(x1.nq(home,x0.val()));
00071     } else {
00072       GECODE_ME_CHECK(x0.nq(home,x1.val()));
00073     }
00074     return ES_SUBSUMED;
00075   }
00076 
00077 }}}
00078 
00079 // STATISTICS: int-prop
00080