40 #ifndef __GECODE_INT_VIEW_VAL_GRAPH_HH__
41 #define __GECODE_INT_VIEW_VAL_GRAPH_HH__
49 namespace Gecode {
namespace Int {
namespace ViewValGraph {
66 void init(T* p1, T* p2);
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 {
int is_set(void) const
Check whether flag is set.
Bidirectional links for edges and anchors in nodes of view-value graph.
BiLink * prev(void) const
Return previous element.
Edge< View > * next_edge(void) const
Return next edge in list of value edges.
bool initialized(void) const
Test whether graph has been initialized.
Edge< View > * edge_fst(void) const
Return first edge (organized by bi-links)
ViewNode< View > ** view
Array of view nodes.
ValNode< View > * val(ViewNode< View > *x) const
Return value node when view node x is given.
Edge< View > * val_edges(void) const
Return first edge of all value edges.
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.
Edge< View > * next(void) const
Return next edge in list of edges per node.
ViewNode< View > * view(ValNode< View > *v) const
Return view node when value node v is given.
Edges in view-value graph.
ValNode< View > * next_val(void) const
Return next value node.
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.
int val(void) const
Return value of node.
View view(void) const
Return view.
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.
View nodes in view-value graph.
void mark(void)
Mark element (invalidates next element pointer)
View _view
The node's view.
unsigned int low
Values for computing strongly connected components.
void revert(Node< View > *d)
Revert edge to node d for matching.
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)
Edge< View > * edge_lst(void) const
Return last edge (organized by bi-links)
Graph(void)
Construct graph as not yet initialized.
bool marked(void) const
Whether element is marked.
void init(Space &home, ViewNode< View > *x)
Initialize the edges for the view node x.
bool fake(void) const
Test whether node has a fake view.
View-value graph base class.
bool used(Node< View > *v) const
Whether edge is used (marked or between nodes from the same scc)
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.
Edge< View > * matching(void) const
Return matching edge (NULL if unmatched)
BiLink(void)
Initialize as empty (self referenced)
unsigned int count
Marking counter.
void use(void)
Mark node as used.
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 changed(void) const
Return whether view has changed its size.
Stack with fixed number of elements.
ValNode< View > * val
Array of value nodes.
void free(void)
Unmark node as used.
int val(void) const
Return current value.
bool operator()(void) const
Test whether iterator is still at a value or done.
T * ptr(T *p) const
Return the other pointer when p is given.
Gecode toplevel namespace
void scc(Space &home)
Compute the strongly connected components.
Node< View > * dst(Node< View > *s) const
Return destination of edge when source s is given.
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)
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)
BiLink * next(void) const
Return next element.
CombPtrFlag(T *p1, T *p2)
Initialize with pointer p1 and p2.
bool matched(void) const
Whether the node is matched.
ValNode< View > * _next_val
The next value node.