Generated on Sat Feb 7 2015 02:01:20 for Gecode by doxygen 1.8.9.1
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  * Last modified:
10  * $Date: 2009-10-12 17:36:53 +0200 (Mon, 12 Oct 2009) $ by $Author: schulte $
11  * $Revision: 9878 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 namespace Gecode { namespace Int { namespace Bool {
39 
40  /*
41  * Binary Boolean propagators
42  *
43  */
44  template<class BVA, class BVB>
47  : Propagator(home), x0(b0), x1(b1) {
48  x0.subscribe(home,*this,PC_BOOL_VAL);
49  x1.subscribe(home,*this,PC_BOOL_VAL);
50  }
51 
52  template<class BVA, class BVB>
56  : Propagator(home,share,p) {
57  x0.update(home,share,p.x0);
58  x1.update(home,share,p.x1);
59  }
60 
61  template<class BVA, class BVB>
64  BVA b0, BVB b1)
65  : Propagator(home,share,p) {
66  x0.update(home,share,b0);
67  x1.update(home,share,b1);
68  }
69 
70  template<class BVA, class BVB>
71  PropCost
74  }
75 
76  template<class BVA, class BVB>
77  forceinline size_t
79  x0.cancel(home,*this,PC_BOOL_VAL);
80  x1.cancel(home,*this,PC_BOOL_VAL);
81  (void) Propagator::dispose(home);
82  return sizeof(*this);
83  }
84 
85  /*
86  * Ternary Boolean propagators
87  *
88  */
89  template<class BVA, class BVB, class BVC>
92  (Home home, BVA b0, BVB b1, BVC b2)
93  : Propagator(home), x0(b0), x1(b1), x2(b2) {
94  x0.subscribe(home,*this,PC_BOOL_VAL);
95  x1.subscribe(home,*this,PC_BOOL_VAL);
96  x2.subscribe(home,*this,PC_BOOL_VAL);
97  }
98 
99  template<class BVA, class BVB, class BVC>
103  : Propagator(home,share,p) {
104  x0.update(home,share,p.x0);
105  x1.update(home,share,p.x1);
106  x2.update(home,share,p.x2);
107  }
108 
109  template<class BVA, class BVB, class BVC>
112  BVA b0, BVB b1, BVC b2)
113  : Propagator(home,share,p) {
114  x0.update(home,share,b0);
115  x1.update(home,share,b1);
116  x2.update(home,share,b2);
117  }
118 
119  template<class BVA, class BVB, class BVC>
120  PropCost
123  }
124 
125  template<class BVA, class BVB, class BVC>
126  forceinline size_t
128  x0.cancel(home,*this,PC_BOOL_VAL);
129  x1.cancel(home,*this,PC_BOOL_VAL);
130  x2.cancel(home,*this,PC_BOOL_VAL);
131  (void) Propagator::dispose(home);
132  return sizeof(*this);
133  }
134 
135 }}}
136 
137 // STATISTICS: int-prop
BVC x2
Boolean view Constructor for posting.
Definition: bool.hh:83
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
Definition: base.hpp:121
Base-class for propagators.
Definition: core.hpp:755
BoolBinary(Home home, BVA b0, BVB b1)
Definition: base.hpp:46
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Definition: core.hpp:4058
Computation spaces.
Definition: core.hpp:1362
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: base.hpp:78
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
BoolTernary(Home home, BVA b0, BVB b1, BVC b2)
Definition: base.hpp:92
BVB x1
Boolean view.
Definition: bool.hh:82
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low unary)
Definition: base.hpp:72
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: base.hpp:127
BVB x1
Boolean view Constructor for posting.
Definition: bool.hh:62
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition: core.hpp:2877
Propagation cost.
Definition: core.hpp:537
#define forceinline
Definition: config.hpp:132
BVA x0
Boolean view.
Definition: bool.hh:81
Gecode toplevel namespace
Base-class for ternary Boolean propagators.
Definition: bool.hh:79
BVA x0
Boolean view.
Definition: bool.hh:61
Base-class for binary Boolean propagators.
Definition: bool.hh:59
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Definition: core.hpp:4054
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Definition: var-type.hpp:126