jopt.csp.spi.arcalgorithm.constraint
Class AbstractConstraint

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.variable.VariableChangeBase
      extended byjopt.csp.spi.arcalgorithm.constraint.AbstractConstraint
All Implemented Interfaces:
jopt.csp.variable.CspConstraint, GraphConstraint, NumConstants, PostableConstraint, VariableChangeSource
Direct Known Subclasses:
BooleanConstraint, GlobalCardinalityConstraint, GlobalCardinalityCountConstraint, NumAllDiffConstraint, NumConstraint, SetConstraint

public abstract class AbstractConstraint
extends VariableChangeBase
implements NumConstants, GraphConstraint

An abstract class used to represent a constraint. This class will contain all the items that are common to boolean, numerical, and set constraints. Each of the aforementioned types of constraints will implement or extend AbstractConstraint.


Field Summary
 
Fields inherited from interface jopt.csp.spi.util.NumConstants
ADD, DIVIDE, DIVIDE_BY, DIVIDE_BY_CEIL, DIVIDE_BY_FLOOR, DIVIDE_CEIL, DIVIDE_FLOOR, DOUBLE, DOUBLE_NEG_INF, DOUBLE_POS_INF, DOUBLE_ZERO, EQ, FLOAT, FLOAT_NEG_INF, FLOAT_POS_INF, FLOAT_ZERO, GEQ, GT, HALF_PI, INTEGER, INTEGER_MAX, INTEGER_MIN, INTEGER_ZERO, LEQ, LONG, LONG_MAX, LONG_MIN, LONG_ZERO, LT, MULTIPLY, NEQ, ONE_AND_HALF_PI, PI, RANGE, SUBTRACT, SUBTRACT_FROM, TWO_PI
 
Method Summary
 void associateToGraph(NodeArcGraph graph)
          Associates a constraint to a graph
 GraphConstraint getGraphConstraintFragment(GenericIndex[] indices)
          Returns a constraint that is a fragment of the current constraint based upon a set of indices that indication what portion of constraint should be returned
 PostableConstraint getPostableOpposite()
          Returns a constraint that is the opposite of this constraint
 boolean isFalse()
          Returns true if constraint cannot be satisfied
 boolean isTrue()
          Returns true if constraint cannot be dissatisfied
 boolean isViolated(boolean allViolated)
          Returns true if constraint cannot be satisfied.
 jopt.csp.variable.CspBooleanExpr toBoolean()
           
 
Methods inherited from class jopt.csp.spi.arcalgorithm.variable.VariableChangeBase
addVariableChangeListener, removeVariableChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jopt.csp.spi.arcalgorithm.graph.arc.PostableConstraint
getBooleanSourceArcs, getBooleanSourceNodes, postToGraph
 

Method Detail

associateToGraph

public void associateToGraph(NodeArcGraph graph)
Associates a constraint to a graph

Specified by:
associateToGraph in interface GraphConstraint

isFalse

public boolean isFalse()
Returns true if constraint cannot be satisfied

Specified by:
isFalse in interface jopt.csp.variable.CspConstraint

isTrue

public boolean isTrue()
Returns true if constraint cannot be dissatisfied

Specified by:
isTrue in interface jopt.csp.variable.CspConstraint

isViolated

public boolean isViolated(boolean allViolated)
Returns true if constraint cannot be satisfied. If all violated is true, this method returns true only when all conditions are violated. If all violated is false, this method returns true when any condition is violated. The presence of multiple conditions is an issue when generic vars/exprs are involved.

Parameters:
allViolated - Determines the criteria for violation

getPostableOpposite

public final PostableConstraint getPostableOpposite()
Returns a constraint that is the opposite of this constraint

Specified by:
getPostableOpposite in interface PostableConstraint

getGraphConstraintFragment

public final GraphConstraint getGraphConstraintFragment(GenericIndex[] indices)
Description copied from interface: GraphConstraint
Returns a constraint that is a fragment of the current constraint based upon a set of indices that indication what portion of constraint should be returned

Specified by:
getGraphConstraintFragment in interface GraphConstraint
Parameters:
indices - Array of indices that indicate fragment to return. Each index must be set to a specific value to indicate fragment desired.

toBoolean

public final jopt.csp.variable.CspBooleanExpr toBoolean()
Specified by:
toBoolean in interface jopt.csp.variable.CspConstraint