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

bool.hh

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2002
00008  *     Guido Tack, 2004
00009  *
00010  *  Last modified:
00011  *     $Date: 2006-09-05 21:48:13 +0200 (Tue, 05 Sep 2006) $ by $Author: schulte $
00012  *     $Revision: 3600 $
00013  *
00014  *  This file is part of Gecode, the generic constraint
00015  *  development environment:
00016  *     http://www.gecode.org
00017  *
00018  *  See the file "LICENSE" for information on usage and
00019  *  redistribution of this file, and for a
00020  *     DISCLAIMER OF ALL WARRANTIES.
00021  *
00022  */
00023 
00024 #ifndef __GECODE_INT_BOOL_HH__
00025 #define __GECODE_INT_BOOL_HH__
00026 
00027 #include "gecode/int.hh"
00028 
00034 namespace Gecode { namespace Int { namespace Bool {
00035 
00036   /*
00037    * Base Classes
00038    *
00039    */
00040 
00042   template<class BVA, class BVB>
00043   class BoolBinary : public Propagator {
00044   protected:
00045     BVA x0; 
00046     BVB x1; 
00047 
00048     BoolBinary(Space* home, BVA b0, BVB b1);
00050     BoolBinary(Space* home, bool share, BoolBinary& p);
00052     BoolBinary(Space* home, bool share, Propagator& p,
00053                BVA b0, BVB b1);
00054   public:
00056     virtual PropCost cost(void) const;
00058     virtual size_t dispose(Space* home);
00059   };
00060 
00062   template<class BVA, class BVB, class BVC>
00063   class BoolTernary : public Propagator {
00064   protected:
00065     BVA x0; 
00066     BVB x1; 
00067     BVC x2; 
00068 
00069     BoolTernary(Space* home, BVA b0, BVB b1, BVC b2);
00071     BoolTernary(Space* home, bool share, BoolTernary& p);
00072   public:
00074     BoolTernary(Space* home, bool share, Propagator& p,
00075                 BVA b0, BVB b1, BVC b2);
00077     virtual PropCost cost(void) const;
00079     virtual size_t dispose(Space* home);
00080   };
00081 
00088   template<class BVA, class BVB>
00089   class Eq : public BoolBinary<BVA,BVB> {
00090   protected:
00091     using BoolBinary<BVA,BVB>::x0;
00092     using BoolBinary<BVA,BVB>::x1;
00094     Eq(Space* home, BVA b0, BVB b1);
00096     Eq(Space* home, bool share, Eq& p);
00097   public:
00099     Eq(Space* home, bool share, Propagator& p,
00100        BVA b0, BVB b1);
00102     virtual Actor* copy(Space* home, bool share);
00104     virtual ExecStatus propagate(Space* home);
00106     static  ExecStatus post(Space* home, BVA b0, BVB b1);
00107   };
00108 
00109 
00116   template<class BVA, class BVB>
00117   class OrTrue : public BoolBinary<BVA,BVB> {
00118   protected:
00119     using BoolBinary<BVA,BVB>::x0;
00120     using BoolBinary<BVA,BVB>::x1;
00122     OrTrue(Space* home, BVA b0, BVB b1);
00124     OrTrue(Space* home, bool share, OrTrue& p);
00125   public:
00127     OrTrue(Space* home, bool share, Propagator& p,
00128              BVA b0, BVB b1);
00130     virtual Actor* copy(Space* home, bool share);
00132     virtual ExecStatus propagate(Space* home);
00134     static  ExecStatus post(Space* home, BVA b0, BVB b1);
00135   };
00136 
00143   template<class BVA, class BVB, class BVC>
00144   class Or : public BoolTernary<BVA,BVB,BVC> {
00145   protected:
00146     using BoolTernary<BVA,BVB,BVC>::x0;
00147     using BoolTernary<BVA,BVB,BVC>::x1;
00148     using BoolTernary<BVA,BVB,BVC>::x2;
00150     Or(Space* home, BVA b0, BVB b1, BVC b2);
00152     Or(Space* home, bool share, Or& p);
00153   public:
00155     Or(Space* home, bool share, Propagator& p, BVA b0, BVB b1, BVC b2);
00157     virtual Actor* copy(Space* home, bool share);
00159     virtual ExecStatus propagate(Space* home);
00161     static  ExecStatus post(Space* home, BVA b0, BVB b1, BVC b2);
00162   };
00163 
00170   template<class View>
00171   class NaryOr : public NaryOnePropagator<View,PC_INT_VAL> {
00172   protected:
00173     using NaryOnePropagator<View,PC_INT_VAL>::x;
00174     using NaryOnePropagator<View,PC_INT_VAL>::y;
00176     NaryOr(Space* home,  ViewArray<View>& b, View c);
00178     NaryOr(Space* home, bool share, NaryOr<View>& p);
00179   public:
00181     virtual Actor* copy(Space* home, bool share);
00183     virtual ExecStatus propagate(Space* home);
00185     static  ExecStatus post(Space* home, ViewArray<View>& b, View c);
00186   };
00187 
00188 
00195   template<class View>
00196   class NaryOrTrue : public BinaryPropagator<View,PC_INT_VAL> {
00197   protected:
00198     using BinaryPropagator<View,PC_INT_VAL>::x0;
00199     using BinaryPropagator<View,PC_INT_VAL>::x1;
00201     ViewArray<View> x;
00203     ExecStatus resubscribe(Space* home, View& x0, View x1);
00205     NaryOrTrue(Space* home,  ViewArray<View>& b);
00207     NaryOrTrue(Space* home, bool share, NaryOrTrue<View>& p);
00208   public:
00210     virtual Actor* copy(Space* home, bool share);
00212     virtual PropCost cost(void) const;
00214     virtual ExecStatus propagate(Space* home);
00216     static  ExecStatus post(Space* home, ViewArray<View>& b);
00217   };
00218 
00219 
00226   template<class BVA, class BVB, class BVC>
00227   class Eqv : public BoolTernary<BVA,BVB,BVC> {
00228   protected:
00229     using BoolTernary<BVA,BVB,BVC>::x0;
00230     using BoolTernary<BVA,BVB,BVC>::x1;
00231     using BoolTernary<BVA,BVB,BVC>::x2;
00233     Eqv(Space* home, bool share, Eqv& p);
00235     Eqv(Space* home, BVA b0 ,BVB b1, BVC b2);
00236   public:
00238     virtual Actor* copy(Space* home, bool share);
00240     virtual ExecStatus propagate(Space* home);
00242     static  ExecStatus post(Space* home, BVA b0, BVB b1, BVC b2);
00243   };
00244 
00245 }}}
00246 
00247 #include "gecode/int/bool/base.icc"
00248 #include "gecode/int/bool/eq.icc"
00249 #include "gecode/int/bool/or.icc"
00250 #include "gecode/int/bool/eqv.icc"
00251 
00252 #endif
00253 
00254 // STATISTICS: int-prop
00255