Generated on Fri Mar 20 15:56:09 2015 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: 2015-01-18 16:50:03 +0100 (Sun, 18 Jan 2015) $ by $Author: schulte $
00013  *     $Revision: 14365 $
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/idx-view.hh>
00046 #include <gecode/int/element.hh>
00047 #include <gecode/set/rel.hh>
00048 #include <gecode/set/rel-op.hh>
00049 
00050 namespace Gecode { namespace Int {
00052   template<>
00053   class ViewToVarArg<Gecode::Set::SetView> {
00054   public:
00055     typedef Gecode::SetVarArgs argtype;
00056   };
00058   template<>
00059   class ViewToVarArg<Gecode::Set::SingletonView> {
00060   public:
00061     typedef Gecode::IntVarArgs argtype;
00062   };
00063 }}
00064 
00065 namespace Gecode { namespace Set { namespace Element {
00066 
00078   template<class View, class View0, class View1>
00079   class ElementIntersection : public Propagator {
00080   public:
00081     typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
00082   protected:
00083     IntSet universe;
00084     IdxViewArray iv;
00085     View0 x0;
00086     View1 x1;
00087 
00089     ElementIntersection(Space& home, bool share,ElementIntersection& p);
00091     ElementIntersection(Home home,IdxViewArray&,View0,View1,
00092                        const IntSet& universe);
00093   public:
00095     virtual Actor* copy(Space& home,bool);
00096     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00098     virtual size_t dispose(Space& home);
00100     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00106     static ExecStatus post(Home home,IdxViewArray& x, View0 y,
00107                            View1 z, const IntSet& u);
00108   };
00109 
00116   template<class View, class View0, class View1>
00117   class ElementUnion : public Propagator {
00118   public:
00119     typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
00120   protected:
00121     IdxViewArray iv;
00122     View0 x0;
00123     View1 x1;
00124 
00126     ElementUnion(Space& home, bool share,ElementUnion& p);
00128     ElementUnion(Home home,IdxViewArray&,View0,View1);
00129   public:
00131     virtual Actor* copy(Space& home,bool);
00132     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00134     virtual size_t dispose(Space& home);
00136     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00142     static  ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
00143   };
00144 
00151   template<class SView, class RView>
00152   class ElementUnionConst : public Propagator {
00153   protected:
00154     SView x0;
00155     IntSet* iv;
00156     int n_iv;
00157     RView x1;
00158 
00160     ElementUnionConst(Space& home, bool share,ElementUnionConst& p);
00162     ElementUnionConst(Home home,SView,const IntSetArgs&,RView);
00163   public:
00165     virtual Actor* copy(Space& home,bool);
00166     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00168     virtual size_t dispose(Space& home);
00170     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00176     static  ExecStatus  post(Home home,SView z,const IntSetArgs& x,RView y);
00177   };
00178 
00185   template<class SView, class RView>
00186   class ElementDisjoint : public Propagator {
00187   public:
00188     typedef Gecode::Int::IdxViewArray<SView> IdxViewArray;
00189   protected:
00190     IdxViewArray iv;
00191     RView x1;
00192 
00194     ElementDisjoint(Space& home, bool share,ElementDisjoint& p);
00196     ElementDisjoint(Home home,IdxViewArray&,RView);
00197   public:
00199     virtual Actor*      copy(Space& home,bool);
00200     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00202     virtual size_t dispose(Space& home);
00204     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00206     static  ExecStatus  post(Home home,IdxViewArray& x,RView y);
00207   };
00208 
00209 }}}
00210 
00211 #include <gecode/set/element/inter.hpp>
00212 #include <gecode/set/element/union.hpp>
00213 #include <gecode/set/element/unionConst.hpp>
00214 #include <gecode/set/element/disjoint.hpp>
00215 
00216 #endif
00217 
00218 // STATISTICS: set-prop
00219