40 #ifndef __GECODE_INT_VIEW_VAL_GRAPH_HH__ 41 #define __GECODE_INT_VIEW_VAL_GRAPH_HH__ 49 namespace Gecode {
namespace Int {
namespace ViewValGraph {
104 bool empty(
void)
const;
108 template<
class View>
class Edge;
134 static void*
operator new(size_t,
Space&);
136 static void operator delete(
void*, size_t);
138 static void operator delete(
void*,
Space&);
196 bool fake(
void)
const;
198 View
view(
void)
const;
249 static void*
operator new(size_t,
Space&);
251 static void operator delete(
void*, size_t);
253 static void operator delete(
void*,
Space&);
294 namespace Gecode {
namespace Int {
namespace ViewValGraph {
Bidirectional links for edges and anchors in nodes of view-value graph.
Edge< View > * val_edges(void) const
Return first edge of all value edges.
bool initialized(void) const
Test whether graph has been initialized.
ViewNode< View > ** view
Array of view nodes.
ValNode< View > * next_val(void) const
Return next value node.
int val(void) const
Return value of node.
Edge< View > ** next_edge_ref(void)
Return reference to next edge in list of value edges.
void update(void)
Update size of view after change.
IterPruneVal(ViewNode< View > *x)
Initialize with edges for view node x.
Edges in view-value graph.
bool used(Node< View > *v) const
Whether edge is used (marked or between nodes from the same scc)
ValNode< View > ** next_val_ref(void)
Return pointer to next value node fields.
int n_view
Number of view nodes.
int n_val
Number of value nodes.
const int _val
The value of the node.
ViewNode< View > * view(ValNode< View > *v) const
Return view node when value node v is given.
Support::StaticStack< ViewNode< View > *, Region > ViewNodeStack
Stack used during matching.
int p
Number of positive literals for node type.
void add(BiLink *l)
Add l after this element.
ViewNode(void)
Initialize node for a non-view.
Gecode::IntArgs p2(4, 4, 3, 3, 5)
int n
Number of negative literals for node type.
unsigned int _size
The size of the view after last change.
Edge< View > * next_edge(void) const
Return next edge in list of value edges.
View nodes in view-value graph.
void mark(void)
Mark element (invalidates next element pointer)
Edge< View > * next(void) const
Return next edge in list of edges per node.
View _view
The node's view.
Node< View > * dst(Node< View > *s) const
Return destination of edge when source s is given.
unsigned int low
Values for computing strongly connected components.
bool fake(void) const
Test whether node has a fake view.
void revert(Node< View > *d)
Revert edge to node d for matching.
BiLink * next(void) const
Return next element.
T * ptr(T *p) const
Return the other pointer when p is given.
Edge< View > * _next_edge
Next edge in chain of value edges.
Edge< View > * _matching
The matching edge.
Class for combining two pointers with a flag.
void purge(void)
Purge graph if necessary (reset information to avoid overflow)
Graph(void)
Construct graph as not yet initialized.
int is_set(void) const
Check whether flag is set.
ValNode< View > * val(ViewNode< View > *x) const
Return value node when view node x is given.
Edge< View > * edge_lst(void) const
Return last edge (organized by bi-links)
bool changed(void) const
Return whether view has changed its size.
void init(Space &home, ViewNode< View > *x)
Initialize the edges for the view node x.
bool marked(void) const
Whether element is marked.
View-value graph base class.
void unlink(void)
Unlink this element.
ValNode(int v)
Initialize with value v.
Iterates the values to be pruned from a view node.
Edge< View > * _val_edges
The first value edge.
Edge< View > * e
Current value edge.
BiLink(void)
Initialize as empty (self referenced)
unsigned int count
Marking counter.
void use(void)
Mark node as used.
int val(void) const
Return current value.
void operator++(void)
Move iterator to next value (if possible)
Node * x
Pointer to corresponding Boolean expression node.
CombPtrFlag< Node< View > > sd
Combine source and destination node and flag.
Edge< View > ** val_edges_ref(void)
Return pointer to first edge fields of all value edges.
Value nodes in view-value graph.
bool matched(void) const
Whether the node is matched.
Stack with fixed number of elements.
View view(void) const
Return view.
ValNode< View > * val
Array of value nodes.
void free(void)
Unmark node as used.
Edge< View > * matching(void) const
Return matching edge (NULL if unmatched)
Gecode toplevel namespace
BiLink * prev(void) const
Return previous element.
Edge< View > * edge_fst(void) const
Return first edge (organized by bi-links)
void scc(Space &home)
Compute the strongly connected components.
bool empty(void) const
Whether element has no previous and next element.
void init(T *p1, T *p2)
Initialize with pointer p1 and p2.
bool match(ViewNodeStack &m, ViewNode< View > *x)
Find a matching for node x.
Edge< View > * iter
Next edge for computing strongly connected components.
ViewNode< View > * x
View node.
Gecode::IntArgs p1(4, 2, 2, 2, 2)
bool operator()(void) const
Test whether iterator is still at a value or done.
void unset(void)
Clear flag.
Edge(ValNode< View > *v, ViewNode< View > *x)
Construct new edge between x and v.
Base-class for nodes (both view and value nodes)
CombPtrFlag(T *p1, T *p2)
Initialize with pointer p1 and p2.
ValNode< View > * _next_val
The next value node.