Exemplo n.º 1
0
        /// <summary>
        /// Visits and handles the effect.
        /// </summary>
        /// <param name="effect">Effect.</param>
        public void Visit(NumericAssignEffect effect)
        {
            IAtom  groundedFunctionAtom = GroundingManager.GroundAtomDeep(effect.FunctionAtom, Substitution, State);
            double value = NumericEvaluator.Value.Evaluate(effect.Value, Substitution, State);

            effect.ApplyAssignOperation(State, groundedFunctionAtom, value);
        }
        /// <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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Visits and handles the effect.
        /// </summary>
        /// <param name="effect">Effect.</param>
        public void Visit(ObjectAssignEffect effect)
        {
            IAtom        groundedFunctionAtom = GroundingManager.GroundAtomDeep(effect.FunctionAtom, Substitution, State);
            ITerm        value             = GroundingManager.GroundTermDeep(effect.Value, Substitution, State);
            ConstantTerm constantTermValue = (ConstantTerm)value;

            State.AssignObjectFunction(groundedFunctionAtom, constantTermValue.NameId);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Visits and handles the effect.
        /// </summary>
        /// <param name="effect">Effect.</param>
        public void Visit(NotEffect effect)
        {
            if (EffectsApplierMode == EffectsApplierMode.DELETE_RELAXATION)
            {
                return;
            }

            PredicateEffect argumentEffect = effect.Argument as PredicateEffect;

            if (argumentEffect != null)
            {
                IAtom groundedPredicateAtom = GroundingManager.GroundAtomDeep(argumentEffect.PredicateAtom, Substitution, State);
                State.RemovePredicate(groundedPredicateAtom);
            }
        }
        /// <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);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Visits and handles the effect.
        /// </summary>
        /// <param name="effect">Effect.</param>
        public void Visit(PredicateEffect effect)
        {
            IAtom groundedPredicateAtom = GroundingManager.GroundAtomDeep(effect.PredicateAtom, Substitution, State);

            State.AddPredicate(groundedPredicateAtom);
        }
Exemplo n.º 7
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));
        }