main page
modules
namespaces
classes
files
Gecode home
Generated on Wed Jan 1 2020 10:37:59 for Gecode by
doxygen
1.8.16
gecode
int
view-val-graph
node.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, 2003
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
ViewValGraph {
35
36
/*
37
* Nodes
38
*
39
*/
40
41
template
<
class
View>
42
forceinline
43
Node<View>::Node
(
void
) :
min
(0) {
44
// Must be initialized such that the node is considered unvisited initially
45
}
46
template
<
class
View>
47
forceinline
Edge<View>
*
48
Node<View>::edge_fst
(
void
)
const
{
49
return
static_cast<
Edge<View>
*
>
(BiLink::next());
50
}
51
template
<
class
View>
52
forceinline
Edge<View>
*
53
Node<View>::edge_lst
(
void
)
const
{
54
return
static_cast<
Edge<View>
*
>
(static_cast<BiLink*>(
const_cast<
Node<View>
*
>
(
this
)));
55
}
56
template
<
class
View>
57
forceinline
void
58
Node<View>::operator
delete
(
void
*, size_t) {}
59
template
<
class
View>
60
forceinline
void
61
Node<View>::operator
delete
(
void
*,
Space
&) {}
62
template
<
class
View>
63
forceinline
void
*
64
Node<View>::operator
new
(
size_t
s,
Space
& home) {
65
return
home.ralloc(s);
66
}
67
68
/*
69
* Value nodes
70
*
71
*/
72
73
74
template
<
class
View>
75
forceinline
76
ValNode<View>::ValNode
(
int
v
)
77
: _val(
v
), _matching(NULL) {}
78
template
<
class
View>
79
forceinline
80
ValNode<View>::ValNode
(
int
v
,
ValNode<View>
*
n
)
81
: _val(
v
), _matching(NULL), _next_val(
n
) {}
82
template
<
class
View>
83
forceinline
int
84
ValNode<View>::val
(
void
)
const
{
85
return
_val;
86
}
87
template
<
class
View>
88
forceinline
void
89
ValNode<View>::matching
(
Edge<View>
* m) {
90
_matching = m;
91
}
92
template
<
class
View>
93
forceinline
Edge<View>
*
94
ValNode<View>::matching
(
void
)
const
{
95
return
_matching;
96
}
97
template
<
class
View>
98
forceinline
ValNode<View>
**
99
ValNode<View>::next_val_ref
(
void
) {
100
return
&_next_val;
101
}
102
template
<
class
View>
103
forceinline
ValNode<View>
*
104
ValNode<View>::next_val
(
void
)
const
{
105
return
_next_val;
106
}
107
template
<
class
View>
108
forceinline
void
109
ValNode<View>::next_val
(
ValNode<View>
*
n
) {
110
_next_val =
n
;
111
}
112
113
114
115
/*
116
* View nodes
117
*
118
*/
119
120
template
<
class
View>
121
forceinline
122
ViewNode<View>::ViewNode
(
void
)
123
: _view(View(NULL)) {}
124
template
<
class
View>
125
forceinline
126
ViewNode<View>::ViewNode
(View
x
)
127
: _size(
x
.
size
()), _view(
x
) {}
128
template
<
class
View>
129
forceinline
Edge<View>
*
130
ViewNode<View>::val_edges
(
void
)
const
{
131
return
_val_edges;
132
}
133
template
<
class
View>
134
forceinline
Edge<View>
**
135
ViewNode<View>::val_edges_ref
(
void
) {
136
return
&_val_edges;
137
}
138
template
<
class
View>
139
forceinline
bool
140
ViewNode<View>::fake
(
void
)
const
{
141
return
_view.varimp() == NULL;
142
}
143
template
<
class
View>
144
forceinline
View
145
ViewNode<View>::view
(
void
)
const
{
146
return
_view;
147
}
148
template
<
class
View>
149
forceinline
bool
150
ViewNode<View>::changed
(
void
)
const
{
151
return
_size != _view.size();
152
}
153
template
<
class
View>
154
forceinline
void
155
ViewNode<View>::update
(
void
) {
156
_size = _view.size();
157
}
158
template
<
class
View>
159
forceinline
bool
160
ViewNode<View>::matched
(
void
)
const
{
161
return
Node<View>::edge_fst
() !=
Node<View>::edge_lst
();
162
}
163
164
}}}
165
166
// STATISTICS: int-prop
167
Gecode::Int::ViewValGraph::Node
Base-class for nodes (both view and value nodes)
Definition:
view-val-graph.hh:116
Gecode::Int::ViewValGraph::ViewNode
View nodes in view-value graph.
Definition:
view-val-graph.hh:174
Gecode::Iter::Ranges::size
unsigned int size(I &i)
Size of all ranges of range iterator i.
Definition:
ranges-operations.hpp:74
Gecode::Space
Computation spaces.
Definition:
core.hpp:1742
Gecode
Gecode toplevel namespace
Gecode::Int::Count::update
void update(IntSet &y, Space &home, IntSet &py)
Definition:
rel.hpp:103
x
Node * x
Pointer to corresponding Boolean expression node.
Definition:
bool-expr.cpp:249
Gecode::Int::ViewValGraph::Edge
Edges in view-value graph.
Definition:
view-val-graph.hh:104
Gecode::Int::ViewValGraph::Node::Node
Node(void)
Initialize.
Definition:
node.hpp:43
Test::Int::Distinct::v
const int v[7]
Definition:
distinct.cpp:259
Gecode::Int::ViewValGraph::ValNode
Value nodes in view-value graph.
Definition:
view-val-graph.hh:142
forceinline
#define forceinline
Definition:
config.hpp:185
Gecode::min
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition:
arithmetic.cpp:67
n
int n
Number of negative literals for node type.
Definition:
bool-expr.cpp:234