Generated on Wed Jan 1 2020 10:37:59 for Gecode by doxygen 1.8.16
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>
43  Node<View>::Node(void) : min(0) {
44  // Must be initialized such that the node is considered unvisited initially
45  }
46  template<class View>
48  Node<View>::edge_fst(void) const {
49  return static_cast<Edge<View>*>(BiLink::next());
50  }
51  template<class 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>
77  : _val(v), _matching(NULL) {}
78  template<class View>
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
90  _matching = m;
91  }
92  template<class View>
95  return _matching;
96  }
97  template<class View>
100  return &_next_val;
101  }
102  template<class View>
105  return _next_val;
106  }
107  template<class View>
108  forceinline void
110  _next_val = n;
111  }
112 
113 
114 
115  /*
116  * View nodes
117  *
118  */
119 
120  template<class View>
123  : _view(View(NULL)) {}
124  template<class View>
127  : _size(x.size()), _view(x) {}
128  template<class View>
131  return _val_edges;
132  }
133  template<class View>
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
151  return _size != _view.size();
152  }
153  template<class View>
154  forceinline void
156  _size = _view.size();
157  }
158  template<class View>
159  forceinline bool
162  }
163 
164 }}}
165 
166 // STATISTICS: int-prop
167 
Base-class for nodes (both view and value nodes)
View nodes in view-value graph.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Computation spaces.
Definition: core.hpp:1742
Gecode toplevel namespace
void update(IntSet &y, Space &home, IntSet &py)
Definition: rel.hpp:103
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
Edges in view-value graph.
Node(void)
Initialize.
Definition: node.hpp:43
const int v[7]
Definition: distinct.cpp:259
Value nodes in view-value graph.
#define forceinline
Definition: config.hpp:185
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:67
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234