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: 2010-04-08 12:35:31 +0200 (Thu, 08 Apr 2010) $ by $Author: schulte $ 00011 * $Revision: 10684 $ 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, class A> 00052 class SupportValues { 00053 private: 00055 A& a; 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 Gecode::Support::BitSetBase bs; 00100 RangePos* rp_fst; 00102 RangePos* rp_lst; 00104 RangePos* rp; 00106 int v; 00108 int max; 00109 00111 bool _support(int n); 00112 public: 00114 SupportValues(A& a, View x); 00116 ~SupportValues(void); 00117 00119 00120 00121 void reset(void); 00123 bool operator ()(void) const; 00125 void operator ++(void); 00127 00129 00130 00131 int val(void) const; 00133 00135 00136 00137 void support(void); 00139 bool support(int n); 00141 bool support(double n); 00143 ModEvent tell(Space& home); 00145 }; 00146 00147 }} 00148 00149 #include <gecode/int/support-values.hpp> 00150 00151 #endif 00152 00153 // STATISTICS: int-prop 00154