Beispiel #1
0
        private bool Revise(Var var, IConstraint <Var, Val> constraint, Assignment <Var, Val> assignment,
                            CSP <Var, Val> csp, DomainLog <Var, Val> log)
        {
            bool revised = false;

            foreach (var value in csp.GetDomain(var))
            {
                assignment.Add(var, value);
                if (!constraint.IsSatisfiedWith(assignment))
                {
                    log.StoreDomainFor(var, csp.GetDomain(var));
                    csp.RemoveValueFromDomain(var, value);
                    revised = true;
                }
                assignment.Remove(var);
            }

            return(revised);
        }