예제 #1
0
        private void LookForUnitRefutation(OTTERAnswerHandler ansHandler,
                IndexedClauses idxdClauses, Clause clause, ISet<Clause> sos,
                ISet<Clause> usable) 
        {

            ISet<Clause> toCheck = new HashedSet<Clause>();

            if (ansHandler.IsCheckForUnitRefutation(clause)) 
            {
                foreach (Clause s in sos) 
                {
                    if (s.IsUnitClause()) 
                    {
                        toCheck.Add(s);
                    }
                }
                foreach (Clause u in usable) 
                {
                    if (u.IsUnitClause()) 
                    {
                        toCheck.Add(u);
                    }
                }
            }

            if (toCheck.Count > 0) 
            {
                toCheck = this.Infer(clause, toCheck);
                foreach (Clause t in toCheck) 
                {
                    // * clause <- SIMPLIFY(clause)
                    var simplifiedT = ClauseSimplifier.Simplify(t);

                    // * discard clause if it is a tautology
                    if (simplifiedT.IsTautology()) 
                    {
                        continue;
                    }

                    // * if clause has no literals then a refutation has been found
                    // or if it just Contains the answer literal.
                    if (!ansHandler.IsAnswer(simplifiedT)) 
                    {
                        // * sos <- [clause | sos]
                        // This check ensure duplicate clauses are not
                        // introduced which will cause the
                        // ILightestClauseHeuristic to loop continuously
                        // on the same pair of objects.
                        if (!sos.Contains(simplifiedT) && !usable.Contains(simplifiedT))
                        {
                            idxdClauses.addClause(simplifiedT, sos, usable);
                        }
                    }

                    if (ansHandler.IsComplete())
                    {
                        break;
                    }
                }
            }
        }