Generated on Sat May 25 2013 18:00:39 for Gecode by doxygen 1.8.3.1
bool.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2002
8  *
9  * Last modified:
10  * $Date: 2013-02-14 16:29:11 +0100 (Thu, 14 Feb 2013) $ by $Author: schulte $
11  * $Revision: 13292 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 namespace Gecode { namespace Int {
39 
40  /*
41  * Constructors and initialization
42  *
43  */
48  : VarImpView<BoolVar>(y.varimp()) {}
51  : VarImpView<BoolVar>(y) {}
52 
53  /*
54  * Value access
55  *
56  */
58  BoolView::status(void) const {
59  return x->status();
60  }
61  forceinline int
62  BoolView::min(void) const {
63  return x->min();
64  }
65  forceinline int
66  BoolView::max(void) const {
67  return x->max();
68  }
69  forceinline int
70  BoolView::med(void) const {
71  return x->med();
72  }
73  forceinline int
74  BoolView::val(void) const {
75  return x->val();
76  }
77 
78  forceinline unsigned int
79  BoolView::size(void) const {
80  return x->size();
81  }
82  forceinline unsigned int
83  BoolView::width(void) const {
84  return x->width();
85  }
86  forceinline unsigned int
87  BoolView::regret_min(void) const {
88  return x->regret_min();
89  }
90  forceinline unsigned int
91  BoolView::regret_max(void) const {
92  return x->regret_max();
93  }
94 
95 
96  /*
97  * Domain tests
98  *
99  */
100  forceinline bool
101  BoolView::range(void) const {
102  return x->range();
103  }
104  forceinline bool
105  BoolView::in(int n) const {
106  return x->in(n);
107  }
108  forceinline bool
109  BoolView::in(long long int n) const {
110  return x->in(n);
111  }
112 
113 
114  /*
115  * Domain update by value
116  *
117  */
119  BoolView::lq(Space& home, int n) {
120  return x->lq(home,n);
121  }
123  BoolView::lq(Space& home, long long int n) {
124  return x->lq(home,n);
125  }
126 
128  BoolView::le(Space& home, int n) {
129  return x->lq(home,n-1);
130  }
132  BoolView::le(Space& home, long long int n) {
133  return x->lq(home,n-1);
134  }
135 
137  BoolView::gq(Space& home, int n) {
138  return x->gq(home,n);
139  }
141  BoolView::gq(Space& home, long long int n) {
142  return x->gq(home,n);
143  }
144 
146  BoolView::gr(Space& home, int n) {
147  return x->gq(home,n+1);
148  }
150  BoolView::gr(Space& home, long long int n) {
151  return x->gq(home,n+1);
152  }
153 
155  BoolView::nq(Space& home, int n) {
156  return x->nq(home,n);
157  }
159  BoolView::nq(Space& home, long long int n) {
160  return x->nq(home,n);
161  }
162 
164  BoolView::eq(Space& home, int n) {
165  return x->eq(home,n);
166  }
168  BoolView::eq(Space& home, long long int n) {
169  return x->eq(home,n);
170  }
171 
172 
173  /*
174  * Iterator-based domain update
175  *
176  */
177  template<class I>
179  BoolView::narrow_r(Space& home, I& i, bool depend) {
180  return x->narrow_r(home,i,depend);
181  }
182  template<class I>
184  BoolView::inter_r(Space& home, I& i, bool depend) {
185  return x->inter_r(home,i,depend);
186  }
187  template<class I>
189  BoolView::minus_r(Space& home, I& i, bool depend) {
190  return x->minus_r(home,i,depend);
191  }
192  template<class I>
194  BoolView::narrow_v(Space& home, I& i, bool depend) {
195  return x->narrow_v(home,i,depend);
196  }
197  template<class I>
199  BoolView::inter_v(Space& home, I& i, bool depend) {
200  return x->inter_v(home,i,depend);
201  }
202  template<class I>
204  BoolView::minus_v(Space& home, I& i, bool depend) {
205  return x->minus_v(home,i,depend);
206  }
207 
208 
209  /*
210  * Boolean domain tests
211  *
212  */
213  forceinline bool
214  BoolView::zero(void) const {
215  return x->zero();
216  }
217  forceinline bool
218  BoolView::one(void) const {
219  return x->one();
220  }
221  forceinline bool
222  BoolView::none(void) const {
223  return x->none();
224  }
225 
226 
227  /*
228  * Boolean assignment operations
229  *
230  */
233  return x->zero_none(home);
234  }
237  return x->one_none(home);
238  }
239 
242  return x->zero(home);
243  }
246  return x->one(home);
247  }
248 
249 
250  /*
251  * Delta information for advisors
252  *
253  */
254  forceinline int
255  BoolView::min(const Delta& d) const {
256  return BoolVarImp::min(d);
257  }
258  forceinline int
259  BoolView::max(const Delta& d) const {
260  return BoolVarImp::max(d);
261  }
262  forceinline bool
263  BoolView::any(const Delta& d) const {
264  return BoolVarImp::any(d);
265  }
266  forceinline bool
268  return BoolVarImp::zero(d);
269  }
270  forceinline bool
272  return BoolVarImp::one(d);
273  }
274 
275 
276 
279  return VarImpView<BoolVar>::med(me);
280  }
281 
286  template<>
288  public:
290 
291 
292  ViewRanges(void);
294  ViewRanges(const BoolView& x);
296  void init(const BoolView& x);
298  };
299 
302 
305  : Iter::Ranges::Singleton(x.min(),x.max()) {}
306 
307  forceinline void
310  }
311 
312 }}
313 
314 // STATISTICS: int-var