Exemple #1
0
        /// <summary>
        /// Applies the specified operator to the specified search node.
        /// </summary>
        /// <param name="node">Search node.</param>
        /// <param name="oper">Operator to be applied.</param>
        /// <returns>New search node.</returns>
        protected ISearchNode Apply(ISearchNode node, IOperator oper)
        {
            switch (SearchType)
            {
            case SearchType.Forward:
                return(oper.Apply((IState)node));

            case SearchType.BackwardWithConditions:
                return(oper.ApplyBackwards((IConditions)node));

            case SearchType.BackwardWithStates:
                return(oper.ApplyBackwards((IRelativeState)node).First());

            default:
                throw new NotSupportedException("Unknown search type!");
            }
        }
 /// <summary>
 /// Checks whether the potential predecessor given by the backwards application of the specified operator to the specified conditions
 /// is compatible with the mutex constraints of the SAS+ planning problem.
 /// </summary>
 /// <param name="conditions">Reference conditions.</param>
 /// <param name="oper">Operator to be checked.</param>
 /// <returns>True, if the operator is backwards-applicable with regards to defined mutex groups, false otherwise.</returns>
 public bool CheckPredecessorCompatibility(IConditions conditions, IOperator oper)
 {
     // actually quite efficient solution because anything else would be even worse; unfortunately, backwards compatibility is very tricky
     return(CheckConditions((IConditions)oper.ApplyBackwards(conditions)));
 }