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

rel.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: 2011-08-24 16:34:16 +0200 (Wed, 24 Aug 2011) $ by $Author: tack $
00017  *     $Revision: 12346 $
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_REL_HH__
00045 #define __GECODE_SET_REL_HH__
00046 
00047 #include <gecode/set.hh>
00048 
00049 namespace Gecode { namespace Set { namespace Rel {
00050 
00063   template<class View0, class View1>
00064   class Subset :
00065     public MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB> {
00066   protected:
00067     using MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB>::x0;
00068     using MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB>::x1;
00070     Subset(Space& home, bool share,Subset& p);
00072     Subset(Home home,View0, View1);
00073   public:
00075     virtual Actor*      copy(Space& home,bool);
00077     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00079     static  ExecStatus post(Home home,View0 x,View1 y);
00080   };
00081 
00089   template<class View0, class View1>
00090   class NoSubset :
00091     public MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB> {
00092   protected:
00093     using MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB>::x0;
00094     using MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB>::x1;
00096     NoSubset(Space& home, bool share,NoSubset& p);
00098     NoSubset(Home home,View0,View1);
00099   public:
00101     virtual Actor*      copy(Space& home,bool);
00103     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00105     static  ExecStatus post(Home home,View0 x,View1 y);
00106   };
00107 
00114   template<class View0, class View1>
00115   class ReSubset : public Propagator {
00116   protected:
00117     View0 x0;
00118     View1 x1;
00119     Gecode::Int::BoolView b;
00120 
00122     ReSubset(Space& home, bool share,ReSubset&);
00124     ReSubset(Home home,View0, View1, Gecode::Int::BoolView);
00125   public:
00127     virtual Actor*      copy(Space& home,bool);
00129     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00131     virtual size_t dispose(Space& home);
00133     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00135     static ExecStatus post(Home home,View0 x, View1 y,
00136                            Gecode::Int::BoolView b);
00137   };
00138 
00145   template<class View0, class View1>
00146   class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00147   protected:
00148     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00149     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00151     Eq(Space& home, bool share,Eq& p);
00153     Eq(Home home,View0, View1);
00154   public:
00156     virtual Actor*      copy(Space& home,bool);
00158     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00160     static  ExecStatus  post(Home home,View0,View1);
00161   };
00162 
00169   template<class View0, class View1>
00170   class ReEq : public Propagator {
00171   protected:
00172     View0 x0;
00173     View1 x1;
00174     Gecode::Int::BoolView b;
00175 
00177     ReEq(Space& home, bool share,ReEq&);
00179     ReEq(Home home,View0, View1, Gecode::Int::BoolView);
00180   public:
00182     virtual Actor*      copy(Space& home,bool);
00184     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00186     virtual size_t dispose(Space& home);
00188     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00190     static ExecStatus post(Home home,View0 x, View1 y,
00191                            Gecode::Int::BoolView b);
00192   };
00193 
00202   template<class View0, class View1, bool strict=false>
00203   class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00204   protected:
00205     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00206     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00208     Lq(Space& home, bool share,Lq& p);
00210     Lq(Home home,View0, View1);
00211   public:
00213     virtual Actor*      copy(Space& home,bool);
00215     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00217     static  ExecStatus  post(Home home,View0,View1);
00218   };
00219 
00228   template<class View0, class View1, bool strict=false>
00229   class ReLq : public Propagator {
00230   protected:
00231     View0 x0;
00232     View1 x1;
00233     Gecode::Int::BoolView b;
00234 
00236     ReLq(Space& home, bool share,ReLq&);
00238     ReLq(Home home,View0, View1, Gecode::Int::BoolView);
00239   public:
00241     virtual Actor*      copy(Space& home,bool);
00243     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00245     virtual size_t dispose(Space& home);
00247     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00249     static ExecStatus post(Home home,View0 x, View1 y,
00250                            Gecode::Int::BoolView b);
00251   };
00252 
00260   template<class View0, class View1>
00261   class Distinct :
00262     public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
00263   protected:
00264     using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x0;
00265     using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x1;
00267     Distinct(Space& home, bool share,Distinct& p);
00269     Distinct(Home home,View0,View1);
00270   public:
00272     virtual Actor*      copy(Space& home,bool);
00274     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00276     static  ExecStatus  post(Home home,View0,View1);
00277   };
00278 
00289   template<class View0>
00290   class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
00291   protected:
00292     using UnaryPropagator<View0,PC_SET_ANY>::x0;
00294     ConstSetView y;
00296     DistinctDoit(Space& home, bool share,DistinctDoit&);
00298     DistinctDoit(Home home, View0, ConstSetView);
00299   public:
00301     virtual Actor*      copy(Space& home, bool);
00303     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00305     static ExecStatus post(Home home, View0, ConstSetView);
00306   };
00307 
00308 }}}
00309 
00310 #include <gecode/set/rel/common.hpp>
00311 #include <gecode/set/rel/subset.hpp>
00312 #include <gecode/set/rel/nosubset.hpp>
00313 #include <gecode/set/rel/re-subset.hpp>
00314 #include <gecode/set/rel/eq.hpp>
00315 #include <gecode/set/rel/re-eq.hpp>
00316 #include <gecode/set/rel/nq.hpp>
00317 #include <gecode/set/rel/lq.hpp>
00318 #include <gecode/set/rel/re-lq.hpp>
00319 
00320 #endif
00321 
00322 // STATISTICS: set-prop