Generated on Mon Aug 25 11:35:44 2008 for Gecode by doxygen 1.5.6

set.icc

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  *
00006  *  Contributing authors:
00007  *     Christian Schulte <schulte@gecode.org>
00008  *     Gabor Szokoli <szokoli@gecode.org>
00009  *
00010  *  Copyright:
00011  *     Guido Tack, 2004
00012  *     Christian Schulte, 2004
00013  *     Gabor Szokoli, 2004
00014  *
00015  *  Last modified:
00016  *     $Date: 2008-01-31 18:29:16 +0100 (Thu, 31 Jan 2008) $ by $Author: tack $
00017  *     $Revision: 6017 $
00018  *
00019  *  This file is part of Gecode, the generic constraint
00020  *  development environment:
00021  *     http://www.gecode.org
00022  *
00023  *  Permission is hereby granted, free of charge, to any person obtaining
00024  *  a copy of this software and associated documentation files (the
00025  *  "Software"), to deal in the Software without restriction, including
00026  *  without limitation the rights to use, copy, modify, merge, publish,
00027  *  distribute, sublicense, and/or sell copies of the Software, and to
00028  *  permit persons to whom the Software is furnished to do so, subject to
00029  *  the following conditions:
00030  *
00031  *  The above copyright notice and this permission notice shall be
00032  *  included in all copies or substantial portions of the Software.
00033  *
00034  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00035  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00036  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00037  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00038  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00039  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00040  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00041  *
00042  */
00043 
00044 namespace Gecode { namespace Set {
00045 
00046   /*
00047    * Constructors and access
00048    *
00049    */
00050 
00051   forceinline
00052   SetView::SetView(void) {}
00053   forceinline
00054   SetView::SetView(const SetVar& y)
00055     : VarViewBase<SetVarImp>(y.var()) {}
00056   forceinline
00057   SetView::SetView(SetVarImp* y)
00058     : VarViewBase<SetVarImp>(y) {}
00059   forceinline
00060   SetView::SetView(Space* /*home*/, const Reflection::VarMap& vars,
00061                    Reflection::Arg* arg)
00062     : VarViewBase<SetVarImp>(SetVar(vars.var(arg->toVar())).var()) {}
00063 
00064   /*
00065    * Variable information
00066    *
00067    */
00068 
00069   forceinline bool
00070   SetView::assigned(void)  const { 
00071     return varimp->assigned(); 
00072   }
00073 
00074   forceinline unsigned int
00075   SetView::glbSize(void) const { return varimp->glbSize(); }
00076 
00077   forceinline unsigned int
00078   SetView::lubSize(void) const { return varimp->lubSize(); }
00079 
00080   forceinline unsigned int
00081   SetView::unknownSize(void) const { return varimp->lubSize() - varimp->glbSize(); }
00082 
00083   forceinline bool
00084   SetView::contains(int i) const { return (varimp->knownIn(i)); }
00085 
00086   forceinline bool
00087   SetView::notContains(int i) const { return (varimp->knownOut(i)); }
00088 
00089   forceinline unsigned int
00090   SetView::cardMin(void) const { return varimp->cardMin(); }
00091 
00092   forceinline unsigned int
00093   SetView::cardMax(void) const { return varimp->cardMax(); }
00094 
00095   forceinline int
00096   SetView::lubMin(void) const { return varimp->lubMin(); }
00097 
00098   forceinline int
00099   SetView::lubMax(void) const { return varimp->lubMax(); }
00100 
00101   forceinline int
00102   SetView::lubMinN(int n) const { return varimp->lubMinN(n); }
00103 
00104   forceinline int
00105   SetView::glbMin(void) const { return varimp->glbMin(); }
00106 
00107   forceinline int
00108   SetView::glbMax(void) const { return varimp->glbMax(); }
00109 
00110   /*
00111    * Tells
00112    *
00113    */
00114 
00115   forceinline ModEvent
00116   SetView::cardMin(Space* home, unsigned int m) {
00117     return varimp-> cardMin(home, m);
00118   }
00119 
00120   forceinline ModEvent
00121   SetView::cardMax(Space* home, unsigned int m) {
00122     return varimp-> cardMax(home, m);
00123   }
00124 
00125   forceinline ModEvent
00126   SetView::include (Space* home,int from, int to)
00127   { return (varimp->include(home,from,to)); }
00128 
00129   forceinline ModEvent
00130   SetView::include (Space* home,int n)
00131   { return (varimp->include(home,n)); }
00132 
00133   forceinline ModEvent
00134   SetView::exclude (Space* home,int n)
00135   { return (varimp->exclude(home, n)); }
00136 
00137   forceinline ModEvent
00138   SetView::intersect (Space* home,int from, int to)
00139   { return (varimp->intersect(home,from,to)); }
00140 
00141   forceinline ModEvent
00142   SetView::intersect (Space* home,int n)
00143   { return (varimp->intersect(home,n)); }
00144 
00145   template <class I> ModEvent
00146   SetView::includeI (Space* home, I& iter)
00147   { return (varimp->includeI(home, iter)); }
00148 
00149   forceinline ModEvent
00150   SetView::exclude (Space* home,int from, int to)
00151   { return (varimp->exclude(home,from,to)); }
00152 
00153   template <class I> ModEvent
00154   SetView::excludeI(Space* home, I& iter) {
00155     return varimp->excludeI(home, iter);
00156   }
00157 
00158   template <class I> ModEvent
00159   SetView::intersectI(Space* home, I& iter) {
00160     return varimp->intersectI(home, iter);
00161   }
00162 
00163 
00164 
00165   /*
00166    * Cloning
00167    *
00168    */
00169 
00170   forceinline void
00171   SetView::update(Space* home, bool share, SetView& y) {
00172     varimp = y.varimp->copy(home,share);
00173   }
00174 
00175   forceinline Reflection::Arg*
00176   SetView::spec(const Space* home, Reflection::VarMap& m) const {
00177     return varimp->spec(home, m);
00178   }
00179 
00180   inline Support::Symbol
00181   SetView::type(void) {
00182     return Support::Symbol("Gecode::Set::SetView");
00183   }
00184 
00185   /*
00186    * Delta information for advisors
00187    *
00188    */
00189 
00190   forceinline ModEvent
00191   SetView::modevent(const Delta* d) { return SetVarImp::modevent(d); }
00192   
00193   forceinline int
00194   SetView::glbMin(const Delta* d) const { return varimp->glbMin(d); }
00195 
00196   forceinline int
00197   SetView::glbMax(const Delta* d) const { return varimp->glbMax(d); }
00198 
00199   forceinline bool
00200   SetView::glbAny(const Delta* d) const { return varimp->glbAny(d); }
00201 
00202   forceinline int
00203   SetView::lubMin(const Delta* d) const { return varimp->lubMin(d); }
00204 
00205   forceinline int
00206   SetView::lubMax(const Delta* d) const { return varimp->lubMax(d); }
00207 
00208   forceinline bool
00209   SetView::lubAny(const Delta* d) const { return varimp->lubAny(d); }
00210 
00211 
00216   template <>
00217   class LubRanges<SetView> : public LubRanges<SetVarImp*> {
00218   public:
00220 
00221 
00222     LubRanges(void);
00224     LubRanges(const SetView& x);
00226     void init(const SetView& x);
00228   };
00229 
00230   forceinline
00231   LubRanges<SetView>::LubRanges(void) {}
00232 
00233   forceinline
00234   LubRanges<SetView>::LubRanges(const SetView& x)
00235     : LubRanges<SetVarImp*>(x.var()) {}
00236 
00237   forceinline void
00238   LubRanges<SetView>::init(const SetView& x) {
00239     LubRanges<SetVarImp*>::init(x.var());
00240   }
00241 
00242 
00247   template <>
00248   class GlbRanges<SetView> : public GlbRanges<SetVarImp*> {
00249   public:
00251 
00252 
00253     GlbRanges(void);
00255     GlbRanges(const SetView& x);
00257     void init(const SetView& x);
00258   };
00259 
00260   forceinline
00261   GlbRanges<SetView>::GlbRanges(void) {}
00262 
00263   forceinline
00264   GlbRanges<SetView>::GlbRanges(const SetView& x)
00265     : GlbRanges<SetVarImp*>(x.var()) {}
00266 
00267   forceinline void
00268   GlbRanges<SetView>::init(const SetView& x) {
00269     GlbRanges<SetVarImp*>::init(x.var());
00270   }
00271 
00272 }}
00273 
00274 // STATISTICS: set-var
00275