コード例 #1
0
        /// <summary>
        /// Evaluates the expression.
        /// </summary>
        /// <param name="expression">Expression.</param>
        /// <returns>True if the expression is logically true, false otherwise.</returns>
        public virtual bool Visit(PredicateLiteralCNF expression)
        {
            IAtom groundedPredicateAtom = GroundingManager.GroundAtomDeep(expression.PredicateAtom, Substitution, ReferenceState);
            bool  evaluationResult      = (RigidRelations.Contains(groundedPredicateAtom) || ReferenceState.HasPredicate(groundedPredicateAtom));

            return(!expression.IsNegated == evaluationResult);
        }
コード例 #2
0
 /// <summary>
 /// Visits and evaluates predicate expression.
 /// </summary>
 /// <param name="expression">Predicate expression.</param>
 /// <returns>True if the specified expression evaluates as true, false otherwise.</returns>
 public bool Visit(PredicateExpression expression)
 {
     // if the predicate is a rigid relation, then check whether it has the correct value
     if (RigidRelations.IsPredicateRigidRelation(expression.PredicateAtom))
     {
         IAtom predicateAtom = GroundingManager.GroundAtom(expression.PredicateAtom, Substitution);
         return(RigidRelations.Contains(predicateAtom));
     }
     return(true);
 }
コード例 #3
0
        /// <summary>
        /// Evaluates the expression.
        /// </summary>
        /// <param name="expression">Expression.</param>
        /// <returns>True if the expression is logically true, false otherwise.</returns>
        public override bool Visit(PredicateLiteralCNF expression)
        {
            IAtom groundedPredicateAtom = GroundingManager.GroundAtomDeep(expression.PredicateAtom, Substitution, ReferenceState);

            if (RigidRelations.Contains(groundedPredicateAtom))
            {
                // satisfied or failed by rigid relation
                return(!expression.IsNegated);
            }

            bool hasPredicate = ReferenceState.HasPredicate(groundedPredicateAtom);

            if (hasPredicate == expression.IsNegated)
            {
                // failed by state predicate
                return(false);
            }

            // satisfied by state predicate -> store this atom
            Atoms.Add(groundedPredicateAtom);
            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Visits and evaluates predicate expression.
        /// </summary>
        /// <param name="expression">Predicate expression.</param>
        /// <returns>True if the specified expression evaluates as true, false otherwise.</returns>
        public bool Visit(PredicateExpression expression)
        {
            IAtom groundedPredicateAtom = GroundingManager.GroundAtomDeep(expression.PredicateAtom, Substitution, ReferenceState);

            return(RigidRelations.Contains(groundedPredicateAtom) || ReferenceState.HasPredicate(groundedPredicateAtom));
        }