main page
modules
namespaces
classes
files
Gecode home
Generated on Wed Sep 5 2012 18:51:51 for Gecode by
doxygen
1.8.1.1
gecode
int
view
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: 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
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
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
(
double
n)
const
{
106
return
x
->
in
(n);
107
}
108
109
110
/*
111
* Domain update by value
112
*
113
*/
114
forceinline
ModEvent
115
IntView::lq
(
Space
& home,
int
n) {
116
return
x
->
lq
(home,n);
117
}
118
forceinline
ModEvent
119
IntView::lq
(
Space
& home,
double
n) {
120
return
x
->
lq
(home,n);
121
}
122
123
forceinline
ModEvent
124
IntView::le
(
Space
& home,
int
n) {
125
return
x
->
lq
(home,n-1);
126
}
127
forceinline
ModEvent
128
IntView::le
(
Space
& home,
double
n) {
129
return
lq
(home,n-1.0);
130
}
131
132
forceinline
ModEvent
133
IntView::gq
(
Space
& home,
int
n) {
134
return
x
->
gq
(home,n);
135
}
136
forceinline
ModEvent
137
IntView::gq
(
Space
& home,
double
n) {
138
return
x
->
gq
(home,n);
139
}
140
141
forceinline
ModEvent
142
IntView::gr
(
Space
& home,
int
n) {
143
return
x
->
gq
(home,n+1);
144
}
145
forceinline
ModEvent
146
IntView::gr
(
Space
& home,
double
n) {
147
return
gq
(home,n+1.0);
148
}
149
150
forceinline
ModEvent
151
IntView::nq
(
Space
& home,
int
n) {
152
return
x
->
nq
(home,n);
153
}
154
forceinline
ModEvent
155
IntView::nq
(
Space
& home,
double
n) {
156
return
x
->
nq
(home,n);
157
}
158
159
forceinline
ModEvent
160
IntView::eq
(
Space
& home,
int
n) {
161
return
x
->
eq
(home,n);
162
}
163
forceinline
ModEvent
164
IntView::eq
(
Space
& home,
double
n) {
165
return
x
->
eq
(home,n);
166
}
167
168
169
/*
170
* Iterator-based domain update
171
*
172
*/
173
template
<
class
I>
174
forceinline
ModEvent
175
IntView::narrow_r
(
Space
& home, I&
i
,
bool
depend) {
176
return
x
->
narrow_r
(home,i,depend);
177
}
178
template
<
class
I>
179
forceinline
ModEvent
180
IntView::inter_r
(
Space
& home, I&
i
,
bool
depend) {
181
return
x
->
inter_r
(home,i,depend);
182
}
183
template
<
class
I>
184
forceinline
ModEvent
185
IntView::minus_r
(
Space
& home, I&
i
,
bool
depend) {
186
return
x
->
minus_r
(home,i,depend);
187
}
188
template
<
class
I>
189
forceinline
ModEvent
190
IntView::narrow_v
(
Space
& home, I&
i
,
bool
depend) {
191
return
x
->
narrow_v
(home,i,depend);
192
}
193
template
<
class
I>
194
forceinline
ModEvent
195
IntView::inter_v
(
Space
& home, I&
i
,
bool
depend) {
196
return
x
->
inter_v
(home,i,depend);
197
}
198
template
<
class
I>
199
forceinline
ModEvent
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
225
forceinline
ModEventDelta
226
IntView::med
(
ModEvent
me) {
227
return
VarImpView<IntVar>::med
(me);
228
}
229
230
235
template
<>
236
class
ViewRanges
<
IntView
> :
public
IntVarImpFwd
{
237
public
:
239
240
241
ViewRanges
(
void
);
243
ViewRanges
(
const
IntView
& x);
245
void
init
(
const
IntView
& x);
247
};
248
249
forceinline
250
ViewRanges<IntView>::ViewRanges
(
void
) {}
251
252
forceinline
253
ViewRanges<IntView>::ViewRanges
(
const
IntView
& x)
254
:
IntVarImpFwd
(x.varimp()) {}
255
256
forceinline
void
257
ViewRanges<IntView>::init
(
const
IntView
& x) {
258
IntVarImpFwd::init
(x.
varimp
());
259
}
260
261
}}
262
263
// STATISTICS: int-var
264