main page
modules
namespaces
classes
files
Gecode home
Generated on Fri Aug 24 2012 04:52:12 for Gecode by
doxygen
1.8.1.2
gecode
int
view
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: 2010-09-01 01:19:33 +1000 (Wed, 01 Sep 2010) $ by $Author: schulte $
11
* $Revision: 11368 $
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
*/
44
forceinline
45
BoolView::BoolView
(
void
) {}
46
forceinline
47
BoolView::BoolView
(
const
BoolVar
& y)
48
:
VarImpView
<
BoolVar
>(y.varimp()) {}
49
forceinline
50
BoolView::BoolView
(
BoolVarImp
* y)
51
:
VarImpView
<
BoolVar
>(y) {}
52
53
/*
54
* Value access
55
*
56
*/
57
forceinline
BoolStatus
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
(
double
n)
const
{
110
return
x
->
in
(n);
111
}
112
113
114
/*
115
* Domain update by value
116
*
117
*/
118
forceinline
ModEvent
119
BoolView::lq
(
Space
& home,
int
n) {
120
return
x
->
lq
(home,n);
121
}
122
forceinline
ModEvent
123
BoolView::lq
(
Space
& home,
double
n) {
124
return
x
->
lq
(home,n);
125
}
126
127
forceinline
ModEvent
128
BoolView::le
(
Space
& home,
int
n) {
129
return
x
->
lq
(home,n-1);
130
}
131
forceinline
ModEvent
132
BoolView::le
(
Space
& home,
double
n) {
133
return
lq
(home,n-1.0);
134
}
135
136
forceinline
ModEvent
137
BoolView::gq
(
Space
& home,
int
n) {
138
return
x
->
gq
(home,n);
139
}
140
forceinline
ModEvent
141
BoolView::gq
(
Space
& home,
double
n) {
142
return
x
->
gq
(home,n);
143
}
144
145
forceinline
ModEvent
146
BoolView::gr
(
Space
& home,
int
n) {
147
return
x
->
gq
(home,n+1);
148
}
149
forceinline
ModEvent
150
BoolView::gr
(
Space
& home,
double
n) {
151
return
gq
(home,n+1.0);
152
}
153
154
forceinline
ModEvent
155
BoolView::nq
(
Space
& home,
int
n) {
156
return
x
->
nq
(home,n);
157
}
158
forceinline
ModEvent
159
BoolView::nq
(
Space
& home,
double
n) {
160
return
x
->
nq
(home,n);
161
}
162
163
forceinline
ModEvent
164
BoolView::eq
(
Space
& home,
int
n) {
165
return
x
->
eq
(home,n);
166
}
167
forceinline
ModEvent
168
BoolView::eq
(
Space
& home,
double
n) {
169
return
x
->
eq
(home,n);
170
}
171
172
173
/*
174
* Iterator-based domain update
175
*
176
*/
177
template
<
class
I>
178
forceinline
ModEvent
179
BoolView::narrow_r
(
Space
& home, I&
i
,
bool
depend) {
180
return
x
->
narrow_r
(home,i,depend);
181
}
182
template
<
class
I>
183
forceinline
ModEvent
184
BoolView::inter_r
(
Space
& home, I&
i
,
bool
depend) {
185
return
x
->
inter_r
(home,i,depend);
186
}
187
template
<
class
I>
188
forceinline
ModEvent
189
BoolView::minus_r
(
Space
& home, I&
i
,
bool
depend) {
190
return
x
->
minus_r
(home,i,depend);
191
}
192
template
<
class
I>
193
forceinline
ModEvent
194
BoolView::narrow_v
(
Space
& home, I&
i
,
bool
depend) {
195
return
x
->
narrow_v
(home,i,depend);
196
}
197
template
<
class
I>
198
forceinline
ModEvent
199
BoolView::inter_v
(
Space
& home, I&
i
,
bool
depend) {
200
return
x
->
inter_v
(home,i,depend);
201
}
202
template
<
class
I>
203
forceinline
ModEvent
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
*/
231
forceinline
ModEvent
232
BoolView::zero_none
(
Space
& home) {
233
return
x
->
zero_none
(home);
234
}
235
forceinline
ModEvent
236
BoolView::one_none
(
Space
& home) {
237
return
x
->
one_none
(home);
238
}
239
240
forceinline
ModEvent
241
BoolView::zero
(
Space
& home) {
242
return
x
->
zero
(home);
243
}
244
forceinline
ModEvent
245
BoolView::one
(
Space
& home) {
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
267
BoolView::zero
(
const
Delta
&
d
) {
268
return
BoolVarImp::zero
(d);
269
}
270
forceinline
bool
271
BoolView::one
(
const
Delta
&
d
) {
272
return
BoolVarImp::one
(d);
273
}
274
275
276
277
forceinline
ModEventDelta
278
BoolView::med
(
ModEvent
me) {
279
return
VarImpView<BoolVar>::med
(me);
280
}
281
286
template
<>
287
class
ViewRanges
<
BoolView
> :
public
Iter::Ranges::Singleton
{
288
public
:
290
291
292
ViewRanges
(
void
);
294
ViewRanges
(
const
BoolView
& x);
296
void
init
(
const
BoolView
& x);
298
};
299
300
forceinline
301
ViewRanges<BoolView>::ViewRanges
(
void
) {}
302
303
forceinline
304
ViewRanges<BoolView>::ViewRanges
(
const
BoolView
& x)
305
: Iter::Ranges::Singleton(x.
min
(),x.
max
()) {}
306
307
forceinline
void
308
ViewRanges<BoolView>::init
(
const
BoolView
& x) {
309
Iter::Ranges::Singleton::init
(x.
min
(),x.
max
());
310
}
311
312
}}
313
314
// STATISTICS: int-var