Beispiel #1
0
        public IInferenceLog <Var, Val> Apply(CSP <Var, Val> csp, Assignment <Var, Val> assignment, Var var)
        {
            var log = new DomainLog <Var, Val>();

            foreach (var constraint in csp.GetConstraints(var))
            {
                Var neighbor = csp.GetNeighbor(var, constraint);
                if (neighbor != null && !assignment.Contains(neighbor))
                {
                    if (Revise(neighbor, constraint, assignment, csp, log))
                    {
                        if (!csp.GetDomain(neighbor).Any())
                        {
                            log.SetEmptyDomainFound(true);
                            return(log);
                        }
                    }
                }
            }
            return(log);
        }