Generated on Wed Jan 4 17:49:11 2006 for Gecode by doxygen 1.4.6

rel.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  *  Contributing authors:
00007  *     Gabor Szokoli <szokoli@gecode.org>
00008  *
00009  *  Copyright:
00010  *     Christian Schulte, 2002
00011  *     Guido Tack, 2004
00012  *     Gabor Szokoli, 2003
00013  *
00014  *  Last modified:
00015  *     $Date: 2005-10-27 21:01:30 +0200 (Thu, 27 Oct 2005) $ by $Author: schulte $
00016  *     $Revision: 2420 $
00017  *
00018  *  This file is part of Gecode, the generic constraint
00019  *  development environment:
00020  *     http://www.gecode.org
00021  *
00022  *  See the file "LICENSE" for information on usage and
00023  *  redistribution of this file, and for a
00024  *     DISCLAIMER OF ALL WARRANTIES.
00025  *
00026  */
00027 
00028 #ifndef __GECODE_INT_REL_HH__
00029 #define __GECODE_INT_REL_HH__
00030 
00031 #include "int.hh"
00032 
00033 #include "iter.hh"
00034 
00040 namespace Gecode { namespace Int { namespace Rel {
00041 
00042   /*
00043    * Equality propagators
00044    *
00045    */
00046 
00056   template <class View>
00057   class EqDom : public BinaryPropagator<View,PC_INT_DOM> {
00058   protected:
00059     using BinaryPropagator<View,PC_INT_DOM>::x0;
00060     using BinaryPropagator<View,PC_INT_DOM>::x1;
00061 
00063     EqDom(Space* home, bool share, EqDom<View>& p);
00065     EqDom(Space* home, View x0, View x1);
00066   public:
00068     virtual Actor* copy(Space* home, bool share);
00076     virtual PropCost cost(void) const;
00078     virtual ExecStatus propagate(Space* home);
00080     static  ExecStatus post(Space* home, View x0, View x1);
00081   };
00082 
00089   template <class View>
00090   class EqBnd : public BinaryPropagator<View,PC_INT_BND> {
00091   protected:
00092     using BinaryPropagator<View,PC_INT_BND>::x0;
00093     using BinaryPropagator<View,PC_INT_BND>::x1;
00094 
00096     EqBnd(Space* home, bool share, EqBnd<View>& p);
00098     EqBnd(Space* home, View x0, View x1);
00099   public:
00101     virtual Actor* copy(Space* home, bool share);
00103     virtual ExecStatus propagate(Space* home);
00105     static  ExecStatus post(Space* home, View x0, View x1);
00106   };
00107 
00117   template <class View>
00118   class NaryEqDom : public NaryPropagator<View,PC_INT_DOM> {
00119   protected:
00120     using NaryPropagator<View,PC_INT_DOM>::x;
00121 
00123     NaryEqDom(Space* home, bool share, NaryEqDom<View>& p);
00125     NaryEqDom(Space* home, ViewArray<View>&);
00126   public:
00128     virtual Actor* copy(Space* home, bool share);
00136     virtual PropCost cost(void) const;
00138     virtual ExecStatus propagate(Space* home);
00140     static  ExecStatus post(Space* home, ViewArray<View>& x);
00141   };
00142 
00149   template <class View>
00150   class NaryEqBnd : public NaryPropagator<View,PC_INT_BND> {
00151   protected:
00152     using NaryPropagator<View,PC_INT_BND>::x;
00153 
00155     NaryEqBnd(Space* home, bool share, NaryEqBnd<View>& p);
00157     NaryEqBnd(Space* home, ViewArray<View>&);
00158   public:
00160     virtual Actor* copy(Space* home, bool share);
00167     virtual PropCost cost(void) const;
00169     virtual ExecStatus propagate(Space* home);
00171     static  ExecStatus post(Space* home, ViewArray<View>& x);
00172   };
00173 
00180   template <class View, class CtrlView>
00181   class ReEqDom : public ReBinaryPropagator<View,PC_INT_DOM,CtrlView> {
00182   protected:
00183     using ReBinaryPropagator<View,PC_INT_DOM,CtrlView>::x0;
00184     using ReBinaryPropagator<View,PC_INT_DOM,CtrlView>::x1;
00185     using ReBinaryPropagator<View,PC_INT_DOM,CtrlView>::b;
00186 
00188     ReEqDom(Space* home, bool share, ReEqDom& p);
00190     ReEqDom(Space* home, View x0, View x1, CtrlView b);
00191   public:
00193     virtual Actor* copy(Space* home, bool share);
00195     virtual ExecStatus propagate(Space* home);
00197     static  ExecStatus post(Space* home, View x0, View x1, CtrlView b);
00198   };
00199 
00206   template <class View, class CtrlView>
00207   class ReEqBnd : public ReBinaryPropagator<View,PC_INT_BND,CtrlView> {
00208   protected:
00209     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00210     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x1;
00211     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::b;
00212 
00214     ReEqBnd(Space* home, bool share, ReEqBnd& p);
00216     ReEqBnd(Space* home, View x0, View x1, CtrlView b);
00217   public:
00219     virtual Actor*     copy(Space* home, bool share);
00221     virtual ExecStatus propagate(Space* home);
00223     static  ExecStatus post(Space* home, View x0, View x1, CtrlView b);
00224   };
00225 
00232   template <class View, class CtrlView>
00233   class ReEqDomInt : public ReUnaryPropagator<View,PC_INT_DOM,CtrlView> {
00234   protected:
00235     using ReUnaryPropagator<View,PC_INT_DOM,CtrlView>::x0;
00236     using ReUnaryPropagator<View,PC_INT_DOM,CtrlView>::b;
00237 
00239     int c;
00241     ReEqDomInt(Space* home, bool share, ReEqDomInt& p);
00243     ReEqDomInt(Space* home, View x, int c, CtrlView b);
00244   public:
00246     virtual Actor* copy(Space* home, bool share);
00248     virtual ExecStatus propagate(Space* home);
00250     static  ExecStatus post(Space* home, View x, int c, CtrlView b);
00251   };
00252 
00259   template <class View, class CtrlView>
00260   class ReEqBndInt : public ReUnaryPropagator<View,PC_INT_BND,CtrlView> {
00261   protected:
00262     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00263     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::b;
00264 
00266     int c;
00268     ReEqBndInt(Space* home, bool share, ReEqBndInt& p);
00270     ReEqBndInt(Space* home, View x, int c, CtrlView b);
00271   public:
00273     virtual Actor* copy(Space* home, bool share);
00275     virtual ExecStatus propagate(Space* home);
00277     static  ExecStatus post(Space* home, View x, int c, CtrlView b);
00278   };
00279 
00280 
00281 
00282 
00283   /*
00284    * Disequality propagators
00285    *
00286    */
00287 
00295   template <class View>
00296   class Nq : public BinaryPropagator<View,PC_INT_VAL> {
00297   protected:
00298     using BinaryPropagator<View,PC_INT_VAL>::x0;
00299     using BinaryPropagator<View,PC_INT_VAL>::x1;
00300 
00302     Nq(Space* home, bool share, Nq<View>& p);
00304     Nq(Space* home, View x0, View x1);
00305   public:
00307     virtual Actor* copy(Space* home, bool share);
00309     virtual PropCost cost(void) const;
00311     virtual ExecStatus propagate(Space* home);
00313     static  ExecStatus post(Space* home, View x0, View x1);
00314   };
00315 
00316   /*
00317    * Order propagators
00318    *
00319    */
00320 
00328   template <class View>
00329   class Lq : public BinaryPropagator<View,PC_INT_BND> {
00330   protected:
00331     using BinaryPropagator<View,PC_INT_BND>::x0;
00332     using BinaryPropagator<View,PC_INT_BND>::x1;
00333 
00335     Lq(Space* home, bool share, Lq& p);
00337     Lq(Space* home, View x0, View x1);
00338   public:
00340     virtual Actor*     copy(Space* home, bool share);
00342     virtual ExecStatus propagate(Space* home);
00344     static  ExecStatus post(Space* home, View x0, View x1);
00345   };
00346 
00354   template <class View>
00355   class Le : public BinaryPropagator<View,PC_INT_BND> {
00356   protected:
00357     using BinaryPropagator<View,PC_INT_BND>::x0;
00358     using BinaryPropagator<View,PC_INT_BND>::x1;
00359 
00361     Le(Space* home, bool share, Le& p);
00363     Le(Space* home, View x0, View x1);
00364   public:
00366     virtual Actor* copy(Space* home, bool share);
00368     virtual ExecStatus propagate(Space* home);
00370     static  ExecStatus post(Space* home, View x0, View x1);
00371   };
00372 
00373 
00374 
00375   /*
00376    * Reified order propagators
00377    *
00378    */
00379 
00387   template <class View, class CtrlView>
00388   class ReLq : public ReBinaryPropagator<View,PC_INT_BND,CtrlView> {
00389   protected:
00390     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00391     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x1;
00392     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::b;
00393 
00395     ReLq(Space* home, bool share, ReLq& p);
00397     ReLq(Space* home, View x0, View x1, CtrlView b);
00398   public:
00400     virtual Actor* copy(Space* home, bool share);
00402     virtual ExecStatus propagate(Space* home);
00404     static  ExecStatus post(Space* home, View x0, View x1, CtrlView b);
00405   };
00406 
00414   template <class View, class CtrlView>
00415   class ReLqInt : public ReUnaryPropagator<View,PC_INT_BND,CtrlView> {
00416   protected:
00417     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00418     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::b;
00419 
00421     int c;
00423     ReLqInt(Space* home, bool share, ReLqInt& p);
00425     ReLqInt(Space* home, View x, int c, CtrlView b);
00426   public:
00428     virtual Actor* copy(Space* home, bool share);
00430     virtual ExecStatus propagate(Space* home);
00432     static  ExecStatus post(Space* home, View x, int c, CtrlView b);
00433    };
00434 
00435 
00436 
00437 
00438 
00462   template <class View>
00463   class Lex : public NaryPropagator<ViewTuple<View,2>,PC_INT_BND> {
00464   protected:
00465     using NaryPropagator<ViewTuple<View,2>,PC_INT_BND>::x;
00466 
00468     bool strict;
00470     Lex(Space* home, bool share, Lex& p);
00472     Lex(Space* home, ViewArray<ViewTuple<View,2> >& xy, bool strict);
00473   public:
00475     virtual Actor* copy(Space* home, bool share);
00477     virtual ExecStatus propagate(Space* home);
00479     static  ExecStatus post(Space* home, 
00480                             ViewArray<ViewTuple<View,2> >& xy, bool strict);
00481   };
00482 
00483 }}}
00484 
00485 #include "int/rel/eq.icc"
00486 #include "int/rel/nq.icc"
00487 #include "int/rel/lq-le.icc"
00488 #include "int/rel/lex.icc"
00489 
00490 #endif
00491 
00492 
00493 // STATISTICS: int-prop
00494