jopt.csp.spi.arcalgorithm.constraint.num
Class NumRangeConstraint

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.variable.VariableChangeBase
      extended byjopt.csp.spi.arcalgorithm.constraint.AbstractConstraint
          extended byjopt.csp.spi.arcalgorithm.constraint.num.NumConstraint
              extended byjopt.csp.spi.arcalgorithm.constraint.num.NumRangeConstraint
All Implemented Interfaces:
jopt.csp.variable.CspConstraint, GraphConstraint, NumConstants, PostableConstraint, VariableChangeSource
Direct Known Subclasses:
NumBetweenConstraint, NumNotBetweenConstraint

public abstract class NumRangeConstraint
extends NumConstraint

Base class for arcs that restrict numbers to a range


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
 
Constructor Summary
NumRangeConstraint(jopt.csp.variable.CspGenericNumConstant sourceMin, boolean minExclusive, jopt.csp.variable.CspGenericNumConstant sourceMax, boolean maxExclusive, NumExpr z, GenericIndex[] restrictedIndices)
           
NumRangeConstraint(java.lang.Number sourceMin, boolean minExclusive, java.lang.Number sourceMax, boolean maxExclusive, NumExpr z, GenericIndex[] restrictedIndices)
           
NumRangeConstraint(NumExpr sourceMin, boolean minExclusive, NumExpr sourceMax, boolean maxExclusive, NumExpr z, GenericIndex[] restrictedIndices)
           
 
Method Summary
 Arc[] getBooleanSourceArcs()
          Returns array of arcs that will affect the boolean true / false value of this constraint upon a change
 Arc[] getBooleanSourceArcs(boolean useConstraint)
          Returns array of arcs that will affect the boolean true / false value of this constraint upon a change
 Node[] getBooleanSourceNodes()
          Returns array of nodes that will affect the boolean true / false value of this constraint upon a change
 GenericIndexManager getIndexManager()
           
 java.lang.Number getLargestMax(NumExpr n, GenericNumExpr gn)
           
 java.lang.Number getLargestMin(NumExpr n, GenericNumExpr gn)
           
 java.lang.Number getSmallestMax(NumExpr n, GenericNumExpr gn)
           
 java.lang.Number getSmallestMin(NumExpr n, GenericNumExpr gn)
           
 boolean isViolated(boolean allViolated)
          Returns true if constraint cannot be satisfied.
 void postToGraph()
          Posts a boolean constraint to the graph for use during propagation
abstract  boolean violated()
           
 
Methods inherited from class jopt.csp.spi.arcalgorithm.constraint.num.NumConstraint
addVariableChangeListener, removeVariableChangeListener
 
Methods inherited from class jopt.csp.spi.arcalgorithm.constraint.AbstractConstraint
associateToGraph, getGraphConstraintFragment, getPostableOpposite, isFalse, isTrue, toBoolean
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumRangeConstraint

public NumRangeConstraint(NumExpr sourceMin,
                          boolean minExclusive,
                          NumExpr sourceMax,
                          boolean maxExclusive,
                          NumExpr z,
                          GenericIndex[] restrictedIndices)

NumRangeConstraint

public NumRangeConstraint(java.lang.Number sourceMin,
                          boolean minExclusive,
                          java.lang.Number sourceMax,
                          boolean maxExclusive,
                          NumExpr z,
                          GenericIndex[] restrictedIndices)

NumRangeConstraint

public NumRangeConstraint(jopt.csp.variable.CspGenericNumConstant sourceMin,
                          boolean minExclusive,
                          jopt.csp.variable.CspGenericNumConstant sourceMax,
                          boolean maxExclusive,
                          NumExpr z,
                          GenericIndex[] restrictedIndices)
Method Detail

violated

public abstract boolean violated()

getIndexManager

public GenericIndexManager getIndexManager()
Returns:
an index manager taking into account the appropriate restrictions

isViolated

public boolean isViolated(boolean allViolated)
Description copied from class: NumConstraint
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.

Specified by:
isViolated in class NumConstraint
Parameters:
allViolated - Determines the criteria for violation

postToGraph

public void postToGraph()
Description copied from interface: PostableConstraint
Posts a boolean constraint to the graph for use during propagation


getSmallestMin

public java.lang.Number getSmallestMin(NumExpr n,
                                       GenericNumExpr gn)
Overrides:
getSmallestMin in class NumConstraint

getLargestMin

public java.lang.Number getLargestMin(NumExpr n,
                                      GenericNumExpr gn)
Overrides:
getLargestMin in class NumConstraint

getSmallestMax

public java.lang.Number getSmallestMax(NumExpr n,
                                       GenericNumExpr gn)
Overrides:
getSmallestMax in class NumConstraint

getLargestMax

public java.lang.Number getLargestMax(NumExpr n,
                                      GenericNumExpr gn)
Overrides:
getLargestMax in class NumConstraint

getBooleanSourceNodes

public Node[] getBooleanSourceNodes()
Description copied from interface: PostableConstraint
Returns array of nodes that will affect the boolean true / false value of this constraint upon a change


getBooleanSourceArcs

public Arc[] getBooleanSourceArcs(boolean useConstraint)
Description copied from class: NumConstraint
Returns array of arcs that will affect the boolean true / false value of this constraint upon a change

Specified by:
getBooleanSourceArcs in class NumConstraint
Parameters:
useConstraint - a boolean that determines if the constraint at that level should be added. Constraints immediatly below a boolean constraint should not be added, while all others below should.

getBooleanSourceArcs

public Arc[] getBooleanSourceArcs()
Description copied from interface: PostableConstraint
Returns array of arcs that will affect the boolean true / false value of this constraint upon a change