jopt.csp.variable
Interface CspAlgorithm


public interface CspAlgorithm

Interface implemented by propagation algorithms supported by the CspSolver. Such algorithms do not use a tree search but work only with the variables, constraints and domains--generally with the goal of domain reduction. Current implementations are all arc-consistency algorithms.

Author:
Nick Coleman

Method Summary
 void addConstraint(CspConstraint constraint)
          Adds a constraint to be managed by this algorithm
 void addVariable(CspVariable var)
          Adds a variable to be managed by this algorithm.
 CspVariableFactory getVarFactory()
          Returns the variable factory for this algorithm
 void propagate()
          Propagates constraints added to algorithm reducing domains of variables to which constraints are applied.
 

Method Detail

addVariable

public void addVariable(CspVariable var)
Adds a variable to be managed by this algorithm. The variable need not be a part of any posted constraint.

Parameters:
var - the variable to be added to and managed by the algorithm

addConstraint

public void addConstraint(CspConstraint constraint)
Adds a constraint to be managed by this algorithm

Parameters:
constraint - constraint that is to be added to and managed by the algorithm

propagate

public void propagate()
               throws PropagationFailureException
Propagates constraints added to algorithm reducing domains of variables to which constraints are applied.

Throws:
PropagationFailureException - If unable to successfully propagate constraints

getVarFactory

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

Returns:
a variable factory used to create variables for expressions, constraints, etc.