Generated on Sun Feb 17 15:24:30 2019 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  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  Permission is hereby granted, free of charge, to any person obtaining
00020  *  a copy of this software and associated documentation files (the
00021  *  "Software"), to deal in the Software without restriction, including
00022  *  without limitation the rights to use, copy, modify, merge, publish,
00023  *  distribute, sublicense, and/or sell copies of the Software, and to
00024  *  permit persons to whom the Software is furnished to do so, subject to
00025  *  the following conditions:
00026  *
00027  *  The above copyright notice and this permission notice shall be
00028  *  included in all copies or substantial portions of the Software.
00029  *
00030  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00031  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00032  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00033  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00034  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00035  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00036  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00037  *
00038  */
00039 
00040 #ifndef __GECODE_SET_RELOP_HH__
00041 #define __GECODE_SET_RELOP_HH__
00042 
00043 #include <gecode/set.hh>
00044 #include <gecode/set/rel.hh>
00045 
00046 namespace Gecode { namespace Set { namespace RelOp {
00047 
00060   template<class View0, class View1, class View2>
00061   class SuperOfInter :
00062     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00063                                 View2,PC_SET_CLUB> {
00064   protected:
00065     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00066                                View2,PC_SET_CLUB>::x0;
00067     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00068                                View2,PC_SET_CLUB>::x1;
00069     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00070                                View2,PC_SET_CLUB>::x2;
00072     SuperOfInter(Space& home, SuperOfInter& p);
00074     SuperOfInter(Home home, View0, View1, View2);
00075   public:
00077     virtual Actor* copy(Space& home);
00079     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00081     static  ExecStatus  post(Home home, View0 x, View1 y, View2 z);
00082   };
00083 
00090   template<class View0, class View1, class View2>
00091   class SubOfUnion :
00092     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00093                                 View2,PC_SET_ANY> {
00094   protected:
00095     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00096                                  View2,PC_SET_ANY>::x0;
00097     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00098                                  View2,PC_SET_ANY>::x1;
00099     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00100                                  View2,PC_SET_ANY>::x2;
00102     SubOfUnion(Space& home, SubOfUnion& p);
00104     SubOfUnion(Home home, View0, View1, View2);
00105   public:
00107     virtual Actor* copy(Space& home);
00109     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00111     static  ExecStatus  post(Home home,View0 x,View1 y,View2 z);
00112   };
00113 
00114 
00121   template<class View0, class View1, class View2>
00122   class Intersection:
00123     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00124                                 View2,PC_SET_ANY> {
00125   protected:
00126     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00127                                View2,PC_SET_ANY>::x0;
00128     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00129                                View2,PC_SET_ANY>::x1;
00130     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00131                                View2,PC_SET_ANY>::x2;
00133     Intersection(Space& home, Intersection& p);
00135     Intersection(Home home,View0,View1,View2);
00136   public:
00138     virtual Actor* copy(Space& home);
00140     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00142     static  ExecStatus  post(Home home,View0 x,View1 y,View2 z);
00143   };
00144 
00151   template<class View0, class View1, class View2>
00152   class Union:
00153     public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00154                                 View2,PC_SET_ANY> {
00155   protected:
00156     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00157                                  View2,PC_SET_ANY>::x0;
00158     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00159                                  View2,PC_SET_ANY>::x1;
00160     using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
00161                                  View2,PC_SET_ANY>::x2;
00163     Union(Space& home, Union& p);
00165     Union(Home home, View0, View1, View2);
00166   public:
00168     virtual Actor* copy(Space& home);
00170     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00172     static  ExecStatus post(Home home,View0 x,View1 y,View2 z);
00173   };
00174 
00181   template<class View0, class View1>
00182   class IntersectionN :
00183     public MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00184   protected:
00185     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00186     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00188     bool shared;
00190     LUBndSet intOfDets;
00192     IntersectionN(Space& home, IntersectionN& p);
00194     IntersectionN(Home home, ViewArray<View0>&, View1);
00196     IntersectionN(Home home, ViewArray<View0>&, const IntSet&, View1);
00197   public:
00199     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00201     virtual Actor* copy(Space& home);
00203     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00205     static  ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
00207     static  ExecStatus post(Home home,ViewArray<View0>& y,
00208                             const IntSet& z,View1 x);
00209   };
00210 
00217   template<class View0, class View1>
00218   class UnionN : 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     GLBndSet unionOfDets;
00228     UnionN(Space& home, UnionN& p);
00230     UnionN(Home home,ViewArray<View0>&,View1);
00232     UnionN(Home home,ViewArray<View0>&,const IntSet&,View1);
00233   public:
00235     virtual Actor* copy(Space& home);
00237     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00239     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00241     static  ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
00243     static  ExecStatus post(Home home,ViewArray<View0>& y,
00244                             const IntSet& z,View1 x);
00245   };
00246 
00247 
00254   template<class View0, class View1>
00255   class PartitionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
00256                                                  View1,PC_SET_ANY> {
00257   protected:
00258     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
00259     using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::y;
00261     bool shared;
00263     GLBndSet unionOfDets;
00265     PartitionN(Space& home, PartitionN& p);
00267     PartitionN(Home home, ViewArray<View0>&, View1);
00269     PartitionN(Home home, ViewArray<View0>&, const IntSet&, View1);
00270   public:
00272     virtual Actor* copy(Space& home);
00274     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00276     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00278     static  ExecStatus post(Home home,ViewArray<View0>& y,View1 x);
00280     static  ExecStatus post(Home home,ViewArray<View0>& y,
00281                             const IntSet& z,View1 x);
00282   };
00283 
00284 }}}
00285 
00286 #include <gecode/set/rel-op/common.hpp>
00287 #include <gecode/set/rel-op/superofinter.hpp>
00288 #include <gecode/set/rel-op/subofunion.hpp>
00289 #include <gecode/set/rel-op/inter.hpp>
00290 #include <gecode/set/rel-op/union.hpp>
00291 #include <gecode/set/rel-op/partition.hpp>
00292 #include <gecode/set/rel-op/post.hpp>
00293 
00294 #endif
00295 
00296 // STATISTICS: set-prop