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