Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
base.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, 2004
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34namespace Gecode { namespace Int { namespace Bool {
35
36 /*
37 * Binary Boolean propagators
38 *
39 */
40 template<class BVA, class BVB>
43 : Propagator(home), x0(b0), x1(b1) {
44 x0.subscribe(home,*this,PC_BOOL_VAL);
45 x1.subscribe(home,*this,PC_BOOL_VAL);
46 }
47
48 template<class BVA, class BVB>
51 : Propagator(home,p) {
52 x0.update(home,p.x0);
53 x1.update(home,p.x1);
54 }
55
56 template<class BVA, class BVB>
59 BVA b0, BVB b1)
60 : Propagator(home,p) {
61 x0.update(home,b0);
62 x1.update(home,b1);
63 }
64
65 template<class BVA, class BVB>
71 template<class BVA, class BVB>
72 void
74 x0.reschedule(home,*this,PC_BOOL_VAL);
75 x1.reschedule(home,*this,PC_BOOL_VAL);
76 }
77
78 template<class BVA, class BVB>
79 forceinline size_t
81 x0.cancel(home,*this,PC_BOOL_VAL);
82 x1.cancel(home,*this,PC_BOOL_VAL);
83 (void) Propagator::dispose(home);
84 return sizeof(*this);
85 }
86
87 /*
88 * Ternary Boolean propagators
89 *
90 */
91 template<class BVA, class BVB, class BVC>
94 (Home home, BVA b0, BVB b1, BVC b2)
95 : Propagator(home), x0(b0), x1(b1), x2(b2) {
96 x0.subscribe(home,*this,PC_BOOL_VAL);
97 x1.subscribe(home,*this,PC_BOOL_VAL);
98 x2.subscribe(home,*this,PC_BOOL_VAL);
99 }
100
101 template<class BVA, class BVB, class BVC>
105 : Propagator(home,p) {
106 x0.update(home,p.x0);
107 x1.update(home,p.x1);
108 x2.update(home,p.x2);
109 }
110
111 template<class BVA, class BVB, class BVC>
114 BVA b0, BVB b1, BVC b2)
115 : Propagator(home,p) {
116 x0.update(home,b0);
117 x1.update(home,b1);
118 x2.update(home,b2);
119 }
120
121 template<class BVA, class BVB, class BVC>
126
127 template<class BVA, class BVB, class BVC>
128 void
130 x0.reschedule(home,*this,PC_BOOL_VAL);
131 x1.reschedule(home,*this,PC_BOOL_VAL);
132 x2.reschedule(home,*this,PC_BOOL_VAL);
133 }
134
135 template<class BVA, class BVB, class BVC>
136 forceinline size_t
138 x0.cancel(home,*this,PC_BOOL_VAL);
139 x1.cancel(home,*this,PC_BOOL_VAL);
140 x2.cancel(home,*this,PC_BOOL_VAL);
141 (void) Propagator::dispose(home);
142 return sizeof(*this);
143 }
144
145}}}
146
147// STATISTICS: int-prop
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition core.hpp:3256
Home class for posting propagators
Definition core.hpp:856
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition base.hpp:80
virtual void reschedule(Space &home)
Schedule function.
Definition base.hpp:73
BVB x1
Boolean view Constructor for posting.
Definition bool.hh:58
BoolBinary(Home home, BVA b0, BVB b1)
Definition base.hpp:42
BVA x0
Boolean view.
Definition bool.hh:57
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low unary)
Definition base.hpp:67
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
Definition base.hpp:123
BoolTernary(Home home, BVA b0, BVB b1, BVC b2)
Definition base.hpp:94
BVB x1
Boolean view.
Definition bool.hh:80
BVA x0
Boolean view.
Definition bool.hh:79
BVC x2
Boolean view Constructor for posting.
Definition bool.hh:81
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition base.hpp:137
virtual void reschedule(Space &home)
Schedule function.
Definition base.hpp:129
Propagation cost.
Definition core.hpp:486
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Definition core.hpp:4820
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Definition core.hpp:4816
friend class Space
Definition core.hpp:1068
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3505
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Boolean propagators.
Finite domain integers.
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Definition var-type.hpp:126
Gecode toplevel namespace
#define forceinline
Definition config.hpp:194