Ejemplo n.º 1
0
        /// <summary>
        /// Creates the action node for the FF evaluation, from the specified operator and the previous state layer.
        /// </summary>
        /// <param name="appliedOperator">Applied operator.</param>
        /// <param name="state">Previous state layer.</param>
        /// <returns>New action node.</returns>
        protected override ActionNode CreateFFActionNode(Planner.IOperator appliedOperator, Planner.IState state)
        {
            Operator oper          = (Operator)appliedOperator;
            var      preconditions = oper.GetEffectivePreconditions((IState)state);
            var      effects       = oper.GetEffectiveEffects();

            return(new ActionNode(oper, preconditions.ConvertAll(x => (IProposition) new Proposition(x)), effects.ConvertAll(x => (IProposition) new Proposition(x))));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the action node for the FF evaluation, from the specified operator and the previous state layer.
        /// </summary>
        /// <param name="appliedOperator">Applied operator.</param>
        /// <param name="state">Previous state layer.</param>
        /// <returns>New action node.</returns>
        protected override ActionNode CreateFFActionNode(Planner.IOperator appliedOperator, Planner.IState state)
        {
            Operator oper = (Operator)appliedOperator;

            List <IProposition> predecessors = new List <IProposition>();

            foreach (var assignment in oper.Preconditions)
            {
                predecessors.Add(new Proposition(assignment));
            }

            List <IProposition> successors = new List <IProposition>();

            foreach (var effect in oper.Effects)
            {
                if (effect.IsApplicable((IState)state))
                {
                    successors.Add(new Proposition(effect.GetAssignment()));
                }
            }

            return(new ActionNode(oper, predecessors, successors));
        }