Generated on Sat Nov 9 2013 19:18:28 for Gecode by doxygen 1.8.4
int.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<IntVar>(y.varimp()) {}
51  : VarImpView<IntVar>(y) {}
52 
53  /*
54  * Value access
55  *
56  */
57  forceinline int
58  IntView::min(void) const {
59  return x->min();
60  }
61  forceinline int
62  IntView::max(void) const {
63  return x->max();
64  }
65  forceinline int
66  IntView::med(void) const {
67  return x->med();
68  }
69  forceinline int
70  IntView::val(void) const {
71  return x->val();
72  }
73 
74  forceinline unsigned int
75  IntView::size(void) const {
76  return x->size();
77  }
78  forceinline unsigned int
79  IntView::width(void) const {
80  return x->width();
81  }
82  forceinline unsigned int
83  IntView::regret_min(void) const {
84  return x->regret_min();
85  }
86  forceinline unsigned int
87  IntView::regret_max(void) const {
88  return x->regret_max();
89  }
90 
91 
92  /*
93  * Domain tests
94  *
95  */
96  forceinline bool
97  IntView::range(void) const {
98  return x->range();
99  }
100  forceinline bool
101  IntView::in(int n) const {
102  return x->in(n);
103  }
104  forceinline bool
105  IntView::in(long long int n) const {
106  return x->in(n);
107  }
108 
109 
110  /*
111  * Domain update by value
112  *
113  */
115  IntView::lq(Space& home, int n) {
116  return x->lq(home,n);
117  }
119  IntView::lq(Space& home, long long int n) {
120  return x->lq(home,n);
121  }
122 
124  IntView::le(Space& home, int n) {
125  return x->lq(home,n-1);
126  }
128  IntView::le(Space& home, long long int n) {
129  return x->lq(home,n-1);
130  }
131 
133  IntView::gq(Space& home, int n) {
134  return x->gq(home,n);
135  }
137  IntView::gq(Space& home, long long int n) {
138  return x->gq(home,n);
139  }
140 
142  IntView::gr(Space& home, int n) {
143  return x->gq(home,n+1);
144  }
146  IntView::gr(Space& home, long long int n) {
147  return x->gq(home,n+1);
148  }
149 
151  IntView::nq(Space& home, int n) {
152  return x->nq(home,n);
153  }
155  IntView::nq(Space& home, long long int n) {
156  return x->nq(home,n);
157  }
158 
160  IntView::eq(Space& home, int n) {
161  return x->eq(home,n);
162  }
164  IntView::eq(Space& home, long long int n) {
165  return x->eq(home,n);
166  }
167 
168 
169  /*
170  * Iterator-based domain update
171  *
172  */
173  template<class I>
175  IntView::narrow_r(Space& home, I& i, bool depend) {
176  return x->narrow_r(home,i,depend);
177  }
178  template<class I>
180  IntView::inter_r(Space& home, I& i, bool depend) {
181  return x->inter_r(home,i,depend);
182  }
183  template<class I>
185  IntView::minus_r(Space& home, I& i, bool depend) {
186  return x->minus_r(home,i,depend);
187  }
188  template<class I>
190  IntView::narrow_v(Space& home, I& i, bool depend) {
191  return x->narrow_v(home,i,depend);
192  }
193  template<class I>
195  IntView::inter_v(Space& home, I& i, bool depend) {
196  return x->inter_v(home,i,depend);
197  }
198  template<class I>
200  IntView::minus_v(Space& home, I& i, bool depend) {
201  return x->minus_v(home,i,depend);
202  }
203 
204 
205 
206 
207  /*
208  * Delta information for advisors
209  *
210  */
211  forceinline int
212  IntView::min(const Delta& d) const {
213  return IntVarImp::min(d);
214  }
215  forceinline int
216  IntView::max(const Delta& d) const {
217  return IntVarImp::max(d);
218  }
219  forceinline bool
220  IntView::any(const Delta& d) const {
221  return IntVarImp::any(d);
222  }
223 
224 
227  return VarImpView<IntVar>::med(me);
228  }
229 
230 
235  template<>
236  class ViewRanges<IntView> : public IntVarImpFwd {
237  public:
239 
240  ViewRanges(void);
243  ViewRanges(const IntView& x);
245  void init(const IntView& x);
247  };
248 
251 
254  : IntVarImpFwd(x.varimp()) {}
255 
256  forceinline void
259  }
260 
261 }}
262 
263 // STATISTICS: int-var
264