Generated on Mon Nov 30 23:53:25 2009 for Gecode by doxygen 1.6.1

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: 2009-10-12 17:36:53 +0200 (Mon, 12 Oct 2009) $ by $Author: schulte $
00013  *     $Revision: 9878 $
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/int/element.hh>
00046 #include <gecode/set/rel.hh>
00047 #include <gecode/set/rel-op.hh>
00048 
00049 namespace Gecode { namespace Int { namespace Element {
00051   template<>
00052   class ViewToVarArg<Gecode::Set::SetView> {
00053   public:
00054     typedef Gecode::SetVarArgs argtype;
00055   };
00056 }}}
00057 
00058 namespace Gecode { namespace Set { namespace Element {
00059 
00071   template<class SView, class RView>
00072   class ElementIntersection : public Propagator {
00073   public:
00074     typedef Gecode::Int::Element::IdxViewArray<SView> IdxViewArray;
00075   protected:
00076     IntSet universe;
00077     RView x0;
00078     IdxViewArray iv;
00079     RView x1;
00080 
00082     ElementIntersection(Space& home, bool share,ElementIntersection& p);
00084     ElementIntersection(Home home,RView,IdxViewArray&,RView,
00085                        const IntSet& universe);
00086   public:
00088     virtual Actor* copy(Space& home,bool);
00089     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00091     virtual size_t dispose(Space& home);
00093     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00099     static ExecStatus post(Home home,RView z,IdxViewArray& x,
00100                            RView y, const IntSet& u);
00101   };
00102 
00109   template<class SView, class RView>
00110   class ElementUnion : public Propagator {
00111   public:
00112     typedef Gecode::Int::Element::IdxViewArray<SView> IdxViewArray;
00113   protected:
00114     SView x0;
00115     IdxViewArray iv;
00116     RView x1;
00117 
00119     ElementUnion(Space& home, bool share,ElementUnion& p);
00121     ElementUnion(Home home,SView,IdxViewArray&,RView);
00122   public:
00124     virtual Actor* copy(Space& home,bool);
00125     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00127     virtual size_t dispose(Space& home);
00129     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00135     static  ExecStatus post(Home home,SView z,IdxViewArray& x,
00136                             RView y);
00137   };
00138 
00145   template<class SView, class RView>
00146   class ElementUnionConst : public Propagator {
00147   protected:
00148     SView x0;
00149     SharedArray<IntSet> iv;
00150     RView x1;
00151 
00153     ElementUnionConst(Space& home, bool share,ElementUnionConst& p);
00155     ElementUnionConst(Home home,SView,SharedArray<IntSet>&,RView);
00156   public:
00158     virtual Actor* copy(Space& home,bool);
00159     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00161     virtual size_t dispose(Space& home);
00163     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00169     static  ExecStatus  post(Home home,SView z,SharedArray<IntSet>& x,
00170                              RView y);
00171   };
00172 
00179   template<class SView, class RView>
00180   class ElementDisjoint : public Propagator {
00181   public:
00182     typedef Gecode::Int::Element::IdxViewArray<SView> IdxViewArray;
00183   protected:
00184     IdxViewArray iv;
00185     RView x1;
00186 
00188     ElementDisjoint(Space& home, bool share,ElementDisjoint& p);
00190     ElementDisjoint(Home home,IdxViewArray&,RView);
00191   public:
00193     virtual Actor*      copy(Space& home,bool);
00194     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00196     virtual size_t dispose(Space& home);
00198     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00200     static  ExecStatus  post(Home home,IdxViewArray& x,RView y);
00201   };
00202 
00203 }}}
00204 
00205 #include <gecode/set/element/inter.hpp>
00206 #include <gecode/set/element/union.hpp>
00207 #include <gecode/set/element/unionConst.hpp>
00208 #include <gecode/set/element/disjoint.hpp>
00209 
00210 #endif
00211 
00212 // STATISTICS: set-prop
00213