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

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: 2005-11-29 13:36:03 +0100 (Tue, 29 Nov 2005) $ by $Author: schulte $
00012  *     $Revision: 2660 $
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 "int.hh"
00028 
00029 #include "int/rel.hh"
00030 #include "int/linear.hh"
00031 
00037 namespace Gecode { namespace Int { namespace Arithmetic {
00038 
00045   template <class View>
00046   class Abs : 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     Abs(Space* home, bool share, Abs& p);
00054     Abs(Space* home, View x0, View x1);
00055   public:
00057     virtual Actor* copy(Space* home, bool share);
00059     virtual ExecStatus  propagate(Space* home);
00061     static  ExecStatus  post(Space* home, View x0, View x1);
00062   };
00063 
00070   template <class View>
00071   class Max : public TernaryPropagator<View,PC_INT_BND> {
00072   protected:
00073     using TernaryPropagator<View,PC_INT_BND>::x0;
00074     using TernaryPropagator<View,PC_INT_BND>::x1;
00075     using TernaryPropagator<View,PC_INT_BND>::x2;
00076 
00078     Max(Space* home, bool share, Max& p);
00080     Max(Space* home, View x0, View x1, View x2);
00081   public:
00083     virtual Actor* copy(Space* home, bool share);
00085     virtual ExecStatus propagate(Space* home);
00087     static  ExecStatus post(Space* home, View x0, View x1, View x2);
00088   };
00089 
00096   template <class View>
00097   class NaryMax : public NaryOnePropagator<View,PC_INT_BND> {
00098   protected:
00099     using NaryOnePropagator<View,PC_INT_BND>::x;
00100     using NaryOnePropagator<View,PC_INT_BND>::y;
00101 
00103     NaryMax(Space* home, bool share, NaryMax& p);
00105     NaryMax(Space* home, ViewArray<View>& x, View y);
00106   public:
00108     virtual Actor* copy(Space* home, bool share);
00110     virtual ExecStatus propagate(Space* home);
00112     static  ExecStatus post(Space* home, ViewArray<View>& x, View y);
00113   };
00114 
00115 
00116 
00117 
00123   template <class VA, class VB>
00124   class SquarePlus : public Propagator {
00125   protected:
00126     VA x0; VB x1;
00127   public:
00129     SquarePlus(Space* home, VA x0, VB x1);
00131     static ExecStatus post(Space* home, VA x0, VB x1);
00133     SquarePlus(Space* home, bool share, SquarePlus<VA,VB>& p);
00135     virtual Actor* copy(Space* home, bool share);
00137     virtual ExecStatus propagate(Space* home);
00139     virtual PropCost cost(void) const;
00141     virtual ~SquarePlus(void);
00142   };
00143 
00150   template <class View>
00151   class Square : public BinaryPropagator<View,PC_INT_BND> {
00152   protected:
00153     using BinaryPropagator<View,PC_INT_BND>::x0;
00154     using BinaryPropagator<View,PC_INT_BND>::x1;
00155 
00157     Square(Space* home, bool share, Square<View>& p);
00159     Square(Space* home, View x0, View x1);
00160   public:
00162     virtual Actor* copy(Space* home, bool share);
00164     virtual ExecStatus propagate(Space* home);
00166     virtual PropCost cost(void) const;
00168     static  ExecStatus post(Space* home, View x0, View x1);
00169   };
00170 
00176   template <class VA, class VB, class VC>
00177   class MultPlus : public Propagator {
00178   protected:
00179     VA x0; VB x1; VC x2;
00180   public:
00182     MultPlus(Space* home, VA x0, VB x1, VC x2);
00184     static ExecStatus post(Space* home, VA x0, VB x1, VC x2);
00186     MultPlus(Space* home, bool share, MultPlus<VA,VB,VC>& p);
00188     virtual Actor* copy(Space* home, bool share);
00190     virtual ExecStatus propagate(Space* home);
00192     virtual PropCost cost(void) const;
00194     virtual ~MultPlus(void);
00195   };
00196 
00208   template <class View>
00209   class Mult : public TernaryPropagator<View,PC_INT_BND> {
00210   protected:
00211     using TernaryPropagator<View,PC_INT_BND>::x0;
00212     using TernaryPropagator<View,PC_INT_BND>::x1;
00213     using TernaryPropagator<View,PC_INT_BND>::x2;
00214 
00216     Mult(Space* home, bool share, Mult<View>& p);
00217   public:
00219     Mult(Space* home, View x0, View x1, View x2);
00221     static  ExecStatus post(Space* home, View x0, View x1, View x2);
00223     virtual Actor* copy(Space* home, bool share);
00225     virtual ExecStatus propagate(Space* home);
00227     virtual PropCost cost(void) const;
00228   };
00229 
00230 }}}
00231 
00232 #include "int/arithmetic/abs.icc"
00233 #include "int/arithmetic/minmax.icc"
00234 #include "int/arithmetic/mult.icc"
00235 
00236 #endif
00237 
00238 // STATISTICS: int-prop
00239