jopt.csp.spi.arcalgorithm
Class ArcBasedAcAlg

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.ArcBasedAcAlg
All Implemented Interfaces:
ChoicePointAlgorithm, jopt.csp.variable.CspAlgorithm, NodeArcGraphListener
Direct Known Subclasses:
AC1, ArcQueueAcAlg, NodeQueueAcAlg

public abstract class ArcBasedAcAlg
extends java.lang.Object
implements ChoicePointAlgorithm, NodeArcGraphListener

Base class for arc-consistency algorithms. This includes an algorithm that is based on node-arc graph propagation.


Constructor Summary
ArcBasedAcAlg()
          Constructor
 
Method Summary
 void addConstraint(jopt.csp.variable.CspConstraint constraint)
          Adds a constraint to be managed by this algorithm
 void addVariable(jopt.csp.variable.CspVariable var)
          Adds a variable that may not a part of a constraint that is posted to be managed by this algorithm
 void arcAddedEvent(NodeArcGraph graph, Arc arc)
          Called when an arc is added to the graph as a result of arcs being posted by constraints.
 void arcRemovedEvent(NodeArcGraph graph, Arc arc)
          Called when an arc is removed from the graph, generally because the choice point stack is being popped.
 java.lang.Object getProblemState()
          Returns the current state of the problem.
 jopt.csp.variable.CspVariableFactory getVarFactory()
          Returns the variable factory for this algorithm
 void nodeChangedEvent(NodeArcGraph graph, NodeChangeEvent evt)
          Called when a node in the graph has a domain change.
 void nodeRemovedEvent(NodeArcGraph graph, Node n)
          Called when a node is removed from the graph, generally because the choice point stack is being popped.
 void restoreProblemState(java.lang.Object state)
          Restores the current state of the problem.
 void setChoicePointStack(ChoicePointStack cps)
          Sets the choicepoint stack associated with this algorithm.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jopt.csp.variable.CspAlgorithm
propagate
 

Constructor Detail

ArcBasedAcAlg

public ArcBasedAcAlg()
Constructor

Method Detail

addVariable

public void addVariable(jopt.csp.variable.CspVariable var)
Adds a variable that may not a part of a constraint that is posted to be managed by this algorithm

Specified by:
addVariable in interface jopt.csp.variable.CspAlgorithm

addConstraint

public void addConstraint(jopt.csp.variable.CspConstraint constraint)
Adds a constraint to be managed by this algorithm

Specified by:
addConstraint in interface jopt.csp.variable.CspAlgorithm

setChoicePointStack

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

Specified by:
setChoicePointStack in interface ChoicePointAlgorithm

getVarFactory

public jopt.csp.variable.CspVariableFactory getVarFactory()
Returns the variable factory for this algorithm

Specified by:
getVarFactory in interface jopt.csp.variable.CspAlgorithm

getProblemState

public java.lang.Object getProblemState()
Returns the current state of the problem. This includes arcs, nodes and node domains.

Specified by:
getProblemState in interface ChoicePointAlgorithm

restoreProblemState

public void restoreProblemState(java.lang.Object state)
Restores the current state of the problem. This includes arcs, nodes and node domains.

Specified by:
restoreProblemState in interface ChoicePointAlgorithm

arcAddedEvent

public void arcAddedEvent(NodeArcGraph graph,
                          Arc arc)
Description copied from interface: NodeArcGraphListener
Called when an arc is added to the graph as a result of arcs being posted by constraints.

Specified by:
arcAddedEvent in interface NodeArcGraphListener

arcRemovedEvent

public void arcRemovedEvent(NodeArcGraph graph,
                            Arc arc)
Description copied from interface: NodeArcGraphListener
Called when an arc is removed from the graph, generally because the choice point stack is being popped.

Specified by:
arcRemovedEvent in interface NodeArcGraphListener

nodeRemovedEvent

public void nodeRemovedEvent(NodeArcGraph graph,
                             Node n)
Description copied from interface: NodeArcGraphListener
Called when a node is removed from the graph, generally because the choice point stack is being popped.

Specified by:
nodeRemovedEvent in interface NodeArcGraphListener

nodeChangedEvent

public void nodeChangedEvent(NodeArcGraph graph,
                             NodeChangeEvent evt)
Description copied from interface: NodeArcGraphListener
Called when a node in the graph has a domain change. Node change events arise from changes in domain, including a change in range (bounds) or a domain being bound to a single value.

Specified by:
nodeChangedEvent in interface NodeArcGraphListener