jopt.csp.spi.arcalgorithm.graph
Interface NodeArcGraph

All Known Implementing Classes:
NodeArcGraphImpl

public interface NodeArcGraph

Interface for a graph that tracks all nodes and arcs within a CLP problem. The graph can be used by an AC algorithm in order to ensure node consistency. The graph is required to track source node dependencies so that an algorithm can determine what arcs should be propagated in response to different types of node changes. A domain sourced arc is the most basic type of arc. Any changes to the source node should cause the connect arc to be propagated. A range arc is one that only needs to be propagated when the minimum or maximum value of the source node changes. For example, if an arc only needs to ensure that the target node is greater than the source node, the arc only needs to be propagated when the minimum value for the source node changes. A value arc is one that only needs to be propagated when the source node is bound. This is useful for arcs such as source != target where the values to remove from the target cannot be determined until source is bound.

Author:
Nick

Method Summary
 void addArc(Arc arc)
          Adds an arc to the graph and connects all nodes contained within it
 void addNode(Node node)
          Adds a node to the set of nodes contained in this graph
 boolean containsNode(Node node)
          Returns true if graph contains specific node
 java.util.Set getAllArcs()
          Returns all the arcs contained in the graph
 java.util.Set getAllNodes()
          Returns all the nodes contained in the graph
 java.util.Set getDomainSourceArcs(Node node)
          Retrieves a set of domain dependent source arcs for node
 java.lang.Object getGraphState()
          Returns an object containing current state of the graph: the arcs and nodes in the graph along with domain information of the nodes.
 java.util.Set getRangeSourceArcs(Node node)
          Retrieves a set of range dependent source arcs for node
 java.util.Set getValueSourceArcs(Node node)
          Retrieves a set of value dependent source arcs for node
 java.lang.String nodesDescription()
          Returns string with node information that can be compared for a change to the graph
 void restoreGraphState(java.lang.Object state)
          Restores the current state of the graph.
 void setChoicePointStack(ChoicePointStack cps)
          Sets the choicepoint stack associated with this graph Can only be set once
 

Method Detail

addNode

public void addNode(Node node)
Adds a node to the set of nodes contained in this graph


addArc

public void addArc(Arc arc)
Adds an arc to the graph and connects all nodes contained within it


getValueSourceArcs

public java.util.Set getValueSourceArcs(Node node)
Retrieves a set of value dependent source arcs for node


getRangeSourceArcs

public java.util.Set getRangeSourceArcs(Node node)
Retrieves a set of range dependent source arcs for node


getDomainSourceArcs

public java.util.Set getDomainSourceArcs(Node node)
Retrieves a set of domain dependent source arcs for node


containsNode

public boolean containsNode(Node node)
Returns true if graph contains specific node


setChoicePointStack

public void setChoicePointStack(ChoicePointStack cps)
Sets the choicepoint stack associated with this graph Can only be set once


getAllNodes

public java.util.Set getAllNodes()
Returns all the nodes contained in the graph


getAllArcs

public java.util.Set getAllArcs()
Returns all the arcs contained in the graph


getGraphState

public java.lang.Object getGraphState()
Returns an object containing current state of the graph: the arcs and nodes in the graph along with domain information of the nodes. This state can be restored with the restoreGraphState method.


restoreGraphState

public void restoreGraphState(java.lang.Object state)
Restores the current state of the graph. Restores the sets of arcs and nodes as well as domain information for each node.


nodesDescription

public java.lang.String nodesDescription()
Returns string with node information that can be compared for a change to the graph