public DomainRestoreInfo ReduceDomains(CSProblem csp) { var result = new DomainRestoreInfo(); var queue = new FIFOQueue <Variable>(); foreach (Variable var in csp.Variables) { queue.Push(var); } this.ReduceDomains(queue, csp, result); return(result.Compactify()); }
public DomainRestoreInfo ReduceDomains(Variable var, object value, CSProblem csp) { DomainRestoreInfo result = new DomainRestoreInfo(); Domain domain = csp.GetDomain(var); if (domain.Contains(value)) { if (domain.Count() > 1) { FIFOQueue <Variable> queue = new FIFOQueue <Variable>(); queue.Push(var); result.StoreDomainFor(var, domain); csp.SetDomain(var, new Domain(new object[] { value })); this.ReduceDomains(queue, csp, result); } } else { result.SetEmptyDomainFound(true); } return(result.Compactify()); }