omnics.constraint
Class BinaryConstraint
java.lang.Object
omnics.Constraint
omnics.constraint.BinaryConstraint
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- BinaryIntConstraint, DistEq, DistNeq, Less, LessOrEqual, NotEqual
public abstract class BinaryConstraint
- extends Constraint
Convenience abstract class that defines a binary constraint.
It exposes for subclasses the variables x,y and their
indices xIndex, yIndex
- Author:
- Cristian Frasinaru
- See Also:
- Serialized Form
|
Method Summary |
abstract int |
eval(java.lang.Object a,
java.lang.Object b)
This is the method that evaluates the tuple (x=a,y=b). |
int |
eval(Tuple tuple)
Method used by the solver. |
int |
eval(Var x,
Var y,
java.lang.Object a,
java.lang.Object b)
Method used by the General Arc Consistency algorithm. |
| Methods inherited from class omnics.Constraint |
eval, getFilter, getName, getProblem, getTuples, getVarArray, getVariables, setFilter, setName, setVariables, setVariables, toString, variable |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
x
protected Var x
y
protected Var y
xIndex
protected int xIndex
yIndex
protected int yIndex
BinaryConstraint
public BinaryConstraint(Var x,
Var y)
- Creates a new instance of BinaryConstraint
eval
public abstract int eval(java.lang.Object a,
java.lang.Object b)
- This is the method that evaluates the tuple (x=a,y=b).
Must be implemented in the subclasses.
eval
public int eval(Var x,
Var y,
java.lang.Object a,
java.lang.Object b)
- Method used by the General Arc Consistency algorithm.
- Overrides:
eval in class Constraint
- Parameters:
x - some variable of the constrainty - some variable of the constrainta - some value in x's domainb - some value in y's domain
- Returns:
- a value between ValuationStructure.MIN and
ValuationStructure.MAX.
- See Also:
Constraint.eval(Tuple),
ValuationStructure
eval
public int eval(Tuple tuple)
- Method used by the solver.
- Specified by:
eval in class Constraint
- Parameters:
tuple - some tuple
- Returns:
- a value between ValuationStructure.MIN and
ValuationStructure.MAX.
- See Also:
Constraint.eval(Tuple),
ValuationStructure