this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Guido Tack <tack@gecode.org>
5 *
6 * Contributing authors:
7 * Christian Schulte <schulte@gecode.org>
8 * Gabor Szokoli <szokoli@gecode.org>
9 *
10 * Copyright:
11 * Guido Tack, 2004
12 * Christian Schulte, 2004
13 * Gabor Szokoli, 2004
14 *
15 * This file is part of Gecode, the generic constraint
16 * development environment:
17 * http://www.gecode.org
18 *
19 * Permission is hereby granted, free of charge, to any person obtaining
20 * a copy of this software and associated documentation files (the
21 * "Software"), to deal in the Software without restriction, including
22 * without limitation the rights to use, copy, modify, merge, publish,
23 * distribute, sublicense, and/or sell copies of the Software, and to
24 * permit persons to whom the Software is furnished to do so, subject to
25 * the following conditions:
26 *
27 * The above copyright notice and this permission notice shall be
28 * included in all copies or substantial portions of the Software.
29 *
30 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 *
38 */
39
40namespace Gecode { namespace Set {
41
42 /*
43 * Constructors and access
44 *
45 */
46
47 forceinline
48 SetView::SetView(void) {}
49 forceinline
50 SetView::SetView(const SetVar& y)
51 : VarImpView<SetVar>(y.varimp()) {}
52 forceinline
53 SetView::SetView(SetVarImp* y)
54 : VarImpView<SetVar>(y) {}
55
56 /*
57 * Variable information
58 *
59 */
60
61 forceinline unsigned int
62 SetView::glbSize(void) const {
63 return x->glbSize();
64 }
65 forceinline unsigned int
66 SetView::lubSize(void) const {
67 return x->lubSize();
68 }
69 forceinline unsigned int
70 SetView::unknownSize(void) const {
71 return x->lubSize() - x->glbSize();
72 }
73 forceinline bool
74 SetView::contains(int i) const {
75 return x->knownIn(i);
76 }
77 forceinline bool
78 SetView::notContains(int i) const {
79 return x->knownOut(i);
80 }
81 forceinline unsigned int
82 SetView::cardMin(void) const {
83 return x->cardMin();
84 }
85 forceinline unsigned int
86 SetView::cardMax(void) const {
87 return x->cardMax();
88 }
89 forceinline int
90 SetView::lubMin(void) const {
91 return x->lubMin();
92 }
93 forceinline int
94 SetView::lubMax(void) const {
95 return x->lubMax();
96 }
97 forceinline int
98 SetView::lubMinN(unsigned int n) const {
99 return x->lubMinN(n);
100 }
101 forceinline int
102 SetView::glbMin(void) const {
103 return x->glbMin();
104 }
105 forceinline int
106 SetView::glbMax(void) const {
107 return x->glbMax();
108 }
109
110 /*
111 * Tells
112 *
113 */
114
115 forceinline ModEvent
116 SetView::cardMin(Space& home, unsigned int m) {
117 return x->cardMin(home, m);
118 }
119
120 forceinline ModEvent
121 SetView::cardMax(Space& home, unsigned int m) {
122 return x->cardMax(home, m);
123 }
124
125 forceinline ModEvent
126 SetView::include(Space& home, int from, int to) {
127 return x->include(home,from,to);
128 }
129
130 forceinline ModEvent
131 SetView::include(Space& home, int n) {
132 return x->include(home,n);
133 }
134
135 forceinline ModEvent
136 SetView::exclude(Space& home, int n) {
137 return x->exclude(home, n);
138 }
139
140 forceinline ModEvent
141 SetView::intersect(Space& home, int from, int to) {
142 return x->intersect(home,from,to);
143 }
144
145 forceinline ModEvent
146 SetView::intersect(Space& home, int n) {
147 return x->intersect(home,n);
148 }
149
150 template<class I> ModEvent
151 SetView::includeI(Space& home, I& iter) {
152 return x->includeI(home, iter);
153 }
154
155 forceinline ModEvent
156 SetView::exclude(Space& home, int from, int to) {
157 return x->exclude(home,from,to);
158 }
159 template<class I> ModEvent
160 SetView::excludeI(Space& home, I& iter) {
161 return x->excludeI(home, iter);
162 }
163 template<class I> ModEvent
164 SetView::intersectI(Space& home, I& iter) {
165 return x->intersectI(home, iter);
166 }
167
168
169 /*
170 * Delta information for advisors
171 *
172 */
173
174 forceinline ModEvent
175 SetView::modevent(const Delta& d) {
176 return SetVarImp::modevent(d);
177 }
178
179 forceinline int
180 SetView::glbMin(const Delta& d) const {
181 return SetVarImp::glbMin(d);
182 }
183 forceinline int
184 SetView::glbMax(const Delta& d) const {
185 return SetVarImp::glbMax(d);
186 }
187 forceinline bool
188 SetView::glbAny(const Delta& d) const {
189 return SetVarImp::glbAny(d);
190 }
191
192 forceinline int
193 SetView::lubMin(const Delta& d) const {
194 return SetVarImp::lubMin(d);
195 }
196 forceinline int
197 SetView::lubMax(const Delta& d) const {
198 return SetVarImp::lubMax(d);
199 }
200 forceinline bool
201 SetView::lubAny(const Delta& d) const {
202 return SetVarImp::lubAny(d);
203 }
204
205
206 /**
207 * \brief %Range iterator for least upper bound of set variable views
208 * \ingroup TaskActorSetView
209 */
210 template<>
211 class LubRanges<SetView> : public LubRanges<SetVarImp*> {
212 public:
213 /// \name Constructors and initialization
214 //@{
215 /// Default constructor
216 LubRanges(void);
217 /// Initialize with ranges for view \a x
218 LubRanges(const SetView& x);
219 /// Initialize with ranges for view \a x
220 void init(const SetView& x);
221 //@}
222 };
223
224 forceinline
225 LubRanges<SetView>::LubRanges(void) {}
226
227 forceinline
228 LubRanges<SetView>::LubRanges(const SetView& x)
229 : LubRanges<SetVarImp*>(x.varimp()) {}
230
231 forceinline void
232 LubRanges<SetView>::init(const SetView& x) {
233 LubRanges<SetVarImp*>::init(x.varimp());
234 }
235
236
237 /**
238 * \brief %Range iterator for greatest lower bound of set variable views
239 * \ingroup TaskActorSetView
240 */
241 template<>
242 class GlbRanges<SetView> : public GlbRanges<SetVarImp*> {
243 public:
244 /// \name Constructors and initialization
245 //@{
246 /// Default constructor
247 GlbRanges(void);
248 /// Initialize with ranges for view \a x
249 GlbRanges(const SetView& x);
250 /// Initialize with ranges for view \a x
251 void init(const SetView& x);
252 };
253
254 forceinline
255 GlbRanges<SetView>::GlbRanges(void) {}
256
257 forceinline
258 GlbRanges<SetView>::GlbRanges(const SetView& x)
259 : GlbRanges<SetVarImp*>(x.varimp()) {}
260
261 forceinline void
262 GlbRanges<SetView>::init(const SetView& x) {
263 GlbRanges<SetVarImp*>::init(x.varimp());
264 }
265
266}}
267
268// STATISTICS: set-var
269