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

support-values.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2008
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-07-11 09:44:29 +0200 (Fri, 11 Jul 2008) $ by $Author: tack $
00011  *     $Revision: 7307 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *  Permission is hereby granted, free of charge, to any person obtaining
00018  *  a copy of this software and associated documentation files (the
00019  *  "Software"), to deal in the Software without restriction, including
00020  *  without limitation the rights to use, copy, modify, merge, publish,
00021  *  distribute, sublicense, and/or sell copies of the Software, and to
00022  *  permit persons to whom the Software is furnished to do so, subject to
00023  *  the following conditions:
00024  *
00025  *  The above copyright notice and this permission notice shall be
00026  *  included in all copies or substantial portions of the Software.
00027  *
00028  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #ifndef __GECODE_INT_SUPPORT_VALUES_HH__
00039 #define __GECODE_INT_SUPPORT_VALUES_HH__
00040 
00041 #include "gecode/int.hh"
00042 
00043 namespace Gecode { namespace Int {
00044 
00051   template<class View>
00052   class SupportValues {
00053   private:
00055     static const unsigned int bpui = sizeof(unsigned int) * 8;
00057     class RangePos {
00058     public:
00059       int min;          
00060       unsigned int pos; 
00061     };
00063     class Unsupported {
00064     private:
00066       RangePos* rp;
00068       unsigned int p;
00070       SupportValues& sv;
00072       void find(void);
00073     public:
00075 
00076 
00077       Unsupported(SupportValues& sv0);
00079       
00081 
00082 
00083       bool operator()(void) const;
00085       void operator++(void);
00087       
00089 
00090 
00091       int val(void) const;
00093     };
00094     
00096     View x;
00098     unsigned int* bits;
00100     RangePos* rp_fst;
00102     RangePos* rp_lst;
00104     RangePos* rp;
00106     int v;
00108     int max;
00109 
00111     void set(unsigned int i);
00113     bool bit(unsigned int i) const;
00115     bool _support(int n);
00116   public:
00118     SupportValues(View x);
00120     ~SupportValues(void);
00121     
00123 
00124 
00125     void reset(void);
00127     bool operator()(void) const;
00129     void operator++(void);
00131     
00133 
00134 
00135     int val(void) const;
00137     
00139 
00140 
00141     void support(void);
00143     bool support(int n);
00145     bool support(double n);
00147     ModEvent tell(Space* home);
00149   };
00150 
00151 }}
00152 
00153 #include "gecode/int/support-values.icc"
00154 
00155 #endif
00156 
00157 // STATISTICS: int-prop
00158