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

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: 2006-08-31 17:36:38 +0200 (Thu, 31 Aug 2006) $ by $Author: schulte $
00016  *     $Revision: 3579 $
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 "gecode/int.hh"
00032 
00033 #include "gecode/iter.hh"
00034 
00040 namespace Gecode { namespace Int { namespace Rel {
00041 
00042   /*
00043    * Equality propagators
00044    *
00045    */
00046 
00056   template <class View0,class View1>
00057   class EqDom :
00058     public InhomBinaryPropagator<View0,PC_INT_DOM,View1,PC_INT_DOM> {
00059   protected:
00060     using InhomBinaryPropagator<View0,PC_INT_DOM,View1,PC_INT_DOM>::x0;
00061     using InhomBinaryPropagator<View0,PC_INT_DOM,View1,PC_INT_DOM>::x1;
00062 
00064     EqDom(Space* home, bool share, EqDom<View0,View1>& p);
00066     EqDom(Space* home, View0 x0, View1 x1);
00067   public:
00069     virtual Actor* copy(Space* home, bool share);
00077     virtual PropCost cost(void) const;
00079     virtual ExecStatus propagate(Space* home);
00081     static  ExecStatus post(Space* home, View0 x0, View1 x1);
00082   };
00083 
00090   template <class View0, class View1>
00091   class EqBnd :
00092     public InhomBinaryPropagator<View0,PC_INT_BND,View1,PC_INT_BND> {
00093   protected:
00094     using InhomBinaryPropagator<View0,PC_INT_BND,View1,PC_INT_BND>::x0;
00095     using InhomBinaryPropagator<View0,PC_INT_BND,View1,PC_INT_BND>::x1;
00096 
00098     EqBnd(Space* home, bool share, EqBnd<View0,View1>& p);
00100     EqBnd(Space* home, View0 x0, View1 x1);
00101   public:
00103     EqBnd(Space* home, bool share, Propagator& p, View0 x0, View1 x1);
00105     virtual Actor* copy(Space* home, bool share);
00107     virtual ExecStatus propagate(Space* home);
00109     static  ExecStatus post(Space* home, View0 x0, View1 x1);
00110   };
00111 
00121   template <class View>
00122   class NaryEqDom : public NaryPropagator<View,PC_INT_DOM> {
00123   protected:
00124     using NaryPropagator<View,PC_INT_DOM>::x;
00125 
00127     NaryEqDom(Space* home, bool share, NaryEqDom<View>& p);
00129     NaryEqDom(Space* home, ViewArray<View>&);
00130   public:
00132     virtual Actor* copy(Space* home, bool share);
00140     virtual PropCost cost(void) const;
00142     virtual ExecStatus propagate(Space* home);
00144     static  ExecStatus post(Space* home, ViewArray<View>& x);
00145   };
00146 
00153   template <class View>
00154   class NaryEqBnd : public NaryPropagator<View,PC_INT_BND> {
00155   protected:
00156     using NaryPropagator<View,PC_INT_BND>::x;
00157 
00159     NaryEqBnd(Space* home, bool share, NaryEqBnd<View>& p);
00161     NaryEqBnd(Space* home, ViewArray<View>&);
00162   public:
00164     virtual Actor* copy(Space* home, bool share);
00171     virtual PropCost cost(void) const;
00173     virtual ExecStatus propagate(Space* home);
00175     static  ExecStatus post(Space* home, ViewArray<View>& x);
00176   };
00177 
00184   template <class View, class CtrlView>
00185   class ReEqDom : public ReBinaryPropagator<View,PC_INT_DOM,CtrlView> {
00186   protected:
00187     using ReBinaryPropagator<View,PC_INT_DOM,CtrlView>::x0;
00188     using ReBinaryPropagator<View,PC_INT_DOM,CtrlView>::x1;
00189     using ReBinaryPropagator<View,PC_INT_DOM,CtrlView>::b;
00190 
00192     ReEqDom(Space* home, bool share, ReEqDom& p);
00194     ReEqDom(Space* home, View x0, View x1, CtrlView b);
00195   public:
00197     virtual Actor* copy(Space* home, bool share);
00199     virtual ExecStatus propagate(Space* home);
00201     static  ExecStatus post(Space* home, View x0, View x1, CtrlView b);
00202   };
00203 
00210   template <class View, class CtrlView>
00211   class ReEqBnd : public ReBinaryPropagator<View,PC_INT_BND,CtrlView> {
00212   protected:
00213     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00214     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x1;
00215     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::b;
00216 
00218     ReEqBnd(Space* home, bool share, ReEqBnd& p);
00220     ReEqBnd(Space* home, View x0, View x1, CtrlView b);
00221   public:
00223     virtual Actor*     copy(Space* home, bool share);
00225     virtual ExecStatus propagate(Space* home);
00227     static  ExecStatus post(Space* home, View x0, View x1, CtrlView b);
00228   };
00229 
00236   template <class View, class CtrlView>
00237   class ReEqDomInt : public ReUnaryPropagator<View,PC_INT_DOM,CtrlView> {
00238   protected:
00239     using ReUnaryPropagator<View,PC_INT_DOM,CtrlView>::x0;
00240     using ReUnaryPropagator<View,PC_INT_DOM,CtrlView>::b;
00241 
00243     int c;
00245     ReEqDomInt(Space* home, bool share, ReEqDomInt& p);
00247     ReEqDomInt(Space* home, View x, int c, CtrlView b);
00248   public:
00250     virtual Actor* copy(Space* home, bool share);
00252     virtual ExecStatus propagate(Space* home);
00254     static  ExecStatus post(Space* home, View x, int c, CtrlView b);
00255   };
00256 
00263   template <class View, class CtrlView>
00264   class ReEqBndInt : public ReUnaryPropagator<View,PC_INT_BND,CtrlView> {
00265   protected:
00266     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00267     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::b;
00268 
00270     int c;
00272     ReEqBndInt(Space* home, bool share, ReEqBndInt& p);
00274     ReEqBndInt(Space* home, View x, int c, CtrlView b);
00275   public:
00277     virtual Actor* copy(Space* home, bool share);
00279     virtual ExecStatus propagate(Space* home);
00281     static  ExecStatus post(Space* home, View x, int c, CtrlView b);
00282   };
00283 
00284 
00285 
00286 
00287   /*
00288    * Disequality propagators
00289    *
00290    */
00291 
00299   template <class View>
00300   class Nq : public BinaryPropagator<View,PC_INT_VAL> {
00301   protected:
00302     using BinaryPropagator<View,PC_INT_VAL>::x0;
00303     using BinaryPropagator<View,PC_INT_VAL>::x1;
00304 
00306     Nq(Space* home, bool share, Nq<View>& p);
00308     Nq(Space* home, View x0, View x1);
00309   public:
00311     virtual Actor* copy(Space* home, bool share);
00313     virtual PropCost cost(void) const;
00315     virtual ExecStatus propagate(Space* home);
00317     static  ExecStatus post(Space* home, View x0, View x1);
00318   };
00319 
00320   /*
00321    * Order propagators
00322    *
00323    */
00324 
00332   template <class View>
00333   class Lq : public BinaryPropagator<View,PC_INT_BND> {
00334   protected:
00335     using BinaryPropagator<View,PC_INT_BND>::x0;
00336     using BinaryPropagator<View,PC_INT_BND>::x1;
00337 
00339     Lq(Space* home, bool share, Lq& p);
00341     Lq(Space* home, View x0, View x1);
00342   public:
00344     virtual Actor*     copy(Space* home, bool share);
00346     virtual ExecStatus propagate(Space* home);
00348     static  ExecStatus post(Space* home, View x0, View x1);
00349   };
00350 
00358   template <class View>
00359   class Le : public BinaryPropagator<View,PC_INT_BND> {
00360   protected:
00361     using BinaryPropagator<View,PC_INT_BND>::x0;
00362     using BinaryPropagator<View,PC_INT_BND>::x1;
00363 
00365     Le(Space* home, bool share, Le& p);
00367     Le(Space* home, View x0, View x1);
00368   public:
00370     virtual Actor* copy(Space* home, bool share);
00372     virtual ExecStatus propagate(Space* home);
00374     static  ExecStatus post(Space* home, View x0, View x1);
00375   };
00376 
00377 
00378 
00379   /*
00380    * Reified order propagators
00381    *
00382    */
00383 
00391   template <class View, class CtrlView>
00392   class ReLq : public ReBinaryPropagator<View,PC_INT_BND,CtrlView> {
00393   protected:
00394     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00395     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::x1;
00396     using ReBinaryPropagator<View,PC_INT_BND,CtrlView>::b;
00397 
00399     ReLq(Space* home, bool share, ReLq& p);
00401     ReLq(Space* home, View x0, View x1, CtrlView b);
00402   public:
00404     virtual Actor* copy(Space* home, bool share);
00406     virtual ExecStatus propagate(Space* home);
00408     static  ExecStatus post(Space* home, View x0, View x1, CtrlView b);
00409   };
00410 
00418   template <class View, class CtrlView>
00419   class ReLqInt : public ReUnaryPropagator<View,PC_INT_BND,CtrlView> {
00420   protected:
00421     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::x0;
00422     using ReUnaryPropagator<View,PC_INT_BND,CtrlView>::b;
00423 
00425     int c;
00427     ReLqInt(Space* home, bool share, ReLqInt& p);
00429     ReLqInt(Space* home, View x, int c, CtrlView b);
00430   public:
00432     virtual Actor* copy(Space* home, bool share);
00434     virtual ExecStatus propagate(Space* home);
00436     static  ExecStatus post(Space* home, View x, int c, CtrlView b);
00437    };
00438 
00439 
00440 
00441 
00442 
00466   template <class View>
00467   class Lex : public NaryPropagator<ViewTuple<View,2>,PC_INT_BND> {
00468   protected:
00469     using NaryPropagator<ViewTuple<View,2>,PC_INT_BND>::x;
00470 
00472     bool strict;
00474     Lex(Space* home, bool share, Lex& p);
00476     Lex(Space* home, ViewArray<ViewTuple<View,2> >& xy, bool strict);
00477   public:
00479     virtual Actor* copy(Space* home, bool share);
00481     virtual ExecStatus propagate(Space* home);
00483     static  ExecStatus post(Space* home,
00484                             ViewArray<ViewTuple<View,2> >& xy, bool strict);
00485   };
00486 
00487 
00494   template<class View>
00495   class NaryNq : public BinaryPropagator<ViewTuple<View,2>,PC_INT_DOM> {
00496   protected:
00497     using BinaryPropagator<ViewTuple<View,2>,PC_INT_DOM>::x0;
00498     using BinaryPropagator<ViewTuple<View,2>,PC_INT_DOM>::x1;
00500     ViewArray<ViewTuple<View,2> > x;
00502     NaryNq(Space* home,  ViewArray<ViewTuple<View,2> >& x);
00504     NaryNq(Space* home, bool share, NaryNq& p);
00505   public:
00507     virtual Actor* copy(Space* home, bool share);
00509     virtual ExecStatus propagate(Space* home);
00511     static  ExecStatus post(Space* home, ViewArray<ViewTuple<View,2> >& x);
00512   };
00513 
00514 
00515 }}}
00516 
00517 #include "gecode/int/rel/eq.icc"
00518 #include "gecode/int/rel/nq.icc"
00519 #include "gecode/int/rel/lq-le.icc"
00520 #include "gecode/int/rel/lex.icc"
00521 
00522 #endif
00523 
00524 
00525 // STATISTICS: int-prop
00526