Generated on Tue Apr 18 10:21:53 2017 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: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
00013  *     $Revision: 15137 $
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 {
00051 
00053   template<>
00054   class ViewToVarArg<Gecode::Set::SetView> {
00055   public:
00056     typedef Gecode::SetVarArgs argtype;
00057   };
00058 
00060   template<>
00061   class ViewToVarArg<Gecode::Set::SingletonView> {
00062   public:
00063     typedef Gecode::IntVarArgs argtype;
00064   };
00065 
00066 }}
00067 
00068 namespace Gecode { namespace Set { namespace Element {
00069 
00081   template<class View, class View0, class View1>
00082   class ElementIntersection : public Propagator {
00083   public:
00084     typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
00085   protected:
00086     IntSet universe;
00087     IdxViewArray iv;
00088     View0 x0;
00089     View1 x1;
00090 
00092     ElementIntersection(Space& home, bool share,ElementIntersection& p);
00094     ElementIntersection(Home home,IdxViewArray&,View0,View1,
00095                        const IntSet& universe);
00096   public:
00098     virtual Actor* copy(Space& home,bool);
00100     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00102     virtual void reschedule(Space& home);
00104     virtual size_t dispose(Space& home);
00106     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00112     static ExecStatus post(Home home,IdxViewArray& x, View0 y,
00113                            View1 z, const IntSet& u);
00114   };
00115 
00122   template<class View, class View0, class View1>
00123   class ElementUnion : public Propagator {
00124   public:
00125     typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
00126   protected:
00127     IdxViewArray iv;
00128     View0 x0;
00129     View1 x1;
00130 
00132     ElementUnion(Space& home, bool share,ElementUnion& p);
00134     ElementUnion(Home home,IdxViewArray&,View0,View1);
00135   public:
00137     virtual Actor* copy(Space& home,bool);
00139     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00141     virtual void reschedule(Space& home);
00143     virtual size_t dispose(Space& home);
00145     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00151     static  ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
00152   };
00153 
00160   template<class SView, class RView>
00161   class ElementUnionConst : public Propagator {
00162   protected:
00163     SView x0;
00164     IntSet* iv;
00165     int n_iv;
00166     RView x1;
00167 
00169     ElementUnionConst(Space& home, bool share,ElementUnionConst& p);
00171     ElementUnionConst(Home home,SView,const IntSetArgs&,RView);
00172   public:
00174     virtual Actor* copy(Space& home,bool);
00176     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00178     virtual void reschedule(Space& home);
00180     virtual size_t dispose(Space& home);
00182     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00188     static  ExecStatus  post(Home home,SView z,const IntSetArgs& x,RView y);
00189   };
00190 
00197   template<class SView, class RView>
00198   class ElementDisjoint : public Propagator {
00199   public:
00200     typedef Gecode::Int::IdxViewArray<SView> IdxViewArray;
00201   protected:
00202     IdxViewArray iv;
00203     RView x1;
00204 
00206     ElementDisjoint(Space& home, bool share,ElementDisjoint& p);
00208     ElementDisjoint(Home home,IdxViewArray&,RView);
00209   public:
00211     virtual Actor*      copy(Space& home,bool);
00213     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00215     virtual void reschedule(Space& home);
00217     virtual size_t dispose(Space& home);
00219     virtual ExecStatus  propagate(Space& home, const ModEventDelta& med);
00221     static  ExecStatus  post(Home home,IdxViewArray& x,RView y);
00222   };
00223 
00224 }}}
00225 
00226 #include <gecode/set/element/inter.hpp>
00227 #include <gecode/set/element/union.hpp>
00228 #include <gecode/set/element/unionConst.hpp>
00229 #include <gecode/set/element/disjoint.hpp>
00230 
00231 #endif
00232 
00233 // STATISTICS: set-prop
00234