public class CSPBinaryConstraint extends BinaryConstraint<CSPVariable,CSPValue>
iAssignedVariables, iConstraintListeners, iId
Constructor and Description |
---|
CSPBinaryConstraint(int id,
int nrCompatiblePairs)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
computeConflicts(CSPValue aValue,
Set<CSPValue> conflicts)
Add the other variable to the set of conflicts, if it is not compatible
with the given value.
|
String |
getName()
Constraint's name -- for printing purposes
|
void |
init(Random rndNumGen)
Initializes the constraint.
|
boolean |
isConsistent(CSPValue value1,
CSPValue value2)
True if the pair of given values is compatible.
|
addVariable, another, first, isFirst, second
addConstraintListener, assigned, assignedVariables, compareTo, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, inConflict, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variables
public CSPBinaryConstraint(int id, int nrCompatiblePairs)
nrCompatiblePairs
- number of compatible pairs of values in the constraintpublic void init(Random rndNumGen)
rndNumGen
- random number generatorpublic boolean isConsistent(CSPValue value1, CSPValue value2)
isConsistent
in class Constraint<CSPVariable,CSPValue>
public void computeConflicts(CSPValue aValue, Set<CSPValue> conflicts)
computeConflicts
in class Constraint<CSPVariable,CSPValue>
aValue
- value to be assigned to its varaibleconflicts
- resultant set of conflicting valuespublic String getName()
Constraint
getName
in class Constraint<CSPVariable,CSPValue>