Generated on Mon Aug 25 11:35:44 2008 for Gecode by doxygen 1.5.6

rel-op.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *     Christian Schulte <schulte@gecode.org>
00006  *
00007  *  Contributing authors:
00008  *     Gabor Szokoli <szokoli@gecode.org>
00009  *
00010  *  Copyright:
00011  *     Guido Tack, 2004
00012  *     Christian Schulte, 2004
00013  *     Gabor Szokoli, 2004
00014  *
00015  *  Last modified:
00016  *     $Date: 2008-01-29 13:37:51 +0100 (Tue, 29 Jan 2008) $ by $Author: tack $
00017  *     $Revision: 5993 $
00018  *
00019  *  This file is part of Gecode, the generic constraint
00020  *  development environment:
00021  *     http://www.gecode.org
00022  *
00023  *  Permission is hereby granted, free of charge, to any person obtaining
00024  *  a copy of this software and associated documentation files (the
00025  *  "Software"), to deal in the Software without restriction, including
00026  *  without limitation the rights to use, copy, modify, merge, publish,
00027  *  distribute, sublicense, and/or sell copies of the Software, and to
00028  *  permit persons to whom the Software is furnished to do so, subject to
00029  *  the following conditions:
00030  *
00031  *  The above copyright notice and this permission notice shall be
00032  *  included in all copies or substantial portions of the Software.
00033  *
00034  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00035  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00036  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00037  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00038  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00039  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00040  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00041  *
00042  */
00043 
00044 #ifndef __GECODE_SET_RELOP_HH__
00045 #define __GECODE_SET_RELOP_HH__
00046 
00047 #include "gecode/set.hh"
00048 #include "gecode/set/rel.hh"
00049 
00050 namespace Gecode { namespace Set { namespace RelOp {
00051 
00064   template <class View0, class View1, class View2>
00065   class SuperOfInter :
00066   public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00067                               View2,PC_SET_CLUB> {
00068   protected:
00069     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00070                                View2,PC_SET_CLUB>::x0;
00071     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00072                                View2,PC_SET_CLUB>::x1;
00073     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00074                                View2,PC_SET_CLUB>::x2;
00076     SuperOfInter(Space* home, bool share,SuperOfInter& p);
00078     SuperOfInter(Space* home,View0, View1, View2);
00079   public:
00081     virtual Actor*      copy(Space* home,bool);
00083     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00085     static  ExecStatus  post(Space* home, View0 x, View1 y, View2 z);
00087     virtual Reflection::ActorSpec spec(const Space* home,
00088                                         Reflection::VarMap& m) const;
00090     static void post(Space* home, Reflection::VarMap& vars,
00091                      const Reflection::ActorSpec& spec);
00093     static Support::Symbol ati(void);
00094   };
00095 
00102   template <class View0, class View1, class View2>
00103   class SubOfUnion :
00104     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00105                                   View2,PC_SET_ANY> {
00106   protected:
00107     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00108                                  View2,PC_SET_ANY>::x0;
00109     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00110                                  View2,PC_SET_ANY>::x1;
00111     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00112                                  View2,PC_SET_ANY>::x2;
00114     SubOfUnion(Space* home, bool share,SubOfUnion& p);
00116     SubOfUnion(Space* home,View0, View1, View2);
00117   public:
00119     virtual Actor*      copy(Space* home,bool);
00121     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00123     static  ExecStatus  post(Space* home,View0 x,View1 y,View2 z);
00125     virtual Reflection::ActorSpec spec(const Space* home,
00126                                         Reflection::VarMap& m) const;
00128     static void post(Space* home, Reflection::VarMap& vars,
00129                      const Reflection::ActorSpec& spec);
00131     static Support::Symbol ati(void);
00132   };
00133 
00134 
00141   template <class View0, class View1, class View2>
00142   class Intersection:
00143   public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00144                               View2,PC_SET_ANY> {
00145   protected:
00146     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00147                                View2,PC_SET_ANY>::x0;
00148     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00149                                View2,PC_SET_ANY>::x1;
00150     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00151                                View2,PC_SET_ANY>::x2;
00153     Intersection(Space* home, bool share,Intersection& p);
00155     Intersection(Space* home,View0,View1,View2);
00156   public:
00158     virtual Actor*      copy(Space* home,bool);
00160     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00162     static  ExecStatus  post(Space* home,View0 x,View1 y,View2 z);
00164     virtual Reflection::ActorSpec spec(const Space* home,
00165                                         Reflection::VarMap& m) const;
00167     static void post(Space* home, Reflection::VarMap& vars,
00168                      const Reflection::ActorSpec& spec);
00170     static Support::Symbol ati(void);
00171   };
00172 
00179   template <class View0, class View1, class View2>
00180   class Union:
00181     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00182                                   View2,PC_SET_ANY> {
00183   protected:
00184     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00185                                  View2,PC_SET_ANY>::x0;
00186     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00187                                  View2,PC_SET_ANY>::x1;
00188     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00189                                  View2,PC_SET_ANY>::x2;
00191     Union(Space* home, bool share,Union& p);
00193     Union(Space* home,View0,View1,View2);
00194   public:
00196     virtual Actor*      copy(Space* home,bool);
00198     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00200     static  ExecStatus  post(Space* home,View0 x,View1 y,View2 z);
00202     virtual Reflection::ActorSpec spec(const Space* home,
00203                                         Reflection::VarMap& m) const;
00205     static void post(Space* home, Reflection::VarMap& vars,
00206                      const Reflection::ActorSpec& spec);
00208     static Support::Symbol ati(void);
00209   };
00210 
00217   template <class View0, class View1>
00218   class IntersectionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
00219                                                       View1,PC_SET_ANY> {
00220   protected:
00221     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00222     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00224     bool shared;
00226     LUBndSet intOfDets;
00228     IntersectionN(Space* home, bool share,IntersectionN& p);
00230     IntersectionN(Space* home,ViewArray<View0>&, View1);
00232     IntersectionN(Space* home,ViewArray<View0>&, const IntSet&, View1);
00233   public:
00234     virtual PropCost    cost(ModEventDelta med) const;
00236     virtual Actor*      copy(Space* home,bool);
00238     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00240     static  ExecStatus  post(Space* home,ViewArray<View0>& y,View1 x);
00242     static  ExecStatus  post(Space* home,ViewArray<View0>& y,
00243                              const IntSet& z,View1 x);
00245     virtual Reflection::ActorSpec spec(const Space* home,
00246                                         Reflection::VarMap& m) const;
00248     static void post(Space* home, Reflection::VarMap& vars,
00249                      const Reflection::ActorSpec& spec);
00251     static Support::Symbol ati(void);
00252   };
00253 
00260   template <class View0, class View1>
00261   class UnionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
00262                                                View1,PC_SET_ANY> {
00263   protected:
00264     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00265     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00267     bool shared;
00269     GLBndSet unionOfDets;
00271     UnionN(Space* home, bool share,UnionN& p);
00273     UnionN(Space* home,ViewArray<View0>&,View1);
00275     UnionN(Space* home,ViewArray<View0>&,const IntSet&,View1);
00276   public:
00278     virtual Actor*      copy(Space* home, bool);
00280     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00281     virtual PropCost    cost(ModEventDelta med) const;
00283     static  ExecStatus  post(Space* home,ViewArray<View0>& y,View1 x);
00285     static  ExecStatus  post(Space* home,ViewArray<View0>& y,
00286                              const IntSet& z,View1 x);
00288     virtual Reflection::ActorSpec spec(const Space* home,
00289                                         Reflection::VarMap& m) const;
00291     static void post(Space* home, Reflection::VarMap& vars,
00292                      const Reflection::ActorSpec& spec);
00294     static Support::Symbol ati(void);
00295   };
00296 
00297 
00304   template <class View0, class View1>
00305   class PartitionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
00306                                                    View1,PC_SET_ANY> {
00307   protected:
00308     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00309     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00311     bool shared;
00313     GLBndSet unionOfDets;
00315     PartitionN(Space* home, bool share,PartitionN& p);
00317     PartitionN(Space* home,ViewArray<View0>&, View1);
00319     PartitionN(Space* home,ViewArray<View0>&, const IntSet&, View1);
00320   public:
00322     virtual Actor*      copy(Space* home,bool);
00324     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00325     virtual PropCost    cost(ModEventDelta med) const;
00327     static  ExecStatus  post(Space* home,ViewArray<View0>& y,View1 x);
00329     static  ExecStatus  post(Space* home,ViewArray<View0>& y,
00330                              const IntSet& z,View1 x);
00332     virtual Reflection::ActorSpec spec(const Space* home,
00333                                         Reflection::VarMap& m) const;
00335     static void post(Space* home, Reflection::VarMap& vars,
00336                      const Reflection::ActorSpec& spec);
00338     static Support::Symbol ati(void);
00339   };
00340 
00341 }}}
00342 
00343 #include "gecode/set/rel-op/common.icc"
00344 #include "gecode/set/rel-op/superofinter.icc"
00345 #include "gecode/set/rel-op/subofunion.icc"
00346 #include "gecode/set/rel-op/inter.icc"
00347 #include "gecode/set/rel-op/union.icc"
00348 #include "gecode/set/rel-op/partition.icc"
00349 #include "gecode/set/rel-op/post.icc"
00350 
00351 #endif
00352 
00353 // STATISTICS: set-prop