private DomainRestoreInfo doForwardChecking(Variable var,
Assignment assignment, CSP csp)
{
DomainRestoreInfo result = new DomainRestoreInfo();
foreach (Constraint constraint in csp.getConstraints(var))
{
List<Variable> scope = constraint.getScope();
if (scope.Count == 2)
{
foreach (Variable neighbor in constraint.getScope())
{
if (!assignment.hasAssignmentFor(neighbor))
{
if (revise(neighbor, constraint, assignment, csp,
result))
{
if (csp.getDomain(neighbor).isEmpty())
{
result.setEmptyDomainFound(true);
return result;
}
}
}
}
}
}
return result;
}