public class CSPBinaryConstraint extends BinaryConstraint<CSPVariable,CSPValue>
iConstraintListeners, iId| Constructor and Description |
|---|
CSPBinaryConstraint(int id,
int nrCompatiblePairs)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
computeConflicts(Assignment<CSPVariable,CSPValue> assignment,
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, secondaddConstraintListener, assigned, assignedVariables, compareTo, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, inConflict, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variablespublic CSPBinaryConstraint(int id, int nrCompatiblePairs)
id - constraint idnrCompatiblePairs - 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>value1 - a valuevalue2 - a valuepublic void computeConflicts(Assignment<CSPVariable,CSPValue> assignment, CSPValue aValue, Set<CSPValue> conflicts)
computeConflicts in class Constraint<CSPVariable,CSPValue>assignment - current assignmentaValue - value to be assigned to its variableconflicts - resultant set of conflicting valuespublic String getName()
ConstraintgetName in class Constraint<CSPVariable,CSPValue>