Generated on Mon Aug 25 11:35:37 2008 for Gecode by doxygen 1.5.6

element.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  *  Copyright:
00008  *     Guido Tack, 2004
00009  *     Christian Schulte, 2004
00010  *
00011  *  Last modified:
00012  *     $Date: 2008-07-11 10:35:42 +0200 (Fri, 11 Jul 2008) $ by $Author: tack $
00013  *     $Revision: 7339 $
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_SELECT_HH__
00041 #define __GECODE_SET_SELECT_HH__
00042 
00043 #include "gecode/set.hh"
00044 
00045 #include "gecode/set/element/idxarray.hh"
00046 #include "gecode/set/rel.hh"
00047 #include "gecode/set/rel-op.hh"
00048 
00049 namespace Gecode { namespace Set { namespace Element {
00050 
00062   template <class SView, class RView>
00063   class ElementIntersection :
00064     public Propagator {
00065   protected:
00066     IntSet universe;
00067     SView x0;
00068     IdxViewArray<SView> iv;
00069     RView x1;
00070 
00072     ElementIntersection(Space* home, bool share,ElementIntersection& p);
00074     ElementIntersection(Space* home,SView,IdxViewArray<SView>&,RView,
00075                        const IntSet& universe);
00076   public:
00078     virtual Actor*      copy(Space* home,bool);
00079     virtual PropCost    cost(ModEventDelta med) const;
00081     virtual size_t dispose(Space* home);
00083     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00085     virtual Reflection::ActorSpec spec(const Space* home,
00086                                         Reflection::VarMap& m) const;
00088     static void post(Space* home, Reflection::VarMap& vars,
00089                      const Reflection::ActorSpec& spec);
00091     static Support::Symbol ati(void);
00097     static  ExecStatus  post(Space* home,SView z,IdxViewArray<SView>& x,
00098                              RView y, const IntSet& u);
00099   };
00100 
00107   template <class SView, class RView>
00108   class ElementUnion :
00109     public Propagator {
00110   protected:
00111     SView x0;
00112     IdxViewArray<SView> iv;
00113     RView x1;
00114 
00116     ElementUnion(Space* home, bool share,ElementUnion& p);
00118     ElementUnion(Space* home,SView,IdxViewArray<SView>&,RView);
00119   public:
00121     virtual Actor*      copy(Space* home,bool);
00122     virtual PropCost    cost(ModEventDelta med) const;
00124     virtual size_t dispose(Space* home);
00126     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00128     virtual Reflection::ActorSpec spec(const Space* home,
00129                                         Reflection::VarMap& m) const;
00131     static void post(Space* home, Reflection::VarMap& vars,
00132                      const Reflection::ActorSpec& spec);
00134     static Support::Symbol ati(void);
00140     static  ExecStatus  post(Space* home,SView z,IdxViewArray<SView>& x,
00141                              RView y);
00142   };
00143 
00150   template <class SView, class RView>
00151   class ElementUnionConst :
00152     public Propagator {
00153   protected:
00154     SView x0;
00155     SharedArray<IntSet> iv;
00156     RView x1;
00157 
00159     ElementUnionConst(Space* home, bool share,ElementUnionConst& p);
00161     ElementUnionConst(Space* home,SView,SharedArray<IntSet>&,RView);
00162   public:
00164     virtual Actor*      copy(Space* home,bool);
00165     virtual PropCost    cost(ModEventDelta med) const;
00167     virtual size_t dispose(Space* home);
00169     virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00171     virtual Reflection::ActorSpec spec(const Space* home,
00172                                         Reflection::VarMap& m) const;
00174     static void post(Space* home, Reflection::VarMap& vars,
00175                      const Reflection::ActorSpec& spec);
00177     static Support::Symbol ati(void);
00183     static  ExecStatus  post(Space* home,SView z,SharedArray<IntSet>& x,
00184                              RView y);
00185   };
00186 
00193   class ElementDisjoint :
00194     public Propagator {
00195   protected:
00196     IdxViewArray<SetView> iv;
00197     SetView x1;
00198 
00200     ElementDisjoint(Space* home, bool share,ElementDisjoint& p);
00202     ElementDisjoint(Space* home,IdxViewArray<SetView>&,SetView);
00203   public:
00205     GECODE_SET_EXPORT virtual Actor*      copy(Space* home,bool);
00206     GECODE_SET_EXPORT virtual PropCost    cost(ModEventDelta med) const;
00208     GECODE_SET_EXPORT virtual size_t dispose(Space* home);
00210     GECODE_SET_EXPORT virtual ExecStatus  propagate(Space* home, ModEventDelta med);
00212     virtual Reflection::ActorSpec spec(const Space* home,
00213                                         Reflection::VarMap& m) const;
00215     static void post(Space* home, Reflection::VarMap& vars,
00216                      const Reflection::ActorSpec& spec);
00218     static Support::Symbol ati(void);
00220     static  ExecStatus  post(Space* home,IdxViewArray<SetView>& x,SetView y);
00221   };
00222 
00223 }}}
00224 
00225 #include "gecode/set/element/inter.icc"
00226 #include "gecode/set/element/union.icc"
00227 #include "gecode/set/element/unionConst.icc"
00228 #include "gecode/set/element/disjoint.icc"
00229 
00230 #endif
00231 
00232 // STATISTICS: set-prop
00233