this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 * Guido Tack <tack@gecode.org>
6 *
7 * Copyright:
8 * Christian Schulte, 2002
9 * Guido Tack, 2004
10 *
11 * This file is part of Gecode, the generic constraint
12 * development environment:
13 * http://www.gecode.org
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining
16 * a copy of this software and associated documentation files (the
17 * "Software"), to deal in the Software without restriction, including
18 * without limitation the rights to use, copy, modify, merge, publish,
19 * distribute, sublicense, and/or sell copies of the Software, and to
20 * permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be
24 * included in all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 *
34 */
35
36#ifndef GECODE_INT_BOOL_HH
37#define GECODE_INT_BOOL_HH
38
39#include <gecode/int.hh>
40
41/**
42 * \namespace Gecode::Int::Bool
43 * \brief Boolean propagators
44 */
45
46namespace Gecode { namespace Int { namespace Bool {
47
48 /*
49 * Base Classes
50 *
51 */
52
53 /// Base-class for binary Boolean propagators
54 template<class BVA, class BVB>
55 class BoolBinary : public Propagator {
56 protected:
57 BVA x0; ///< Boolean view
58 BVB x1; ///< Boolean view
59 /// Constructor for posting
60 BoolBinary(Home home, BVA b0, BVB b1);
61 /// Constructor for cloning
62 BoolBinary(Space& home, BoolBinary& p);
63 /// Constructor for rewriting \a p during cloning
64 BoolBinary(Space& home, Propagator& p,
65 BVA b0, BVB b1);
66 public:
67 /// Cost function (defined as low unary)
68 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
69 /// Schedule function
70 virtual void reschedule(Space& home);
71 /// Delete propagator and return its size
72 virtual size_t dispose(Space& home);
73 };
74
75 /// Base-class for ternary Boolean propagators
76 template<class BVA, class BVB, class BVC>
77 class BoolTernary : public Propagator {
78 protected:
79 BVA x0; ///< Boolean view
80 BVB x1; ///< Boolean view
81 BVC x2; ///< Boolean view
82 /// Constructor for posting
83 BoolTernary(Home home, BVA b0, BVB b1, BVC b2);
84 /// Constructor for cloning
85 BoolTernary(Space& home, BoolTernary& p);
86 public:
87 /// Constructor for rewriting \a p during cloning
88 BoolTernary(Space& home, Propagator& p,
89 BVA b0, BVB b1, BVC b2);
90 /// Cost function (defined as low binary)
91 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
92 /// Schedule function
93 virtual void reschedule(Space& home);
94 /// Delete propagator and return its size
95 virtual size_t dispose(Space& home);
96 };
97
98 /**
99 * \brief Boolean equality propagator
100 *
101 * Requires \code #include <gecode/int/bool.hh> \endcode
102 * \ingroup FuncIntProp
103 */
104 template<class BVA, class BVB>
105 class Eq : public BoolBinary<BVA,BVB> {
106 protected:
107 using BoolBinary<BVA,BVB>::x0;
108 using BoolBinary<BVA,BVB>::x1;
109 /// Constructor for posting
110 Eq(Home home, BVA b0, BVB b1);
111 /// Constructor for cloning \a p
112 Eq(Space& home, Eq& p);
113 public:
114 /// Constructor for rewriting \a p during cloning
115 Eq(Space& home, Propagator& p,
116 BVA b0, BVB b1);
117 /// Copy propagator during cloning
118 virtual Actor* copy(Space& home);
119 /// Perform propagation
120 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
121 /// Post propagator \f$ x_0 = x_1\f$
122 static ExecStatus post(Home home, BVA x0, BVB x1);
123 };
124
125
126 /**
127 * \brief n-ary Boolean equality propagator
128 *
129 * Requires \code #include <gecode/int/bool.hh> \endcode
130 * \ingroup FuncIntProp
131 */
132 template<class BV>
133 class NaryEq : public NaryPropagator<BV,PC_BOOL_VAL> {
134 protected:
135 using NaryPropagator<BV,PC_BOOL_VAL>::x;
136 /// Constructor for posting
137 NaryEq(Home home, ViewArray<BV>& x);
138 /// Constructor for cloning \a p
139 NaryEq(Space& home, NaryEq& p);
140 public:
141 /// Copy propagator during cloning
142 virtual Actor* copy(Space& home);
143 /// Cost function (defined as low unary)
144 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
145 /// Perform propagation
146 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
147 /// Post propagator \f$ x_0 = x_1=\ldots =x_{|x|-1}\f$
148 static ExecStatus post(Home home, ViewArray<BV>& x);
149 };
150
151
152 /**
153 * \brief Boolean less or equal propagator
154 *
155 * Requires \code #include <gecode/int/bool.hh> \endcode
156 * \ingroup FuncIntProp
157 */
158 template<class BV>
159 class Lq : public BoolBinary<BV,BV> {
160 protected:
161 using BoolBinary<BV,BV>::x0;
162 using BoolBinary<BV,BV>::x1;
163 /// Constructor for posting
164 Lq(Home home, BV b0, BV b1);
165 /// Constructor for cloning \a p
166 Lq(Space& home, Lq& p);
167 public:
168 /// Copy propagator during cloning
169 virtual Actor* copy(Space& home);
170 /// Perform propagation
171 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
172 /// Post propagator \f$ b_0 \leq b_1\f$
173 static ExecStatus post(Home home, BV b0, BV b1);
174 };
175
176 /**
177 * \brief Nary Boolean less or equal propagator
178 *
179 * Requires \code #include <gecode/int/bool.hh> \endcode
180 * \ingroup FuncIntProp
181 */
182 template<class VX>
183 class NaryLq : public NaryPropagator<VX,PC_BOOL_NONE> {
184 protected:
185 using NaryPropagator<VX,PC_BOOL_NONE>::x;
186 /// Whether the propagator is currently running
187 bool run;
188 /// The number of views assigned to zero in \a x
189 int n_zero;
190 /// The number of views assigned to one in \a x
191 int n_one;
192 /// The advisor council
193 Council<Advisor> c;
194 /// Constructor for posting
195 NaryLq(Home home, ViewArray<VX>& x);
196 /// Constructor for cloning \a p
197 NaryLq(Space& home, NaryLq<VX>& p);
198 public:
199 /// Copy propagator during cloning
200 virtual Actor* copy(Space& home);
201 /// Give advice to propagator
202 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
203 /// Cost function (defined as low unary)
204 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
205 /// Perform propagation
206 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
207 /// Post propagator \f$ x_0 \leq x_1 \leq \cdots \leq x_{|x|-1}\f$
208 static ExecStatus post(Home home, ViewArray<VX>& x);
209 /// Delete propagator and return its size
210 virtual size_t dispose(Space& home);
211 };
212
213
214
215
216 /**
217 * \brief Boolean less propagator
218 *
219 * Requires \code #include <gecode/int/bool.hh> \endcode
220 * \ingroup FuncIntProp
221 */
222 template<class BV>
223 class Le {
224 public:
225 /// Post propagator \f$ b_0 < b_1\f$
226 static ExecStatus post(Home home, BV b0, BV b1);
227 };
228
229
230 /**
231 * \brief Binary Boolean disjunction propagator (true)
232 *
233 * Requires \code #include <gecode/int/bool.hh> \endcode
234 * \ingroup FuncIntProp
235 */
236 template<class BVA, class BVB>
237 class BinOrTrue : public BoolBinary<BVA,BVB> {
238 protected:
239 using BoolBinary<BVA,BVB>::x0;
240 using BoolBinary<BVA,BVB>::x1;
241 /// Constructor for posting
242 BinOrTrue(Home home, BVA b0, BVB b1);
243 /// Constructor for cloning \a p
244 BinOrTrue(Space& home, BinOrTrue& p);
245 public:
246 /// Constructor for rewriting \a p during cloning
247 BinOrTrue(Space& home, Propagator& p,
248 BVA b0, BVB b1);
249 /// Copy propagator during cloning
250 virtual Actor* copy(Space& home);
251 /// Perform propagation
252 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
253 /// Post propagator \f$ b_0 \lor b_1 = 1 \f$
254 static ExecStatus post(Home home, BVA b0, BVB b1);
255 };
256
257 /**
258 * \brief Ternary Boolean disjunction propagator (true)
259 *
260 * Requires \code #include <gecode/int/bool.hh> \endcode
261 * \ingroup FuncIntProp
262 */
263 template<class BV>
264 class TerOrTrue : public BoolBinary<BV,BV> {
265 protected:
266 using BoolBinary<BV,BV>::x0;
267 using BoolBinary<BV,BV>::x1;
268 /// Boolean view without subscription
269 BV x2;
270 /// Constructor for posting
271 TerOrTrue(Home home, BV b0, BV b1, BV b2);
272 /// Constructor for cloning \a p
273 TerOrTrue(Space& home, TerOrTrue& p);
274 public:
275 /// Constructor for rewriting \a p during cloning
276 TerOrTrue(Space& home, Propagator& p,
277 BV b0, BV b1, BV b2);
278 /// Copy propagator during cloning
279 virtual Actor* copy(Space& home);
280 /// Perform propagation
281 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
282 /// Post propagator \f$ b_0 \lor b_1 \lor b_2 = 1 \f$
283 static ExecStatus post(Home home, BV b0, BV b1, BV b2);
284 /// Delete propagator and return its size
285 virtual size_t dispose(Space& home);
286 };
287
288 /**
289 * \brief Quarternary Boolean disjunction propagator (true)
290 *
291 * Requires \code #include <gecode/int/bool.hh> \endcode
292 * \ingroup FuncIntProp
293 */
294 template<class BV>
295 class QuadOrTrue : public BoolBinary<BV,BV> {
296 protected:
297 using BoolBinary<BV,BV>::x0;
298 using BoolBinary<BV,BV>::x1;
299 /// Boolean view without subscription
300 BV x2;
301 /// Boolean view without subscription
302 BV x3;
303 /// Constructor for posting
304 QuadOrTrue(Home home, BV b0, BV b1, BV b2, BV b3);
305 /// Constructor for cloning \a p
306 QuadOrTrue(Space& home, QuadOrTrue& p);
307 public:
308 /// Constructor for rewriting \a p during cloning
309 QuadOrTrue(Space& home, Propagator& p,
310 BV b0, BV b1, BV b2, BV b3);
311 /// Copy propagator during cloning
312 virtual Actor* copy(Space& home);
313 /// Perform propagation
314 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
315 /// Post propagator \f$ b_0 \lor b_1 \lor b_2 \lor b_3 = 1 \f$
316 static ExecStatus post(Home home, BV b0, BV b1, BV b2, BV b3);
317 /// Delete propagator and return its size
318 virtual size_t dispose(Space& home);
319 };
320
321 /**
322 * \brief Boolean disjunction propagator
323 *
324 * Requires \code #include <gecode/int/bool.hh> \endcode
325 * \ingroup FuncIntProp
326 */
327 template<class BVA, class BVB, class BVC>
328 class Or : public BoolTernary<BVA,BVB,BVC> {
329 protected:
330 using BoolTernary<BVA,BVB,BVC>::x0;
331 using BoolTernary<BVA,BVB,BVC>::x1;
332 using BoolTernary<BVA,BVB,BVC>::x2;
333 /// Constructor for posting
334 Or(Home home, BVA b0, BVB b1, BVC b2);
335 /// Constructor for cloning \a p
336 Or(Space& home, Or& p);
337 public:
338 /// Constructor for rewriting \a p during cloning
339 Or(Space& home, Propagator& p, BVA b0, BVB b1, BVC b2);
340 /// Copy propagator during cloning
341 virtual Actor* copy(Space& home);
342 /// Perform propagation
343 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
344 /// Post propagator \f$ b_0 \lor b_1 = b_2 \f$
345 static ExecStatus post(Home home, BVA b0, BVB b1, BVC b2);
346 };
347
348 /**
349 * \brief Boolean n-ary disjunction propagator
350 *
351 * Requires \code #include <gecode/int/bool.hh> \endcode
352 * \ingroup FuncIntProp
353 */
354 template<class VX,class VY>
355 class NaryOr
356 : public MixNaryOnePropagator<VX,PC_BOOL_NONE,VY,PC_BOOL_VAL> {
357 protected:
358 using MixNaryOnePropagator<VX,PC_BOOL_NONE,VY,PC_BOOL_VAL>::x;
359 using MixNaryOnePropagator<VX,PC_BOOL_NONE,VY,PC_BOOL_VAL>::y;
360 /// The number of views assigned to zero in \a x
361 int n_zero;
362 /// The advisor council
363 Council<Advisor> c;
364 /// Constructor for posting
365 NaryOr(Home home, ViewArray<VX>& x, VY y);
366 /// Constructor for cloning \a p
367 NaryOr(Space& home, NaryOr<VX,VY>& p);
368 public:
369 /// Copy propagator during cloning
370 virtual Actor* copy(Space& home);
371 /// Give advice to propagator
372 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
373 /// Cost function (defined as low unary)
374 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
375 /// Schedule function
376 virtual void reschedule(Space& home);
377 /// Perform propagation
378 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
379 /// Post propagator \f$ \bigvee_{i=0}^{|x|-1} x_i = y\f$
380 static ExecStatus post(Home home, ViewArray<VX>& x, VY y);
381 /// Delete propagator and return its size
382 virtual size_t dispose(Space& home);
383 };
384
385
386 /**
387 * \brief Boolean n-ary disjunction propagator (true)
388 *
389 * Requires \code #include <gecode/int/bool.hh> \endcode
390 * \ingroup FuncIntProp
391 */
392 template<class BV>
393 class NaryOrTrue : public BinaryPropagator<BV,PC_BOOL_VAL> {
394 protected:
395 using BinaryPropagator<BV,PC_BOOL_VAL>::x0;
396 using BinaryPropagator<BV,PC_BOOL_VAL>::x1;
397 /// Views not yet subscribed to
398 ViewArray<BV> x;
399 /// Update subscription
400 ExecStatus resubscribe(Space& home, BV& x0, BV x1);
401 /// Constructor for posting
402 NaryOrTrue(Home home, ViewArray<BV>& x);
403 /// Constructor for cloning \a p
404 NaryOrTrue(Space& home, NaryOrTrue<BV>& p);
405 public:
406 /// Copy propagator during cloning
407 virtual Actor* copy(Space& home);
408 /// Cost function (defined as low unary)
409 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
410 /// Perform propagation
411 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
412 /// Post propagator \f$ \bigvee_{i=0}^{|b|-1} b_i = 0\f$
413 static ExecStatus post(Home home, ViewArray<BV>& b);
414 /// Delete propagator and return its size
415 virtual size_t dispose(Space& home);
416 };
417
418
419 /**
420 * \brief Boolean equivalence propagator
421 *
422 * Requires \code #include <gecode/int/bool.hh> \endcode
423 * \ingroup FuncIntProp
424 */
425 template<class BVA, class BVB, class BVC>
426 class Eqv : public BoolTernary<BVA,BVB,BVC> {
427 protected:
428 using BoolTernary<BVA,BVB,BVC>::x0;
429 using BoolTernary<BVA,BVB,BVC>::x1;
430 using BoolTernary<BVA,BVB,BVC>::x2;
431 /// Constructor for cloning \a p
432 Eqv(Space& home, Eqv& p);
433 /// Constructor for posting
434 Eqv(Home home, BVA b0 ,BVB b1, BVC b2);
435 public:
436 /// Copy propagator during cloning
437 virtual Actor* copy(Space& home);
438 /// Perform propagation
439 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
440 /// Post propagator \f$ b_0 \Leftrightarrow b_1 = b_2 \f$ (equivalence)
441 static ExecStatus post(Home home, BVA b0, BVB b1, BVC b2);
442 };
443
444
445 /**
446 * \brief Boolean n-ary equivalence propagator
447 *
448 * Enforces that the parity of the views is odd.
449 *
450 * Requires \code #include <gecode/int/bool.hh> \endcode
451 * \ingroup FuncIntProp
452 */
453 class NaryEqv : public BinaryPropagator<BoolView,PC_BOOL_VAL> {
454 protected:
455 using BinaryPropagator<BoolView,PC_BOOL_VAL>::x0;
456 using BinaryPropagator<BoolView,PC_BOOL_VAL>::x1;
457 /// Views not yet subscribed to
458 ViewArray<BoolView> x;
459 /// Parity information mod 2
460 int pm2;
461 /// Update subscription
462 void resubscribe(Space& home, BoolView& x0);
463 /// Constructor for posting
464 NaryEqv(Home home, ViewArray<BoolView>& x, int pm2);
465 /// Constructor for cloning \a p
466 NaryEqv(Space& home, NaryEqv& p);
467 public:
468 /// Copy propagator during cloning
469 GECODE_INT_EXPORT
470 virtual Actor* copy(Space& home);
471 /// Cost function (defined as low binary)
472 GECODE_INT_EXPORT
473 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
474 /// Perform propagation
475 GECODE_INT_EXPORT
476 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
477 /// Post propagator \f$ x_0 \Leftrightarrow x_1 \Leftrightarrow \cdots \Leftrightarrow x_{|x|-1}=p\f$
478 GECODE_INT_EXPORT
479 static ExecStatus post(Home home, ViewArray<BoolView>& x, int pm2);
480 /// Delete propagator and return its size
481 virtual size_t dispose(Space& home);
482 };
483
484
485 /**
486 * \brief Boolean clause propagator (disjunctive)
487 *
488 * Requires \code #include <gecode/int/bool.hh> \endcode
489 * \ingroup FuncIntProp
490 */
491 template<class VX, class VY>
492 class Clause : public Propagator {
493 protected:
494 /// Positive views
495 ViewArray<VX> x;
496 /// Positive views (origin from negative variables)
497 ViewArray<VY> y;
498 /// Result
499 VX z;
500 /// The number of views assigned to zero in \a x and \a y
501 int n_zero;
502 /// %Advisors for views (tagged whether for \a x or \a y)
503 class Tagged : public Advisor {
504 public:
505 /// Whether advises a view for x or y
506 const bool x;
507 /// Create tagged advisor
508 Tagged(Space& home, Propagator& p, Council<Tagged>& c, bool x);
509 /// Clone tagged advisor \a a
510 Tagged(Space& home, Tagged& a);
511 };
512 /// The advisor council
513 Council<Tagged> c;
514 /// Cancel subscriptions
515 void cancel(Space& home);
516 /// Constructor for posting
517 Clause(Home home, ViewArray<VX>& x, ViewArray<VY>& y, VX z);
518 /// Constructor for cloning \a p
519 Clause(Space& home, Clause<VX,VY>& p);
520 public:
521 /// Copy propagator during cloning
522 virtual Actor* copy(Space& home);
523 /// Give advice to propagator
524 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
525 /// Cost function (defined as low unary)
526 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
527 /// Schedule function
528 virtual void reschedule(Space& home);
529 /// Perform propagation
530 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
531 /// Post propagator \f$ \bigvee_{i=0}^{|x|-1} x_i \vee \bigvee_{i=0}^{|x|-1} y_i = z\f$
532 static ExecStatus post(Home home, ViewArray<VX>& x, ViewArray<VY>& y,
533 VX z);
534 /// Delete propagator and return its size
535 virtual size_t dispose(Space& home);
536 };
537
538
539 /**
540 * \brief Boolean clause propagator (disjunctive, true)
541 *
542 * Requires \code #include <gecode/int/bool.hh> \endcode
543 * \ingroup FuncIntProp
544 */
545 template<class VX, class VY>
546 class ClauseTrue
547 : public MixBinaryPropagator<VX,PC_BOOL_VAL,VY,PC_BOOL_VAL> {
548 protected:
549 using MixBinaryPropagator<VX,PC_BOOL_VAL,VY,PC_BOOL_VAL>::x0;
550 using MixBinaryPropagator<VX,PC_BOOL_VAL,VY,PC_BOOL_VAL>::x1;
551 /// Views not yet subscribed to
552 ViewArray<VX> x;
553 /// Views not yet subscribed to (origin from negative variables)
554 ViewArray<VY> y;
555 /// Constructor for posting
556 ClauseTrue(Home home, ViewArray<VX>& x, ViewArray<VY>& y);
557 /// Constructor for cloning \a p
558 ClauseTrue(Space& home, ClauseTrue<VX,VY>& p);
559 public:
560 /// Copy propagator during cloning
561 virtual Actor* copy(Space& home);
562 /// Cost function (defined as low binary)
563 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
564 /// Perform propagation
565 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
566 /// Post propagator \f$ \bigvee_{i=0}^{|x|-1} x_i \vee \bigvee_{i=0}^{|y|-1} y_i = 1\f$
567 static ExecStatus post(Home home, ViewArray<VX>& x, ViewArray<VY>& y);
568 /// Delete propagator and return its size
569 virtual size_t dispose(Space& home);
570 };
571
572
573 /**
574 * \brief If-then-else propagator base-class
575 *
576 * Requires \code #include <gecode/int/bool.hh> \endcode
577 * \ingroup FuncIntProp
578 */
579 template<class V0, class V1, class V2, PropCond pc>
580 class IteBase : public Propagator {
581 protected:
582 /// View for condition
583 BoolView b;
584 /// Views
585 V0 x0; V1 x1; V2 x2;
586 /// Constructor for cloning \a p
587 IteBase(Space& home, IteBase& p);
588 /// Constructor for creation
589 IteBase(Home home, BoolView b, V0 x0, V1 x1, V2 x2);
590 public:
591 /// Cost function (defined as low ternary)
592 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
593 /// Schedule function
594 virtual void reschedule(Space& home);
595 /// Delete propagator and return its size
596 virtual size_t dispose(Space& home);
597 };
598
599 /**
600 * \brief If-then-else bounds-consistent propagator
601 *
602 * Requires \code #include <gecode/int/bool.hh> \endcode
603 * \ingroup FuncIntProp
604 */
605 template<class V0, class V1, class V2>
606 class IteBnd : public IteBase<V0,V1,V2,PC_INT_BND> {
607 protected:
608 using IteBase<V0,V1,V2,PC_INT_BND>::b;
609 using IteBase<V0,V1,V2,PC_INT_BND>::x0;
610 using IteBase<V0,V1,V2,PC_INT_BND>::x1;
611 using IteBase<V0,V1,V2,PC_INT_BND>::x2;
612 /// Constructor for cloning \a p
613 IteBnd(Space& home, IteBnd& p);
614 /// Constructor for creation
615 IteBnd(Home home, BoolView b, V0 x0, V1 x1, V2 x2);
616 public:
617 /// Copy propagator during cloning
618 virtual Actor* copy(Space& home);
619 /// Perform propagation
620 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
621 /// Post if-then-else propagator
622 static ExecStatus post(Home home, BoolView b, V0 x0, V1 x1, V2 x2);
623 };
624
625 /**
626 * \brief If-then-else domain-consistent propagator
627 *
628 * Requires \code #include <gecode/int/bool.hh> \endcode
629 * \ingroup FuncIntProp
630 */
631 template<class V0, class V1, class V2>
632 class IteDom : public IteBase<V0,V1,V2,PC_INT_DOM> {
633 protected:
634 using IteBase<V0,V1,V2,PC_INT_DOM>::b;
635 using IteBase<V0,V1,V2,PC_INT_DOM>::x0;
636 using IteBase<V0,V1,V2,PC_INT_DOM>::x1;
637 using IteBase<V0,V1,V2,PC_INT_DOM>::x2;
638 /// Constructor for cloning \a p
639 IteDom(Space& home, IteDom& p);
640 /// Constructor for creation
641 IteDom(Home home, BoolView b, V0 x0, V1 x1, V2 x2);
642 public:
643 /// Copy propagator during cloning
644 virtual Actor* copy(Space& home);
645 /// Cost function (defined as high ternary)
646 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
647 /// Perform propagation
648 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
649 /// Post if-then-else propagator
650 static ExecStatus post(Home home, BoolView b, V0 x0, V1 x1, V2 x2);
651 };
652
653}}}
654
655#include <gecode/int/bool/base.hpp>
656#include <gecode/int/bool/eq.hpp>
657#include <gecode/int/bool/lq.hpp>
658#include <gecode/int/bool/or.hpp>
659#include <gecode/int/bool/eqv.hpp>
660#include <gecode/int/bool/clause.hpp>
661#include <gecode/int/bool/ite.hpp>
662
663#endif
664
665// STATISTICS: int-prop
666