Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
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$ by $Author$
11  * $Revision$
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>
55  : Propagator(home,p) {
56  x0.update(home,p.x0);
57  x1.update(home,p.x1);
58  }
59 
60  template<class BVA, class BVB>
63  BVA b0, BVB b1)
64  : Propagator(home,p) {
65  x0.update(home,b0);
66  x1.update(home,b1);
67  }
68 
69  template<class BVA, class BVB>
70  PropCost
72  return PropCost::unary(PropCost::LO);
73  }
74 
75  template<class BVA, class BVB>
76  void
78  x0.reschedule(home,*this,PC_BOOL_VAL);
79  x1.reschedule(home,*this,PC_BOOL_VAL);
80  }
81 
82  template<class BVA, class BVB>
83  forceinline size_t
85  x0.cancel(home,*this,PC_BOOL_VAL);
86  x1.cancel(home,*this,PC_BOOL_VAL);
87  (void) Propagator::dispose(home);
88  return sizeof(*this);
89  }
90 
91  /*
92  * Ternary Boolean propagators
93  *
94  */
95  template<class BVA, class BVB, class BVC>
98  (Home home, BVA b0, BVB b1, BVC b2)
99  : Propagator(home), x0(b0), x1(b1), x2(b2) {
100  x0.subscribe(home,*this,PC_BOOL_VAL);
101  x1.subscribe(home,*this,PC_BOOL_VAL);
102  x2.subscribe(home,*this,PC_BOOL_VAL);
103  }
104 
105  template<class BVA, class BVB, class BVC>
109  : Propagator(home,p) {
110  x0.update(home,p.x0);
111  x1.update(home,p.x1);
112  x2.update(home,p.x2);
113  }
114 
115  template<class BVA, class BVB, class BVC>
118  BVA b0, BVB b1, BVC b2)
119  : Propagator(home,p) {
120  x0.update(home,b0);
121  x1.update(home,b1);
122  x2.update(home,b2);
123  }
124 
125  template<class BVA, class BVB, class BVC>
126  PropCost
129  }
130 
131  template<class BVA, class BVB, class BVC>
132  void
134  x0.reschedule(home,*this,PC_BOOL_VAL);
135  x1.reschedule(home,*this,PC_BOOL_VAL);
136  x2.reschedule(home,*this,PC_BOOL_VAL);
137  }
138 
139  template<class BVA, class BVB, class BVC>
140  forceinline size_t
142  x0.cancel(home,*this,PC_BOOL_VAL);
143  x1.cancel(home,*this,PC_BOOL_VAL);
144  x2.cancel(home,*this,PC_BOOL_VAL);
145  (void) Propagator::dispose(home);
146  return sizeof(*this);
147  }
148 
149 }}}
150 
151 // STATISTICS: int-prop
BVC x2
Boolean view Constructor for posting.
Definition: bool.hh:85
Base-class for propagators.
Definition: core.hpp:1016
#define forceinline
Definition: config.hpp:182
BoolBinary(Home home, BVA b0, BVB b1)
Definition: base.hpp:46
Computation spaces.
Definition: core.hpp:1668
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:98
virtual void reschedule(Space &home)
Schedule function.
Definition: base.hpp:133
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
Definition: base.hpp:127
BVB x1
Boolean view.
Definition: bool.hh:84
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: base.hpp:141
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:3172
Propagation cost.
Definition: core.hpp:478
BVA x0
Boolean view.
Definition: bool.hh:83
Gecode toplevel namespace
Base-class for ternary Boolean propagators.
Definition: bool.hh:81
BVA x0
Boolean view.
Definition: bool.hh:61
Base-class for binary Boolean propagators.
Definition: bool.hh:59
void reschedule(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:96
int ModEventDelta
Modification event deltas.
Definition: core.hpp:91
Home class for posting propagators
Definition: core.hpp:846
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Definition: core.hpp:4656
void unary(Home home, const IntVarArgs &s, const IntArgs &p, IntPropLevel ipl)
Post propagators for scheduling tasks on unary resources.
Definition: unary.cpp:48
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Definition: var-type.hpp:126