main page
modules
namespaces
classes
files
Gecode home
Generated on Fri Jan 10 2020 11:38:25 for Gecode by
doxygen
1.8.16
gecode
int
bool
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
34
namespace
Gecode
{
namespace
Int {
namespace
Bool {
35
36
/*
37
* Binary Boolean propagators
38
*
39
*/
40
template
<
class
BVA,
class
BVB>
41
forceinline
42
BoolBinary<BVA,BVB>::BoolBinary
(
Home
home, BVA b0, BVB
b1
)
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>
49
forceinline
50
BoolBinary<BVA,BVB>::BoolBinary
(
Space
& home,
BoolBinary<BVA,BVB>
&
p
)
51
:
Propagator
(home,
p
) {
52
x0.update(home,
p
.x0);
53
x1.update(home,
p
.x1);
54
}
55
56
template
<
class
BVA,
class
BVB>
57
forceinline
58
BoolBinary<BVA,BVB>::BoolBinary
(
Space
& home,
Propagator
&
p
,
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>
66
PropCost
67
BoolBinary<BVA,BVB>::cost
(
const
Space
&,
const
ModEventDelta
&)
const
{
68
return
PropCost::unary
(PropCost::LO);
69
}
70
71
template
<
class
BVA,
class
BVB>
72
void
73
BoolBinary<BVA,BVB>::reschedule
(
Space
& home) {
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
80
BoolBinary<BVA,BVB>::dispose
(
Space
& home) {
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>
92
forceinline
93
BoolTernary<BVA,BVB,BVC>::BoolTernary
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>
102
forceinline
103
BoolTernary<BVA,BVB,BVC>::BoolTernary
(
Space
& home,
104
BoolTernary<BVA,BVB,BVC>
&
p
)
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>
112
forceinline
113
BoolTernary<BVA,BVB,BVC>::BoolTernary
(
Space
& home,
Propagator
&
p
,
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>
122
PropCost
123
BoolTernary<BVA,BVB,BVC>::cost
(
const
Space
&,
const
ModEventDelta
&)
const
{
124
return
PropCost::binary
(
PropCost::LO
);
125
}
126
127
template
<
class
BVA,
class
BVB,
class
BVC>
128
void
129
BoolTernary<BVA,BVB,BVC>::reschedule
(
Space
& home) {
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
137
BoolTernary<BVA,BVB,BVC>::dispose
(
Space
& home) {
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
Gecode::Int::Bool::BoolTernary::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition:
base.hpp:137
Gecode::Int::PC_BOOL_VAL
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Definition:
var-type.hpp:126
Gecode::PropCost::binary
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Definition:
core.hpp:4809
Gecode::Int::Bool::BoolTernary::x1
BVB x1
Boolean view.
Definition:
bool.hh:80
Gecode::Int::Bool::BoolTernary::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition:
base.hpp:129
Gecode::Int::Bool::BoolTernary::x0
BVA x0
Boolean view.
Definition:
bool.hh:79
Gecode::PropCost::LO
Cheap.
Definition:
core.hpp:513
Gecode::Int::Bool::BoolBinary::BoolBinary
BoolBinary(Home home, BVA b0, BVB b1)
Definition:
base.hpp:42
Gecode::Int::Bool::BoolTernary::x2
BVC x2
Boolean view Constructor for posting.
Definition:
bool.hh:81
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode
Gecode toplevel namespace
Gecode::Propagator
Base-class for propagators.
Definition:
core.hpp:1064
Gecode::Int::Count::reschedule
void reschedule(Space &home, Propagator &p, IntSet &y)
Definition:
rel.hpp:92
Test::Int::Basic::b1
Basic b1(3)
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:856
Gecode::Int::Bool::BoolTernary::BoolTernary
BoolTernary(Home home, BVA b0, BVB b1, BVC b2)
Definition:
base.hpp:94
Test::Int::Basic::b2
Basic b2(i)
Gecode::Int::Bool::BoolTernary::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
Definition:
base.hpp:123
Gecode::Int::Bool::BoolBinary
Base-class for binary Boolean propagators.
Definition:
bool.hh:55
Gecode::Int::Bool::BoolTernary
Base-class for ternary Boolean propagators.
Definition:
bool.hh:77
Gecode::PropCost
Propagation cost.
Definition:
core.hpp:486
forceinline
#define forceinline
Definition:
config.hpp:185
Gecode::Actor::dispose
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition:
core.hpp:3252
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition:
core.hpp:89
Gecode::unary
void unary(Home home, const IntVarArgs &s, const IntArgs &p, IntPropLevel ipl)
Post propagators for scheduling tasks on unary resources.
Definition:
unary.cpp:44
p
int p
Number of positive literals for node type.
Definition:
bool-expr.cpp:232