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