/// <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); }
/// <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); }
/// <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); }
/// <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)); }