/// <summary>
        /// Evaluates the label of the operator with the specified preconditions and substitution.
        /// </summary>
        /// <param name="conditions">Operator conditions.</param>
        /// <param name="substitution">Variable substitution.</param>
        /// <param name="stateLabels">Atom labels in the predecessor layer.</param>
        /// <param name="evaluationStrategy">Evaluation strategy.</param>
        /// <returns>Operator label value in the relaxed planning graph.</returns>
        public double Evaluate(ConditionsCNF conditions, ISubstitution substitution, StateLabels stateLabels, ForwardCostEvaluationStrategy evaluationStrategy)
        {
            Substitution       = substitution;
            StateLabels        = stateLabels;
            EvaluationStrategy = evaluationStrategy;

            return(conditions.Accept(this).Item1);
        }
        /// <summary>
        /// Gets a list of atoms used in the specified conditions.
        /// </summary>
        /// <param name="conditions">Conditions to be evaluated.</param>
        /// <returns>Collection of used atoms.</returns>
        public HashSet <IAtom> Collect(IConditions conditions)
        {
            ConditionsCNF conditionsCNF = (ConditionsCNF)conditions.GetCNF();

            Atoms = new HashSet <IAtom>();

            conditionsCNF.Accept(this);

            return(Atoms);
        }
        /// <summary>
        /// Gets a list of atoms from the specified state that are necessary to make these conditions true.
        /// </summary>
        /// <param name="conditions">Conditions to evaluate.</param>
        /// <param name="substitution">Variable substitution.</param>
        /// <param name="predecessorState">Preceding state.</param>
        /// <returns>List of satisfying atoms.</returns>
        public List <IAtom> Evaluate(IConditions conditions, ISubstitution substitution, IState predecessorState)
        {
            ConditionsCNF conditionsCNF = (ConditionsCNF)conditions.GetCNF();

            Atoms          = new List <IAtom>();
            Substitution   = substitution;
            ReferenceState = predecessorState;

            conditionsCNF.Accept(this);

            return(Atoms);
        }
        /// <summary>
        /// Renames the parameters (and the corresponding occurences in the conditions), starting from the given free parameter ID.
        /// </summary>
        /// <param name="conditions">Conditions to be edited.</param>
        /// <param name="firstFreeParameterId">First free parameter ID.</param>
        public void Rename(ConditionsCNF conditions, int firstFreeParameterId)
        {
            // firstly, build a renaming map and rename the parameters

            ParametersRemapping.Clear();

            int currentParameterId = firstFreeParameterId;

            foreach (var parameter in conditions.Parameters)
            {
                ParametersRemapping.Add(parameter.ParameterNameId, currentParameterId);
                parameter.ParameterNameId = currentParameterId;
                ++currentParameterId;
            }

            // rename the conditions

            conditions.Accept(this);
        }
 /// <summary>
 /// Gets the number of not accomplished condition constraints for the specified state.
 /// </summary>
 /// <param name="conditions">Conditions to be evaluated.</param>
 /// <param name="referenceState">Reference state.</param>
 /// <returns>Number of not accomplished condition constraints.</returns>
 public int Evaluate(ConditionsCNF conditions, IState referenceState)
 {
     ReferenceState = referenceState;
     return(conditions.Accept(this).Item2);
 }
 /// <summary>
 /// Processes primitive effects.
 /// </summary>
 /// <param name="expression">Conditions expression in CNF.</param>
 /// <returns>Tuple of two values, where the first is true when the positive relevance condition (inclusion) is satisfied, while the second is
 /// true when the negative condition (exclusion) is not violated. False otherwise.</returns>
 private Tuple <bool, bool> ProcessPrimitiveEffects(ConditionsCNF expression)
 {
     return(expression.Accept(this));
 }
示例#7
0
 /// <summary>
 /// Processes primitive effects.
 /// </summary>
 /// <param name="expression">Conditions expression in CNF.</param>
 private ConditionsCNF ProcessPrimitiveEffects(ConditionsCNF expression)
 {
     // standard processing of simple effects via visitor pattern
     return((ConditionsCNF)expression.Accept(this));
 }