this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 *
6 * Contributing authors:
7 * Samuel Gagnon <samuel.gagnon92@gmail.com>
8 *
9 * Copyright:
10 * Christian Schulte, 2002
11 * Samuel Gagnon, 2018
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
38namespace Gecode { namespace Int {
39
40 /*
41 * Constructors and initialization
42 *
43 */
44 forceinline
45 IntView::IntView(void) {}
46 forceinline
47 IntView::IntView(const IntVar& y)
48 : VarImpView<IntVar>(y.varimp()) {}
49 forceinline
50 IntView::IntView(IntVarImp* y)
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#ifdef GECODE_HAS_CBS
74 forceinline int
75 IntView::baseval(int val) const {
76 return val;
77 }
78#endif
79
80 forceinline unsigned int
81 IntView::size(void) const {
82 return x->size();
83 }
84 forceinline unsigned int
85 IntView::width(void) const {
86 return x->width();
87 }
88 forceinline unsigned int
89 IntView::regret_min(void) const {
90 return x->regret_min();
91 }
92 forceinline unsigned int
93 IntView::regret_max(void) const {
94 return x->regret_max();
95 }
96
97
98 /*
99 * Domain tests
100 *
101 */
102 forceinline bool
103 IntView::range(void) const {
104 return x->range();
105 }
106 forceinline bool
107 IntView::in(int n) const {
108 return x->in(n);
109 }
110 forceinline bool
111 IntView::in(long long int n) const {
112 return x->in(n);
113 }
114
115
116 /*
117 * Domain update by value
118 *
119 */
120 forceinline ModEvent
121 IntView::lq(Space& home, int n) {
122 return x->lq(home,n);
123 }
124 forceinline ModEvent
125 IntView::lq(Space& home, long long int n) {
126 return x->lq(home,n);
127 }
128
129 forceinline ModEvent
130 IntView::le(Space& home, int n) {
131 return x->lq(home,n-1);
132 }
133 forceinline ModEvent
134 IntView::le(Space& home, long long int n) {
135 return x->lq(home,n-1);
136 }
137
138 forceinline ModEvent
139 IntView::gq(Space& home, int n) {
140 return x->gq(home,n);
141 }
142 forceinline ModEvent
143 IntView::gq(Space& home, long long int n) {
144 return x->gq(home,n);
145 }
146
147 forceinline ModEvent
148 IntView::gr(Space& home, int n) {
149 return x->gq(home,n+1);
150 }
151 forceinline ModEvent
152 IntView::gr(Space& home, long long int n) {
153 return x->gq(home,n+1);
154 }
155
156 forceinline ModEvent
157 IntView::nq(Space& home, int n) {
158 return x->nq(home,n);
159 }
160 forceinline ModEvent
161 IntView::nq(Space& home, long long int n) {
162 return x->nq(home,n);
163 }
164
165 forceinline ModEvent
166 IntView::eq(Space& home, int n) {
167 return x->eq(home,n);
168 }
169 forceinline ModEvent
170 IntView::eq(Space& home, long long int n) {
171 return x->eq(home,n);
172 }
173
174
175 /*
176 * Iterator-based domain update
177 *
178 */
179 template<class I>
180 forceinline ModEvent
181 IntView::narrow_r(Space& home, I& i, bool depend) {
182 return x->narrow_r(home,i,depend);
183 }
184 template<class I>
185 forceinline ModEvent
186 IntView::inter_r(Space& home, I& i, bool depend) {
187 return x->inter_r(home,i,depend);
188 }
189 template<class I>
190 forceinline ModEvent
191 IntView::minus_r(Space& home, I& i, bool depend) {
192 return x->minus_r(home,i,depend);
193 }
194 template<class I>
195 forceinline ModEvent
196 IntView::narrow_v(Space& home, I& i, bool depend) {
197 return x->narrow_v(home,i,depend);
198 }
199 template<class I>
200 forceinline ModEvent
201 IntView::inter_v(Space& home, I& i, bool depend) {
202 return x->inter_v(home,i,depend);
203 }
204 template<class I>
205 forceinline ModEvent
206 IntView::minus_v(Space& home, I& i, bool depend) {
207 return x->minus_v(home,i,depend);
208 }
209
210
211
212
213 /*
214 * Delta information for advisors
215 *
216 */
217 forceinline int
218 IntView::min(const Delta& d) const {
219 return IntVarImp::min(d);
220 }
221 forceinline int
222 IntView::max(const Delta& d) const {
223 return IntVarImp::max(d);
224 }
225 forceinline unsigned int
226 IntView::width(const Delta& d) const {
227 return IntVarImp::width(d);
228 }
229 forceinline bool
230 IntView::any(const Delta& d) const {
231 return IntVarImp::any(d);
232 }
233
234
235 forceinline ModEventDelta
236 IntView::med(ModEvent me) {
237 return VarImpView<IntVar>::med(me);
238 }
239
240
241 /**
242 * \brief %Range iterator for integer variable views
243 * \ingroup TaskActorIntView
244 */
245 template<>
246 class ViewRanges<IntView> : public IntVarImpFwd {
247 public:
248 /// \name Constructors and initialization
249 //@{
250 /// Default constructor
251 ViewRanges(void);
252 /// Initialize with ranges for view \a x
253 ViewRanges(const IntView& x);
254 /// Initialize with ranges for view \a x
255 void init(const IntView& x);
256 //@}
257 };
258
259 forceinline
260 ViewRanges<IntView>::ViewRanges(void) {}
261
262 forceinline
263 ViewRanges<IntView>::ViewRanges(const IntView& x)
264 : IntVarImpFwd(x.varimp()) {}
265
266 forceinline void
267 ViewRanges<IntView>::init(const IntView& x) {
268 IntVarImpFwd::init(x.varimp());
269 }
270
271}}
272
273// STATISTICS: int-var
274