예제 #1
0
        /// <summary>
        /// foamliu, 2009/01/21, 建立 PreCondition 边.
        ///
        /// 例如:
        /// Move ( b1, b2, b3 )
        /// PreCondition 是:
        ///     ON (b1, b2) & Clear (b1) & Clear (b3)
        /// </summary>
        /// <param name="theAct"></param>
        private void CreatePreEdges(Action theAct)
        {
            Conjunction pre = theAct.PreCondition;

            foreach (string s in pre.Literals)
            {
                Proposition theProp = m_prev.GetProposition(s);
                theProp.AddPreEdge(theAct);
                theAct.AddPreProp(theProp);
            }
        }
예제 #2
0
        /// <summary>
        /// foamliu, 2009/01/21, 添加 No-op actions.
        /// </summary>
        private void AddNoops()
        {
            Conjunction conj = m_prev.Conjunction;

            foreach (string s in conj.Literals)
            {
                // 创建 No-op action.
                Action theAct = new Action("NOOP: " + s);
                theAct.PreCondition.Literals.Add(s);
                theAct.AddEffects.Literals.Add(s);
                this.m_actions.Add(theAct);
                // 把这个 no-op 加入当前行为层.
                Proposition theProp = m_prev.GetProposition(s);
                theProp.AddPreEdge(theAct);
                theAct.AddPreProp(theProp);
                // 把这个命题加入下个命题层.
                theProp = m_next.AddProposition(s);
                theProp.AddAddEdge(theAct);
                theAct.AddAddProp(theProp);
            }
        }