Generated on Thu Mar 16 2017 03:24:18 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: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
11  * $Revision: 15137 $
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
73  return PropCost::unary(PropCost::LO);
74  }
75 
76  template<class BVA, class BVB>
77  void
79  x0.reschedule(home,*this,PC_BOOL_VAL);
80  x1.reschedule(home,*this,PC_BOOL_VAL);
81  }
82 
83  template<class BVA, class BVB>
84  forceinline size_t
86  x0.cancel(home,*this,PC_BOOL_VAL);
87  x1.cancel(home,*this,PC_BOOL_VAL);
88  (void) Propagator::dispose(home);
89  return sizeof(*this);
90  }
91 
92  /*
93  * Ternary Boolean propagators
94  *
95  */
96  template<class BVA, class BVB, class BVC>
99  (Home home, BVA b0, BVB b1, BVC b2)
100  : Propagator(home), x0(b0), x1(b1), x2(b2) {
101  x0.subscribe(home,*this,PC_BOOL_VAL);
102  x1.subscribe(home,*this,PC_BOOL_VAL);
103  x2.subscribe(home,*this,PC_BOOL_VAL);
104  }
105 
106  template<class BVA, class BVB, class BVC>
110  : Propagator(home,share,p) {
111  x0.update(home,share,p.x0);
112  x1.update(home,share,p.x1);
113  x2.update(home,share,p.x2);
114  }
115 
116  template<class BVA, class BVB, class BVC>
119  BVA b0, BVB b1, BVC b2)
120  : Propagator(home,share,p) {
121  x0.update(home,share,b0);
122  x1.update(home,share,b1);
123  x2.update(home,share,b2);
124  }
125 
126  template<class BVA, class BVB, class BVC>
127  PropCost
130  }
131 
132  template<class BVA, class BVB, class BVC>
133  void
135  x0.reschedule(home,*this,PC_BOOL_VAL);
136  x1.reschedule(home,*this,PC_BOOL_VAL);
137  x2.reschedule(home,*this,PC_BOOL_VAL);
138  }
139 
140  template<class BVA, class BVB, class BVC>
141  forceinline size_t
143  x0.cancel(home,*this,PC_BOOL_VAL);
144  x1.cancel(home,*this,PC_BOOL_VAL);
145  x2.cancel(home,*this,PC_BOOL_VAL);
146  (void) Propagator::dispose(home);
147  return sizeof(*this);
148  }
149 
150 }}}
151 
152 // STATISTICS: int-prop
BVC x2
Boolean view Constructor for posting.
Definition: bool.hh:85
Base-class for propagators.
Definition: core.hpp:1012
BoolBinary(Home home, BVA b0, BVB b1)
Definition: base.hpp:46
Computation spaces.
Definition: core.hpp:1672
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:99
virtual void reschedule(Space &home)
Schedule function.
Definition: base.hpp:134
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
Definition: base.hpp:128
BVB x1
Boolean view.
Definition: bool.hh:84
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: base.hpp:142
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:3281
Propagation cost.
Definition: core.hpp:550
#define forceinline
Definition: config.hpp:173
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:169
Home class for posting propagators
Definition: core.hpp:905
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Definition: core.hpp:4590
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