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

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: 2011-09-06 10:05:16 +0200 (Tue, 06 Sep 2011) $ by $Author: tack $
00013  *     $Revision: 12391 $
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   };
00057   template<>
00058   class ViewToVarArg<Gecode::Set::SingletonView> {
00059   public:
00060     typedef Gecode::IntVarArgs argtype;
00061   };
00062 }}}
00063 
00064 namespace Gecode { namespace Set { namespace Element {
00065 
00077   template<class View, class View0, class View1>
00078   class ElementIntersection : public Propagator {
00079   public:
00080     typedef Gecode::Int::Element::IdxViewArray<View> IdxViewArray;
00081   protected:
00082     IntSet universe;
00083     IdxViewArray iv;
00084     View0 x0;
00085     View1 x1;
00086 
00088     ElementIntersection(Space& home, bool share,ElementIntersection& p);
00090     ElementIntersection(Home home,IdxViewArray&,View0,View1,
00091                        const IntSet& universe);
00092   public:
00094     virtual Actor* copy(Space& home,bool);
00095     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00097     virtual size_t dispose(Space& home);
00099     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00105     static ExecStatus post(Home home,IdxViewArray& x, View0 y,
00106                            View1 z, const IntSet& u);
00107   };
00108 
00115   template<class View, class View0, class View1>
00116   class ElementUnion : public Propagator {
00117   public:
00118     typedef Gecode::Int::Element::IdxViewArray<View> IdxViewArray;
00119   protected:
00120     IdxViewArray iv;
00121     View0 x0;
00122     View1 x1;
00123 
00125     ElementUnion(Space& home, bool share,ElementUnion& p);
00127     ElementUnion(Home home,IdxViewArray&,View0,View1);
00128   public:
00130     virtual Actor* copy(Space& home,bool);
00131     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00133     virtual size_t dispose(Space& home);
00135     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00141     static  ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
00142   };
00143 
00150   template<class SView, class RView>
00151   class ElementUnionConst : public Propagator {
00152   protected:
00153     SView x0;
00154     IntSet* iv;
00155     int n_iv;
00156     RView x1;
00157 
00159     ElementUnionConst(Space& home, bool share,ElementUnionConst& p);
00161     ElementUnionConst(Home home,SView,const IntSetArgs&,RView);
00162   public:
00164     virtual Actor* copy(Space& home,bool);
00165     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00167     virtual size_t dispose(Space& home);
00169     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00175     static  ExecStatus  post(Home home,SView z,const IntSetArgs& x,RView y);
00176   };
00177 
00184   template<class SView, class RView>
00185   class ElementDisjoint : public Propagator {
00186   public:
00187     typedef Gecode::Int::Element::IdxViewArray<SView> IdxViewArray;
00188   protected:
00189     IdxViewArray iv;
00190     RView x1;
00191 
00193     ElementDisjoint(Space& home, bool share,ElementDisjoint& p);
00195     ElementDisjoint(Home home,IdxViewArray&,RView);
00196   public:
00198     virtual Actor*      copy(Space& home,bool);
00199     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00201     virtual size_t dispose(Space& home);
00203     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00205     static  ExecStatus  post(Home home,IdxViewArray& x,RView y);
00206   };
00207 
00208 }}}
00209 
00210 #include <gecode/set/element/inter.hpp>
00211 #include <gecode/set/element/union.hpp>
00212 #include <gecode/set/element/unionConst.hpp>
00213 #include <gecode/set/element/disjoint.hpp>
00214 
00215 #endif
00216 
00217 // STATISTICS: set-prop
00218