Generated on Tue May 22 09:39:59 2018 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  *  This file is part of Gecode, the generic constraint
00012  *  development environment:
00013  *     http://www.gecode.org
00014  *
00015  *  Permission is hereby granted, free of charge, to any person obtaining
00016  *  a copy of this software and associated documentation files (the
00017  *  "Software"), to deal in the Software without restriction, including
00018  *  without limitation the rights to use, copy, modify, merge, publish,
00019  *  distribute, sublicense, and/or sell copies of the Software, and to
00020  *  permit persons to whom the Software is furnished to do so, subject to
00021  *  the following conditions:
00022  *
00023  *  The above copyright notice and this permission notice shall be
00024  *  included in all copies or substantial portions of the Software.
00025  *
00026  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00027  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00028  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00029  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00030  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00031  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00032  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00033  *
00034  */
00035 
00036 #ifndef __GECODE_SET_SELECT_HH__
00037 #define __GECODE_SET_SELECT_HH__
00038 
00039 #include <gecode/set.hh>
00040 
00041 #include <gecode/int/idx-view.hh>
00042 #include <gecode/int/element.hh>
00043 #include <gecode/set/rel.hh>
00044 #include <gecode/set/rel-op.hh>
00045 
00046 namespace Gecode { namespace Int {
00047 
00049   template<>
00050   class ViewToVarArg<Gecode::Set::SetView> {
00051   public:
00052     typedef Gecode::SetVarArgs argtype;
00053   };
00054 
00056   template<>
00057   class ViewToVarArg<Gecode::Set::SingletonView> {
00058   public:
00059     typedef Gecode::IntVarArgs argtype;
00060   };
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::IdxViewArray<View> IdxViewArray;
00081   protected:
00082     IntSet universe;
00083     IdxViewArray iv;
00084     View0 x0;
00085     View1 x1;
00086 
00088     ElementIntersection(Space& home, ElementIntersection& p);
00090     ElementIntersection(Home home, IdxViewArray&,View0,View1,
00091                        const IntSet& universe);
00092   public:
00094     virtual Actor* copy(Space& home);
00096     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00098     virtual void reschedule(Space& home);
00100     virtual size_t dispose(Space& home);
00102     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00108     static ExecStatus post(Home home,IdxViewArray& x, View0 y,
00109                            View1 z, const IntSet& u);
00110   };
00111 
00118   template<class View, class View0, class View1>
00119   class ElementUnion : public Propagator {
00120   public:
00121     typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
00122   protected:
00123     IdxViewArray iv;
00124     View0 x0;
00125     View1 x1;
00126 
00128     ElementUnion(Space& home, ElementUnion& p);
00130     ElementUnion(Home home,IdxViewArray&,View0,View1);
00131   public:
00133     virtual Actor* copy(Space& home);
00135     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00137     virtual void reschedule(Space& home);
00139     virtual size_t dispose(Space& home);
00141     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00147     static  ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
00148   };
00149 
00156   template<class SView, class RView>
00157   class ElementUnionConst : public Propagator {
00158   protected:
00159     SView x0;
00160     IntSet* iv;
00161     int n_iv;
00162     RView x1;
00163 
00165     ElementUnionConst(Space& home, ElementUnionConst& p);
00167     ElementUnionConst(Home home, SView, const IntSetArgs&, RView);
00168   public:
00170     virtual Actor* copy(Space& home);
00172     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00174     virtual void reschedule(Space& home);
00176     virtual size_t dispose(Space& home);
00178     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00184     static  ExecStatus  post(Home home,SView z,const IntSetArgs& x,RView y);
00185   };
00186 
00193   template<class SView, class RView>
00194   class ElementDisjoint : public Propagator {
00195   public:
00196     typedef Gecode::Int::IdxViewArray<SView> IdxViewArray;
00197   protected:
00198     IdxViewArray iv;
00199     RView x1;
00200 
00202     ElementDisjoint(Space& home, ElementDisjoint& p);
00204     ElementDisjoint(Home home,IdxViewArray&,RView);
00205   public:
00207     virtual Actor* copy(Space& home);
00209     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00211     virtual void reschedule(Space& home);
00213     virtual size_t dispose(Space& home);
00215     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00217     static  ExecStatus  post(Home home,IdxViewArray& x,RView y);
00218   };
00219 
00220 }}}
00221 
00222 #include <gecode/set/element/inter.hpp>
00223 #include <gecode/set/element/union.hpp>
00224 #include <gecode/set/element/unionConst.hpp>
00225 #include <gecode/set/element/disjoint.hpp>
00226 
00227 #endif
00228 
00229 // STATISTICS: set-prop
00230