Generated on Sat Feb 12 2011 17:40:57 for Gecode by doxygen 1.7.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: 2010-06-07 14:18:14 +0200 (Mon, 07 Jun 2010) $ by $Author: tack $
00017  *     $Revision: 11048 $
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 
00146   template<class View0, class View1>
00147   class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
00148   protected:
00149     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
00150     using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
00152     Eq(Space& home, bool share,Eq& p);
00154     Eq(Home home,View0, View1);
00155   public:
00157     virtual Actor*      copy(Space& home,bool);
00159     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00161     static  ExecStatus  post(Home home,View0,View1);
00162   };
00163 
00170   template<class View0, class View1>
00171   class ReEq : public Propagator {
00172   protected:
00173     View0 x0;
00174     View1 x1;
00175     Gecode::Int::BoolView b;
00176 
00178     ReEq(Space& home, bool share,ReEq&);
00180     ReEq(Home home,View0, View1, Gecode::Int::BoolView);
00181   public:
00183     virtual Actor*      copy(Space& home,bool);
00185     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00187     virtual size_t dispose(Space& home);
00189     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00191     static ExecStatus post(Home home,View0 x, View1 y,
00192                            Gecode::Int::BoolView b);
00193   };
00194 
00202   template<class View0, class View1>
00203   class Distinct :
00204     public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
00205   protected:
00206     using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x0;
00207     using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x1;
00209     Distinct(Space& home, bool share,Distinct& p);
00211     Distinct(Home home,View0,View1);
00212   public:
00214     virtual Actor*      copy(Space& home,bool);
00216     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00218     static  ExecStatus  post(Home home,View0,View1);
00219   };
00220 
00231   template<class View0>
00232   class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
00233   protected:
00234     using UnaryPropagator<View0,PC_SET_ANY>::x0;
00236     ConstSetView y;
00238     DistinctDoit(Space& home, bool share,DistinctDoit&);
00240     DistinctDoit(Home home, View0, ConstSetView);
00241   public:
00243     virtual Actor*      copy(Space& home, bool);
00245     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00247     static ExecStatus post(Home home, View0, ConstSetView);
00248   };
00249 
00250 }}}
00251 
00252 #include <gecode/set/rel/common.hpp>
00253 #include <gecode/set/rel/subset.hpp>
00254 #include <gecode/set/rel/nosubset.hpp>
00255 #include <gecode/set/rel/re-subset.hpp>
00256 #include <gecode/set/rel/eq.hpp>
00257 #include <gecode/set/rel/re-eq.hpp>
00258 #include <gecode/set/rel/nq.hpp>
00259 
00260 #endif
00261 
00262 // STATISTICS: set-prop