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

distinct.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-10-23 16:16:09 +0200 (Mon, 23 Oct 2006) $ by $Author: schulte $
00016  *     $Revision: 3768 $
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_DISTINCT_HH__
00029 #define __GECODE_INT_DISTINCT_HH__
00030 
00031 #include "gecode/int.hh"
00032 
00033 #include "gecode/int/rel.hh"
00034 
00040 namespace Gecode { namespace Int { namespace Distinct {
00041 
00050   template <class View>
00051   class Val : public NaryPropagator<View,PC_INT_VAL> {
00052   protected:
00053     using NaryPropagator<View,PC_INT_VAL>::x;
00054 
00056     Val(Space* home, ViewArray<View>& x);
00058     Val(Space* home, bool share, Val<View>& p);
00059   public:
00061     virtual Actor*     copy(Space* home, bool share);
00063     virtual ExecStatus propagate(Space* home);
00065     static ExecStatus post(Space* home, ViewArray<View>& x);
00066   };
00067 
00081   template <class View, bool complete>
00082   ExecStatus prop_val(Space* home, ViewArray<View>&);
00083 
00084 
00085 
00111   template <class View>
00112   class Bnd : public Propagator {
00113   protected:
00115     ViewArray<View> x;
00117     ViewArray<View> y;
00119     Bnd(Space* home, ViewArray<View>& x);
00121     Bnd(Space* home, bool share, Bnd<View>& p);
00122   public:
00124     static ExecStatus post(Space* home, ViewArray<View>& x);
00126     virtual ExecStatus propagate(Space* home);
00133     virtual PropCost cost(void) const;
00135     virtual Actor* copy(Space* home, bool share);
00137     virtual size_t dispose(Space* home);
00138   };
00139 
00148   template <class View>
00149   ExecStatus prop_bnd(Space* home, ViewArray<View>& x, int m);
00150 
00151 
00162   template <class View>
00163   class DomCtrl {
00164   protected:
00166     class ViewValGraph;
00168     ViewValGraph* vvg;
00169   public:
00171     DomCtrl(void);
00173     bool available(void);
00175     ExecStatus init(int n, View* x);
00177     ExecStatus sync(void);
00179     void propagate(Space* home);
00181     size_t size(void) const;
00183     void flush(void);
00185     void dispose(void);
00186   };
00187 
00203   template <class View>
00204   class Dom : public NaryPropagator<View,PC_INT_DOM> {
00205   protected:
00206     using NaryPropagator<View,PC_INT_DOM>::x;
00207 
00209     DomCtrl<View> dc;
00211     Dom(Space* home, bool share, Dom<View>& p);
00213     Dom(Space* home, ViewArray<View>& x);
00214   public:
00216     virtual ExecStatus propagate(Space* home);
00223     virtual PropCost cost(void) const;
00225     virtual Actor* copy(Space* home, bool share);
00227     virtual void flush(void);
00229     virtual size_t size(void) const;
00231     static  ExecStatus post(Space* home, ViewArray<View>& x);
00233     virtual size_t dispose(Space* home);
00234   };
00235 
00242   template <class View>
00243   class TerDom : public TernaryPropagator<View,PC_INT_DOM> {
00244   protected:
00245     using TernaryPropagator<View,PC_INT_DOM>::x0;
00246     using TernaryPropagator<View,PC_INT_DOM>::x1;
00247     using TernaryPropagator<View,PC_INT_DOM>::x2;
00248 
00250     TerDom(Space* home, bool share, TerDom<View>& p);
00252     TerDom(Space* home, View x0, View x1, View x2);
00253   public:
00255     virtual ExecStatus propagate(Space* home);
00257     virtual Actor* copy(Space* home, bool share);
00259     static  ExecStatus post(Space* home, View x0, View x1, View x2);
00260   };
00261 
00262 }}}
00263 
00264 #include "gecode/int/distinct/val.icc"
00265 #include "gecode/int/distinct/bnd.icc"
00266 #include "gecode/int/distinct/ter-dom.icc"
00267 #include "gecode/int/distinct/dom.icc"
00268 
00269 #endif
00270 
00271 // STATISTICS: int-prop
00272