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

arithmetic.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-08-04 16:03:26 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $
00012  *     $Revision: 3512 $
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_ARITHMETIC_HH__
00025 #define __GECODE_INT_ARITHMETIC_HH__
00026 
00027 #include "gecode/int.hh"
00028 
00029 #include "gecode/int/rel.hh"
00030 #include "gecode/int/linear.hh"
00031 
00037 namespace Gecode { namespace Int { namespace Arithmetic {
00038 
00045   template <class View>
00046   class AbsBnd : public BinaryPropagator<View,PC_INT_BND> {
00047   protected:
00048     using BinaryPropagator<View,PC_INT_BND>::x0;
00049     using BinaryPropagator<View,PC_INT_BND>::x1;
00050 
00052     AbsBnd(Space* home, bool share, AbsBnd& p);
00054     AbsBnd(Space* home, View x0, View x1);
00055   public:
00056 
00058     virtual Actor* copy(Space* home, bool share);
00065     virtual PropCost cost(void) const;
00067     virtual ExecStatus  propagate(Space* home);
00069     static  ExecStatus  post(Space* home, View x0, View x1);
00070   };
00071 
00079   template <class View>
00080   ExecStatus prop_bnd(Space* home, ViewArray<View>&);
00081 
00088   template <class View>
00089   class AbsDom : public BinaryPropagator<View,PC_INT_DOM> {
00090   protected:
00091     using BinaryPropagator<View,PC_INT_DOM>::x0;
00092     using BinaryPropagator<View,PC_INT_DOM>::x1;
00093 
00095     AbsDom(Space* home, bool share, AbsDom& p);
00097     AbsDom(Space* home, View x0, View x1);
00098   public:
00100     virtual Actor* copy(Space* home, bool share);
00108     virtual PropCost cost(void) const;
00110     virtual ExecStatus  propagate(Space* home);
00112     static  ExecStatus  post(Space* home, View x0, View x1);
00113   };
00114 
00121   template <class View>
00122   class Max : public TernaryPropagator<View,PC_INT_BND> {
00123   protected:
00124     using TernaryPropagator<View,PC_INT_BND>::x0;
00125     using TernaryPropagator<View,PC_INT_BND>::x1;
00126     using TernaryPropagator<View,PC_INT_BND>::x2;
00127 
00129     Max(Space* home, bool share, Max& p);
00131     Max(Space* home, View x0, View x1, View x2);
00132   public:
00134     Max(Space* home, bool share, Propagator& p, View x0, View x1, View x2);
00136     virtual Actor* copy(Space* home, bool share);
00138     virtual ExecStatus propagate(Space* home);
00140     static  ExecStatus post(Space* home, View x0, View x1, View x2);
00141   };
00142 
00149   template <class View>
00150   class NaryMax : public NaryOnePropagator<View,PC_INT_BND> {
00151   protected:
00152     using NaryOnePropagator<View,PC_INT_BND>::x;
00153     using NaryOnePropagator<View,PC_INT_BND>::y;
00154 
00156     NaryMax(Space* home, bool share, NaryMax& p);
00158     NaryMax(Space* home, ViewArray<View>& x, View y);
00159   public:
00161     virtual Actor* copy(Space* home, bool share);
00163     virtual ExecStatus propagate(Space* home);
00165     static  ExecStatus post(Space* home, ViewArray<View>& x, View y);
00166   };
00167 
00168 
00169 
00170 
00176   template <class VA, class VB>
00177   class SquarePlus : public Propagator {
00178   protected:
00179     VA x0; VB x1;
00180   public:
00182     SquarePlus(Space* home, VA x0, VB x1);
00184     static ExecStatus post(Space* home, VA x0, VB x1);
00186     SquarePlus(Space* home, bool share, SquarePlus<VA,VB>& p);
00188     virtual Actor* copy(Space* home, bool share);
00190     virtual ExecStatus propagate(Space* home);
00192     virtual PropCost cost(void) const;
00194     virtual size_t dispose(Space* home);
00195   };
00196 
00203   template <class View>
00204   class Square : public BinaryPropagator<View,PC_INT_BND> {
00205   protected:
00206     using BinaryPropagator<View,PC_INT_BND>::x0;
00207     using BinaryPropagator<View,PC_INT_BND>::x1;
00208 
00210     Square(Space* home, bool share, Square<View>& p);
00212     Square(Space* home, View x0, View x1);
00213   public:
00215     virtual Actor* copy(Space* home, bool share);
00217     virtual ExecStatus propagate(Space* home);
00219     virtual PropCost cost(void) const;
00221     static  ExecStatus post(Space* home, View x0, View x1);
00222   };
00223 
00229   template <class VA, class VB, class VC>
00230   class MultPlus : public Propagator {
00231   protected:
00232     VA x0; VB x1; VC x2;
00233   public:
00235     MultPlus(Space* home, VA x0, VB x1, VC x2);
00237     static ExecStatus post(Space* home, VA x0, VB x1, VC x2);
00239     MultPlus(Space* home, bool share, MultPlus<VA,VB,VC>& p);
00241     virtual Actor* copy(Space* home, bool share);
00243     virtual ExecStatus propagate(Space* home);
00245     virtual PropCost cost(void) const;
00247     virtual size_t dispose(Space* home);
00248   };
00249 
00261   template <class View>
00262   class Mult : public TernaryPropagator<View,PC_INT_BND> {
00263   protected:
00264     using TernaryPropagator<View,PC_INT_BND>::x0;
00265     using TernaryPropagator<View,PC_INT_BND>::x1;
00266     using TernaryPropagator<View,PC_INT_BND>::x2;
00267 
00269     Mult(Space* home, bool share, Mult<View>& p);
00270   public:
00272     Mult(Space* home, View x0, View x1, View x2);
00274     static  ExecStatus post(Space* home, View x0, View x1, View x2);
00276     virtual Actor* copy(Space* home, bool share);
00278     virtual ExecStatus propagate(Space* home);
00280     virtual PropCost cost(void) const;
00281   };
00282 
00283 }}}
00284 
00285 #include "gecode/int/arithmetic/abs.icc"
00286 #include "gecode/int/arithmetic/max.icc"
00287 #include "gecode/int/arithmetic/mult.icc"
00288 
00289 #endif
00290 
00291 // STATISTICS: int-prop
00292