main page
modules
namespaces
classes
files
Gecode home
Generated on Thu Mar 13 2014 04:39:33 for Gecode by
doxygen
1.8.1.2
gecode
kernel
var-imp.hpp
Go to the documentation of this file.
1
/*
2
* CAUTION:
3
* This file has been automatically generated. Do not edit,
4
* edit the following files instead:
5
* - ./gecode/int/var-imp/int.vis
6
* - ./gecode/int/var-imp/bool.vis
7
* - ./gecode/set/var-imp/set.vis
8
*
9
* This file contains generated code fragments which are
10
* copyrighted as follows:
11
*
12
* Main author:
13
* Christian Schulte <schulte@gecode.org>
14
*
15
* Copyright:
16
* Christian Schulte, 2007
17
*
18
* The generated code fragments are part of Gecode, the generic
19
* constraint development environment:
20
* http://www.gecode.org
21
*
22
* Permission is hereby granted, free of charge, to any person obtaining
23
* a copy of this software and associated documentation files (the
24
* "Software"), to deal in the Software without restriction, including
25
* without limitation the rights to use, copy, modify, merge, publish,
26
* distribute, sublicense, and/or sell copies of the Software, and to
27
* permit persons to whom the Software is furnished to do so, subject to
28
* the following conditions:
29
*
30
* The above copyright notice and this permission notice shall be
31
* included in all copies or substantial portions of the Software.
32
*
33
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
37
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
38
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
39
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40
*
41
*/
42
43
#ifdef GECODE_HAS_INT_VARS
44
namespace
Gecode {
namespace
Int {
46
class
IntVarImpBase
:
public
Gecode::VarImp
<Gecode::Int::IntVarImpConf> {
47
protected
:
49
IntVarImpBase
(
Gecode::Space
& home,
bool
share,
IntVarImpBase
& x);
50
public
:
52
IntVarImpBase
(
void
);
54
IntVarImpBase
(
Gecode::Space
& home);
56
57
69
void
subscribe
(
Gecode::Space
& home,
Gecode::Propagator
& p,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule
);
71
void
subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned);
73
Gecode::ModEvent
notify
(
Gecode::Space
& home,
Gecode::ModEvent
me
,
Gecode::Delta
&
d
);
75
};
76
}}
77
#endif
78
#ifdef GECODE_HAS_INT_VARS
79
namespace
Gecode {
namespace
Int {
81
class
BoolVarImpBase
:
public
Gecode::VarImp
<Gecode::Int::BoolVarImpConf> {
82
protected
:
84
BoolVarImpBase
(
Gecode::Space
& home,
bool
share,
BoolVarImpBase
& x);
85
public
:
87
BoolVarImpBase
(
void
);
89
BoolVarImpBase
(
Gecode::Space
& home);
91
92
104
void
subscribe
(
Gecode::Space
& home,
Gecode::Propagator
& p,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule
);
106
void
subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned);
108
Gecode::ModEvent
notify
(
Gecode::Space
& home,
Gecode::ModEvent
me
,
Gecode::Delta
&
d
);
110
};
111
}}
112
#endif
113
#ifdef GECODE_HAS_SET_VARS
114
namespace
Gecode {
namespace
Set {
116
class
SetVarImpBase
:
public
Gecode::VarImp
<Gecode::Set::SetVarImpConf> {
117
protected
:
119
SetVarImpBase
(
Gecode::Space
& home,
bool
share,
SetVarImpBase
& x);
120
public
:
122
SetVarImpBase
(
void
);
124
SetVarImpBase
(
Gecode::Space
& home);
126
127
139
void
subscribe
(
Gecode::Space
& home,
Gecode::Propagator
& p,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule
);
141
void
subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned);
143
Gecode::ModEvent
notify
(
Gecode::Space
& home,
Gecode::ModEvent
me
,
Gecode::Delta
&
d
);
145
};
146
}}
147
#endif
148
#ifdef GECODE_HAS_INT_VARS
149
namespace
Gecode {
namespace
Int {
150
151
forceinline
152
IntVarImpBase::IntVarImpBase
(
void
) {}
153
154
forceinline
155
IntVarImpBase::IntVarImpBase
(
Gecode::Space
& home)
156
: Gecode::
VarImp
<Gecode::Int::
IntVarImpConf
>(home) {}
157
158
forceinline
159
IntVarImpBase::IntVarImpBase
(
Gecode::Space
& home,
bool
share,
IntVarImpBase
& x)
160
: Gecode::
VarImp
<Gecode::Int::
IntVarImpConf
>(home,share,x) {}
161
162
forceinline
void
163
IntVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Propagator
& p,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule) {
164
Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe
(home,p,pc,assigned,
ME_INT_BND
,schedule);
165
}
166
forceinline
void
167
IntVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned
) {
168
Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe
(home,a,assigned);
169
}
170
171
forceinline
Gecode::ModEvent
172
IntVarImpBase::notify
(
Gecode::Space
& home,
Gecode::ModEvent
me,
Gecode::Delta
&
d
) {
173
switch
(me) {
174
case
ME_INT_VAL
:
175
// Conditions: VAL, BND, DOM
176
schedule
(home,
PC_INT_VAL
,
PC_INT_DOM
,
ME_INT_VAL
);
177
if
(!
Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise
(home,
ME_INT_VAL
,d))
178
return
ME_INT_FAILED
;
179
cancel
(home);
180
break
;
181
case
ME_INT_BND
:
182
// Conditions: BND, DOM
183
schedule
(home,
PC_INT_BND
,
PC_INT_DOM
,
ME_INT_BND
);
184
if
(!
Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise
(home,
ME_INT_BND
,d))
185
return
ME_INT_FAILED
;
186
break
;
187
case
ME_INT_DOM
:
188
// Conditions: DOM
189
schedule
(home,
PC_INT_DOM
,
PC_INT_DOM
,
ME_INT_DOM
);
190
if
(!
Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise
(home,
ME_INT_DOM
,d))
191
return
ME_INT_FAILED
;
192
break
;
193
default
:
GECODE_NEVER
;
194
}
195
return
me
;
196
}
197
198
}}
199
#endif
200
#ifdef GECODE_HAS_INT_VARS
201
namespace
Gecode {
namespace
Int {
202
203
forceinline
204
BoolVarImpBase::BoolVarImpBase
(
void
) {}
205
206
forceinline
207
BoolVarImpBase::BoolVarImpBase
(
Gecode::Space
& home)
208
: Gecode::
VarImp
<Gecode::Int::
BoolVarImpConf
>(home) {}
209
210
forceinline
211
BoolVarImpBase::BoolVarImpBase
(
Gecode::Space
& home,
bool
share,
BoolVarImpBase
& x)
212
: Gecode::
VarImp
<Gecode::Int::
BoolVarImpConf
>(home,share,x) {}
213
214
forceinline
void
215
BoolVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Propagator
& p,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule) {
216
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe
(home,p,pc,assigned,
ME_BOOL_VAL
,schedule);
217
}
218
forceinline
void
219
BoolVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned
) {
220
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe
(home,a,assigned);
221
}
222
223
forceinline
Gecode::ModEvent
224
BoolVarImpBase::notify
(
Gecode::Space
& home,
Gecode::ModEvent
,
Gecode::Delta
&
d
) {
225
schedule
(home,
PC_BOOL_VAL
,
PC_BOOL_VAL
,
ME_BOOL_VAL
);
226
if
(!
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::advise
(home,
ME_BOOL_VAL
,d))
227
return
ME_BOOL_FAILED
;
228
cancel
(home);
229
return
ME_BOOL_VAL
;
230
}
231
232
}}
233
#endif
234
#ifdef GECODE_HAS_SET_VARS
235
namespace
Gecode {
namespace
Set {
236
237
forceinline
238
SetVarImpBase::SetVarImpBase
(
void
) {}
239
240
forceinline
241
SetVarImpBase::SetVarImpBase
(
Gecode::Space
& home)
242
: Gecode::
VarImp
<Gecode::Set::
SetVarImpConf
>(home) {}
243
244
forceinline
245
SetVarImpBase::SetVarImpBase
(
Gecode::Space
& home,
bool
share,
SetVarImpBase
& x)
246
: Gecode::
VarImp
<Gecode::Set::
SetVarImpConf
>(home,share,x) {}
247
248
forceinline
void
249
SetVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Propagator
& p,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule) {
250
Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe
(home,p,pc,assigned,
ME_SET_CBB
,schedule);
251
}
252
forceinline
void
253
SetVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned
) {
254
Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe
(home,a,assigned);
255
}
256
257
forceinline
Gecode::ModEvent
258
SetVarImpBase::notify
(
Gecode::Space
& home,
Gecode::ModEvent
me,
Gecode::Delta
&
d
) {
259
switch
(me) {
260
case
ME_SET_VAL
:
261
// Conditions: VAL, CARD, CLUB, CGLB, ANY
262
schedule
(home,
PC_SET_VAL
,
PC_SET_ANY
,
ME_SET_VAL
);
263
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_VAL
,d))
264
return
ME_SET_FAILED
;
265
cancel
(home);
266
break
;
267
case
ME_SET_CARD
:
268
// Conditions: CARD, CLUB, CGLB, ANY
269
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CARD
);
270
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CARD
,d))
271
return
ME_SET_FAILED
;
272
break
;
273
case
ME_SET_LUB
:
274
// Conditions: CLUB, ANY
275
schedule
(home,
PC_SET_CLUB
,
PC_SET_CLUB
,
ME_SET_LUB
);
276
schedule
(home,
PC_SET_ANY
,
PC_SET_ANY
,
ME_SET_LUB
);
277
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_LUB
,d))
278
return
ME_SET_FAILED
;
279
break
;
280
case
ME_SET_GLB
:
281
// Conditions: CGLB, ANY
282
schedule
(home,
PC_SET_CGLB
,
PC_SET_ANY
,
ME_SET_GLB
);
283
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_GLB
,d))
284
return
ME_SET_FAILED
;
285
break
;
286
case
ME_SET_BB
:
287
// Conditions: CLUB, CGLB, ANY
288
schedule
(home,
PC_SET_CLUB
,
PC_SET_ANY
,
ME_SET_BB
);
289
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_BB
,d))
290
return
ME_SET_FAILED
;
291
break
;
292
case
ME_SET_CLUB
:
293
// Conditions: CARD, CLUB, CGLB, ANY
294
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CLUB
);
295
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CLUB
,d))
296
return
ME_SET_FAILED
;
297
break
;
298
case
ME_SET_CGLB
:
299
// Conditions: CARD, CLUB, CGLB, ANY
300
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CGLB
);
301
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CGLB
,d))
302
return
ME_SET_FAILED
;
303
break
;
304
case
ME_SET_CBB
:
305
// Conditions: CARD, CLUB, CGLB, ANY
306
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CBB
);
307
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CBB
,d))
308
return
ME_SET_FAILED
;
309
break
;
310
default
:
GECODE_NEVER
;
311
}
312
return
me
;
313
}
314
315
}}
316
#endif
317
namespace
Gecode {
318
319
forceinline
void
320
Space::update(ActorLink** sub) {
321
#ifdef GECODE_HAS_INT_VARS
322
Gecode::VarImp<Gecode::Int::IntVarImpConf>::update
(*
this
,sub);
323
#endif
324
#ifdef GECODE_HAS_INT_VARS
325
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update
(*
this
,sub);
326
#endif
327
#ifdef GECODE_HAS_SET_VARS
328
Gecode::VarImp<Gecode::Set::SetVarImpConf>::update
(*
this
,sub);
329
#endif
330
}
331
}
332
// STATISTICS: kernel-var