Generated on Thu Mar 22 10:39:44 2012 for Gecode by doxygen 1.6.3

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: 2009-10-12 17:36:53 +0200 (Mon, 12 Oct 2009) $ by $Author: schulte $
00017  *     $Revision: 9878 $
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(Home home,View0, View1, View2);
00079   public:
00081     virtual Actor*      copy(Space& home,bool);
00083     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00085     static  ExecStatus  post(Home home, View0 x, View1 y, View2 z);
00086   };
00087 
00094   template<class View0, class View1, class View2>
00095   class SubOfUnion :
00096     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00097                                 View2,PC_SET_ANY> {
00098   protected:
00099     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00100                                  View2,PC_SET_ANY>::x0;
00101     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00102                                  View2,PC_SET_ANY>::x1;
00103     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00104                                  View2,PC_SET_ANY>::x2;
00106     SubOfUnion(Space& home, bool share,SubOfUnion& p);
00108     SubOfUnion(Home home,View0, View1, View2);
00109   public:
00111     virtual Actor*      copy(Space& home,bool);
00113     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00115     static  ExecStatus  post(Home home,View0 x,View1 y,View2 z);
00116   };
00117 
00118 
00125   template<class View0, class View1, class View2>
00126   class Intersection:
00127     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00128                                 View2,PC_SET_ANY> {
00129   protected:
00130     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00131                                View2,PC_SET_ANY>::x0;
00132     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00133                                View2,PC_SET_ANY>::x1;
00134     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00135                                View2,PC_SET_ANY>::x2;
00137     Intersection(Space& home, bool share,Intersection& p);
00139     Intersection(Home home,View0,View1,View2);
00140   public:
00142     virtual Actor*      copy(Space& home,bool);
00144     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00146     static  ExecStatus  post(Home home,View0 x,View1 y,View2 z);
00147   };
00148 
00155   template<class View0, class View1, class View2>
00156   class Union:
00157     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00158                                 View2,PC_SET_ANY> {
00159   protected:
00160     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00161                                  View2,PC_SET_ANY>::x0;
00162     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00163                                  View2,PC_SET_ANY>::x1;
00164     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00165                                  View2,PC_SET_ANY>::x2;
00167     Union(Space& home, bool share,Union& p);
00169     Union(Home home,View0,View1,View2);
00170   public:
00172     virtual Actor*      copy(Space& home,bool);
00174     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00176     static  ExecStatus  post(Home home,View0 x,View1 y,View2 z);
00177   };
00178 
00185   template<class View0, class View1>
00186   class IntersectionN : 
00187     public MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00188   protected:
00189     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00190     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00192     bool shared;
00194     LUBndSet intOfDets;
00196     IntersectionN(Space& home, bool share,IntersectionN& p);
00198     IntersectionN(Home home,ViewArray<View0>&, View1);
00200     IntersectionN(Home home,ViewArray<View0>&, const IntSet&, View1);
00201   public:
00202     virtual PropCost    cost(const Space& home, const ModEventDelta& med) const;
00204     virtual Actor*      copy(Space& home,bool);
00206     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00208     static  ExecStatus  post(Home home,ViewArray<View0>& y,View1 x);
00210     static  ExecStatus  post(Home home,ViewArray<View0>& y,
00211                              const IntSet& z,View1 x);
00212   };
00213 
00220   template<class View0, class View1>
00221   class UnionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
00222                                              View1,PC_SET_ANY> {
00223   protected:
00224     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00225     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00227     bool shared;
00229     GLBndSet unionOfDets;
00231     UnionN(Space& home, bool share,UnionN& p);
00233     UnionN(Home home,ViewArray<View0>&,View1);
00235     UnionN(Home home,ViewArray<View0>&,const IntSet&,View1);
00236   public:
00238     virtual Actor*      copy(Space& home, bool);
00240     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00241     virtual PropCost    cost(const Space& home, const ModEventDelta& med) const;
00243     static  ExecStatus  post(Home home,ViewArray<View0>& y,View1 x);
00245     static  ExecStatus  post(Home home,ViewArray<View0>& y,
00246                              const IntSet& z,View1 x);
00247   };
00248 
00249 
00256   template<class View0, class View1>
00257   class PartitionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
00258                                                  View1,PC_SET_ANY> {
00259   protected:
00260     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00261     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00263     bool shared;
00265     GLBndSet unionOfDets;
00267     PartitionN(Space& home, bool share,PartitionN& p);
00269     PartitionN(Home home,ViewArray<View0>&, View1);
00271     PartitionN(Home home,ViewArray<View0>&, const IntSet&, View1);
00272   public:
00274     virtual Actor*      copy(Space& home,bool);
00276     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00277     virtual PropCost    cost(const Space& home, const ModEventDelta& med) const;
00279     static  ExecStatus  post(Home home,ViewArray<View0>& y,View1 x);
00281     static  ExecStatus  post(Home home,ViewArray<View0>& y,
00282                              const IntSet& z,View1 x);
00283   };
00284 
00285 }}}
00286 
00287 #include <gecode/set/rel-op/common.hpp>
00288 #include <gecode/set/rel-op/superofinter.hpp>
00289 #include <gecode/set/rel-op/subofunion.hpp>
00290 #include <gecode/set/rel-op/inter.hpp>
00291 #include <gecode/set/rel-op/union.hpp>
00292 #include <gecode/set/rel-op/partition.hpp>
00293 #include <gecode/set/rel-op/post.hpp>
00294 
00295 #endif
00296 
00297 // STATISTICS: set-prop