Generated on Sun Feb 17 15:24:09 2019 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  *  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_REL_HH__
00041 #define __GECODE_SET_REL_HH__
00042 
00043 #include <gecode/set.hh>
00044 
00045 namespace Gecode { namespace Set { namespace Rel {
00046 
00052 
00053   template<class VX, class VY>
00054   bool same(VX c, VY y);
00055 
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, Subset& p);
00072     Subset(Home home, View0 x0, View1 x1);
00073   public:
00075     virtual Actor* copy(Space& home);
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, NoSubset& p);
00098     NoSubset(Home home, View0 x0, View1 x1);
00099   public:
00101     virtual Actor* copy(Space& home);
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, class CtrlView, ReifyMode rm>
00115   class ReSubset : public Propagator {
00116   protected:
00118     View0 x0;
00120     View1 x1;
00122     CtrlView b;
00124     ReSubset(Space& home, ReSubset& p);
00126     ReSubset(Home home, View0 x0, View1 x1, CtrlView b);
00127   public:
00129     virtual Actor* copy(Space& home);
00131     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00133     virtual void reschedule(Space& home);
00135     virtual size_t dispose(Space& home);
00137     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00139     static ExecStatus post(Home home, View0 x, View1 y,
00140                            CtrlView b);
00141   };
00142 
00149   template<class View0, class View1>
00150   class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00151   protected:
00152     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00153     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00155     Eq(Space& home, Eq& p);
00157     Eq(Home home, View0 x0, View1 x1);
00158   public:
00160     virtual Actor* copy(Space& home);
00162     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00164     static  ExecStatus  post(Home home, View0 x, View1 y);
00165   };
00166 
00173   template<class View0, class View1, class CtrlView, ReifyMode rm>
00174   class ReEq : public Propagator {
00175   protected:
00176     View0 x0;
00177     View1 x1;
00178     CtrlView b;
00180     ReEq(Space& home, ReEq&);
00182     ReEq(Home home, View0 x0, View1 x1, CtrlView b);
00183   public:
00185     virtual Actor* copy(Space& home);
00187     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00189     virtual void reschedule(Space& home);
00191     virtual size_t dispose(Space& home);
00193     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00195     static ExecStatus post(Home home, View0 x, View1 y,
00196                            CtrlView b);
00197   };
00198 
00207   template<class View0, class View1, bool strict=false>
00208   class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00209   protected:
00210     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00211     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00213     Lq(Space& home, Lq& p);
00215     Lq(Home home, View0 x0, View1 x1);
00216   public:
00218     virtual Actor* copy(Space& home);
00220     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00222     static  ExecStatus  post(Home home, View0 x, View1 y);
00223   };
00224 
00233   template<class View0, class View1, ReifyMode rm, bool strict=false>
00234   class ReLq : public Propagator {
00235   protected:
00236     View0 x0;
00237     View1 x1;
00238     Gecode::Int::BoolView b;
00240     ReLq(Space& home, ReLq& p);
00242     ReLq(Home home, View0 x0, View1 x1, Gecode::Int::BoolView b);
00243   public:
00245     virtual Actor* copy(Space& home);
00247     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00249     virtual void reschedule(Space& home);
00251     virtual size_t dispose(Space& home);
00253     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00255     static ExecStatus post(Home home, View0 x, View1 y,
00256                            Gecode::Int::BoolView b);
00257   };
00258 
00266   template<class View0, class View1>
00267   class Distinct :
00268     public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
00269   protected:
00270     using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x0;
00271     using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x1;
00273     Distinct(Space& home, Distinct& p);
00275     Distinct(Home home, View0 x0, View1 x1);
00276   public:
00278     virtual Actor* copy(Space& home);
00280     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00282     static  ExecStatus  post(Home home, View0 x, View1 y);
00283   };
00284 
00295   template<class View0>
00296   class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
00297   protected:
00298     using UnaryPropagator<View0,PC_SET_ANY>::x0;
00300     ConstSetView y;
00302     DistinctDoit(Space& home, DistinctDoit&);
00304     DistinctDoit(Home home, View0 x0, ConstSetView y);
00305   public:
00307     virtual Actor* copy(Space& home);
00309     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00311     static ExecStatus post(Home home, View0 x, ConstSetView y);
00312   };
00313 
00314 }}}
00315 
00316 #include <gecode/set/rel/common.hpp>
00317 #include <gecode/set/rel/subset.hpp>
00318 #include <gecode/set/rel/nosubset.hpp>
00319 #include <gecode/set/rel/re-subset.hpp>
00320 #include <gecode/set/rel/eq.hpp>
00321 #include <gecode/set/rel/re-eq.hpp>
00322 #include <gecode/set/rel/nq.hpp>
00323 #include <gecode/set/rel/lq.hpp>
00324 #include <gecode/set/rel/re-lq.hpp>
00325 
00326 #endif
00327 
00328 // STATISTICS: set-prop