main page
modules
namespaces
classes
files
Gecode home
Generated on Sat Nov 9 2013 19:18:26 for Gecode by
doxygen
1.8.4
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
* - ./gecode/float/var-imp/float.vis
9
*
10
* This file contains generated code fragments which are
11
* copyrighted as follows:
12
*
13
* Main author:
14
* Christian Schulte <schulte@gecode.org>
15
*
16
* Copyright:
17
* Christian Schulte, 2007
18
*
19
* The generated code fragments are part of Gecode, the generic
20
* constraint development environment:
21
* http://www.gecode.org
22
*
23
* Permission is hereby granted, free of charge, to any person obtaining
24
* a copy of this software and associated documentation files (the
25
* "Software"), to deal in the Software without restriction, including
26
* without limitation the rights to use, copy, modify, merge, publish,
27
* distribute, sublicense, and/or sell copies of the Software, and to
28
* permit persons to whom the Software is furnished to do so, subject to
29
* the following conditions:
30
*
31
* The above copyright notice and this permission notice shall be
32
* included in all copies or substantial portions of the Software.
33
*
34
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41
*
42
*/
43
44
#ifdef GECODE_HAS_INT_VARS
45
namespace
Gecode {
namespace
Int {
47
class
IntVarImpBase
:
public
Gecode::VarImp
<Gecode::Int::IntVarImpConf> {
48
protected
:
50
IntVarImpBase
(
Gecode::Space
& home,
bool
share,
IntVarImpBase
&
x
);
51
public
:
53
IntVarImpBase
(
void
);
55
IntVarImpBase
(
Gecode::Space
& home);
57
58
70
void
subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule
);
72
void
subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned);
74
Gecode::ModEvent
notify
(
Gecode::Space
& home,
Gecode::ModEvent
me
,
Gecode::Delta
&
d
);
76
};
77
}}
78
#endif
79
#ifdef GECODE_HAS_INT_VARS
80
namespace
Gecode {
namespace
Int {
82
class
BoolVarImpBase
:
public
Gecode::VarImp
<Gecode::Int::BoolVarImpConf> {
83
protected
:
85
BoolVarImpBase
(
Gecode::Space
& home,
bool
share,
BoolVarImpBase
&
x
);
86
public
:
88
BoolVarImpBase
(
void
);
90
BoolVarImpBase
(
Gecode::Space
& home);
92
93
105
void
subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule
);
107
void
subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned);
109
Gecode::ModEvent
notify
(
Gecode::Space
& home,
Gecode::ModEvent
me
,
Gecode::Delta
&
d
);
111
};
112
}}
113
#endif
114
#ifdef GECODE_HAS_SET_VARS
115
namespace
Gecode {
namespace
Set {
117
class
SetVarImpBase
:
public
Gecode::VarImp
<Gecode::Set::SetVarImpConf> {
118
protected
:
120
SetVarImpBase
(
Gecode::Space
& home,
bool
share,
SetVarImpBase
&
x
);
121
public
:
123
SetVarImpBase
(
void
);
125
SetVarImpBase
(
Gecode::Space
& home);
127
128
140
void
subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule
);
142
void
subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned);
144
Gecode::ModEvent
notify
(
Gecode::Space
& home,
Gecode::ModEvent
me
,
Gecode::Delta
&
d
);
146
};
147
}}
148
#endif
149
#ifdef GECODE_HAS_FLOAT_VARS
150
namespace
Gecode {
namespace
Float {
152
class
FloatVarImpBase
:
public
Gecode::VarImp
<Gecode::Float::FloatVarImpConf> {
153
protected
:
155
FloatVarImpBase
(
Gecode::Space
& home,
bool
share,
FloatVarImpBase
&
x
);
156
public
:
158
FloatVarImpBase
(
void
);
160
FloatVarImpBase
(
Gecode::Space
& home);
162
163
175
void
subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule
);
177
void
subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned);
179
Gecode::ModEvent
notify
(
Gecode::Space
& home,
Gecode::ModEvent
me
,
Gecode::Delta
&
d
);
181
};
182
}}
183
#endif
184
#ifdef GECODE_HAS_INT_VARS
185
namespace
Gecode {
namespace
Int {
186
187
forceinline
188
IntVarImpBase::IntVarImpBase
(
void
) {}
189
190
forceinline
191
IntVarImpBase::IntVarImpBase
(
Gecode::Space
& home)
192
: Gecode::
VarImp
<Gecode::Int::
IntVarImpConf
>(home) {}
193
194
forceinline
195
IntVarImpBase::IntVarImpBase
(
Gecode::Space
& home,
bool
share,
IntVarImpBase
&
x
)
196
: Gecode::
VarImp
<Gecode::Int::
IntVarImpConf
>(home,share,x) {}
197
198
forceinline
void
199
IntVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule) {
200
Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe
(home,p,pc,assigned,
ME_INT_BND
,schedule);
201
}
202
forceinline
void
203
IntVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned
) {
204
Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe
(home,a,assigned);
205
}
206
207
forceinline
Gecode::ModEvent
208
IntVarImpBase::notify
(
Gecode::Space
& home,
Gecode::ModEvent
me,
Gecode::Delta
&
d
) {
209
switch
(me) {
210
case
ME_INT_VAL
:
211
// Conditions: VAL, BND, DOM
212
schedule
(home,
PC_INT_VAL
,
PC_INT_DOM
,
ME_INT_VAL
);
213
if
(!
Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise
(home,
ME_INT_VAL
,d))
214
return
ME_INT_FAILED
;
215
cancel
(home);
216
break
;
217
case
ME_INT_BND
:
218
// Conditions: BND, DOM
219
schedule
(home,
PC_INT_BND
,
PC_INT_DOM
,
ME_INT_BND
);
220
if
(!
Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise
(home,
ME_INT_BND
,d))
221
return
ME_INT_FAILED
;
222
break
;
223
case
ME_INT_DOM
:
224
// Conditions: DOM
225
schedule
(home,
PC_INT_DOM
,
PC_INT_DOM
,
ME_INT_DOM
);
226
if
(!
Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise
(home,
ME_INT_DOM
,d))
227
return
ME_INT_FAILED
;
228
break
;
229
default
:
GECODE_NEVER
;
230
}
231
return
me
;
232
}
233
234
}}
235
#endif
236
#ifdef GECODE_HAS_INT_VARS
237
namespace
Gecode {
namespace
Int {
238
239
forceinline
240
BoolVarImpBase::BoolVarImpBase
(
void
) {}
241
242
forceinline
243
BoolVarImpBase::BoolVarImpBase
(
Gecode::Space
& home)
244
: Gecode::
VarImp
<Gecode::Int::
BoolVarImpConf
>(home) {}
245
246
forceinline
247
BoolVarImpBase::BoolVarImpBase
(
Gecode::Space
& home,
bool
share,
BoolVarImpBase
&
x
)
248
: Gecode::
VarImp
<Gecode::Int::
BoolVarImpConf
>(home,share,x) {}
249
250
forceinline
void
251
BoolVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule) {
252
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe
(home,p,pc,assigned,
ME_BOOL_VAL
,schedule);
253
}
254
forceinline
void
255
BoolVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned
) {
256
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe
(home,a,assigned);
257
}
258
259
forceinline
Gecode::ModEvent
260
BoolVarImpBase::notify
(
Gecode::Space
& home,
Gecode::ModEvent
,
Gecode::Delta
&
d
) {
261
schedule
(home,
PC_BOOL_VAL
,
PC_BOOL_VAL
,
ME_BOOL_VAL
);
262
if
(!
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::advise
(home,
ME_BOOL_VAL
,d))
263
return
ME_BOOL_FAILED
;
264
cancel
(home);
265
return
ME_BOOL_VAL
;
266
}
267
268
}}
269
#endif
270
#ifdef GECODE_HAS_SET_VARS
271
namespace
Gecode {
namespace
Set {
272
273
forceinline
274
SetVarImpBase::SetVarImpBase
(
void
) {}
275
276
forceinline
277
SetVarImpBase::SetVarImpBase
(
Gecode::Space
& home)
278
: Gecode::
VarImp
<Gecode::Set::
SetVarImpConf
>(home) {}
279
280
forceinline
281
SetVarImpBase::SetVarImpBase
(
Gecode::Space
& home,
bool
share,
SetVarImpBase
&
x
)
282
: Gecode::
VarImp
<Gecode::Set::
SetVarImpConf
>(home,share,x) {}
283
284
forceinline
void
285
SetVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule) {
286
Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe
(home,p,pc,assigned,
ME_SET_CBB
,schedule);
287
}
288
forceinline
void
289
SetVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned
) {
290
Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe
(home,a,assigned);
291
}
292
293
forceinline
Gecode::ModEvent
294
SetVarImpBase::notify
(
Gecode::Space
& home,
Gecode::ModEvent
me,
Gecode::Delta
&
d
) {
295
switch
(me) {
296
case
ME_SET_VAL
:
297
// Conditions: VAL, CARD, CLUB, CGLB, ANY
298
schedule
(home,
PC_SET_VAL
,
PC_SET_ANY
,
ME_SET_VAL
);
299
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_VAL
,d))
300
return
ME_SET_FAILED
;
301
cancel
(home);
302
break
;
303
case
ME_SET_CARD
:
304
// Conditions: CARD, CLUB, CGLB, ANY
305
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CARD
);
306
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CARD
,d))
307
return
ME_SET_FAILED
;
308
break
;
309
case
ME_SET_LUB
:
310
// Conditions: CLUB, ANY
311
schedule
(home,
PC_SET_CLUB
,
PC_SET_CLUB
,
ME_SET_LUB
);
312
schedule
(home,
PC_SET_ANY
,
PC_SET_ANY
,
ME_SET_LUB
);
313
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_LUB
,d))
314
return
ME_SET_FAILED
;
315
break
;
316
case
ME_SET_GLB
:
317
// Conditions: CGLB, ANY
318
schedule
(home,
PC_SET_CGLB
,
PC_SET_ANY
,
ME_SET_GLB
);
319
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_GLB
,d))
320
return
ME_SET_FAILED
;
321
break
;
322
case
ME_SET_BB
:
323
// Conditions: CLUB, CGLB, ANY
324
schedule
(home,
PC_SET_CLUB
,
PC_SET_ANY
,
ME_SET_BB
);
325
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_BB
,d))
326
return
ME_SET_FAILED
;
327
break
;
328
case
ME_SET_CLUB
:
329
// Conditions: CARD, CLUB, CGLB, ANY
330
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CLUB
);
331
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CLUB
,d))
332
return
ME_SET_FAILED
;
333
break
;
334
case
ME_SET_CGLB
:
335
// Conditions: CARD, CLUB, CGLB, ANY
336
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CGLB
);
337
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CGLB
,d))
338
return
ME_SET_FAILED
;
339
break
;
340
case
ME_SET_CBB
:
341
// Conditions: CARD, CLUB, CGLB, ANY
342
schedule
(home,
PC_SET_CARD
,
PC_SET_ANY
,
ME_SET_CBB
);
343
if
(!
Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise
(home,
ME_SET_CBB
,d))
344
return
ME_SET_FAILED
;
345
break
;
346
default
:
GECODE_NEVER
;
347
}
348
return
me
;
349
}
350
351
}}
352
#endif
353
#ifdef GECODE_HAS_FLOAT_VARS
354
namespace
Gecode {
namespace
Float {
355
356
forceinline
357
FloatVarImpBase::FloatVarImpBase
(
void
) {}
358
359
forceinline
360
FloatVarImpBase::FloatVarImpBase
(
Gecode::Space
& home)
361
: Gecode::
VarImp
<Gecode::Float::
FloatVarImpConf
>(home) {}
362
363
forceinline
364
FloatVarImpBase::FloatVarImpBase
(
Gecode::Space
& home,
bool
share,
FloatVarImpBase
&
x
)
365
: Gecode::
VarImp
<Gecode::Float::
FloatVarImpConf
>(home,share,x) {}
366
367
forceinline
void
368
FloatVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Propagator
&
p
,
Gecode::PropCond
pc,
bool
assigned
,
bool
schedule) {
369
Gecode::VarImp<Gecode::Float::FloatVarImpConf>::subscribe
(home,p,pc,assigned,
ME_FLOAT_BND
,schedule);
370
}
371
forceinline
void
372
FloatVarImpBase::subscribe
(
Gecode::Space
& home,
Gecode::Advisor
&
a
,
bool
assigned
) {
373
Gecode::VarImp<Gecode::Float::FloatVarImpConf>::subscribe
(home,a,assigned);
374
}
375
376
forceinline
Gecode::ModEvent
377
FloatVarImpBase::notify
(
Gecode::Space
& home,
Gecode::ModEvent
me,
Gecode::Delta
&
d
) {
378
switch
(me) {
379
case
ME_FLOAT_VAL
:
380
// Conditions: VAL, BND
381
schedule
(home,
PC_FLOAT_VAL
,
PC_FLOAT_BND
,
ME_FLOAT_VAL
);
382
if
(!
Gecode::VarImp<Gecode::Float::FloatVarImpConf>::advise
(home,
ME_FLOAT_VAL
,d))
383
return
ME_FLOAT_FAILED
;
384
cancel
(home);
385
break
;
386
case
ME_FLOAT_BND
:
387
// Conditions: BND
388
schedule
(home,
PC_FLOAT_BND
,
PC_FLOAT_BND
,
ME_FLOAT_BND
);
389
if
(!
Gecode::VarImp<Gecode::Float::FloatVarImpConf>::advise
(home,
ME_FLOAT_BND
,d))
390
return
ME_FLOAT_FAILED
;
391
break
;
392
default
:
GECODE_NEVER
;
393
}
394
return
me
;
395
}
396
397
}}
398
#endif
399
namespace
Gecode {
400
401
forceinline
void
402
Space::update(ActorLink** sub) {
403
#ifdef GECODE_HAS_INT_VARS
404
Gecode::VarImp<Gecode::Int::IntVarImpConf>::update
(*
this
,sub);
405
#endif
406
#ifdef GECODE_HAS_INT_VARS
407
Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update
(*
this
,sub);
408
#endif
409
#ifdef GECODE_HAS_SET_VARS
410
Gecode::VarImp<Gecode::Set::SetVarImpConf>::update
(*
this
,sub);
411
#endif
412
#ifdef GECODE_HAS_FLOAT_VARS
413
Gecode::VarImp<Gecode::Float::FloatVarImpConf>::update
(*
this
,sub);
414
#endif
415
}
416
}
417
// STATISTICS: kernel-var