示例#1
0
    //-----------------------------------------------------------------------------------------------
    public void GeneratePlan()
    {
        if (m_htnPlanner.PlannerDomain == null)
        {
            AssignDomainToPlanner();
        }

        bool planSuccess = m_htnPlanner.CreatePlan();

        if (!planSuccess)
        {
            Debug.Log("Plan generation failed.");
        }

        m_activeStrategyPlan = m_htnPlanner.LastCreatedPlan;
    }
示例#2
0
        /// <summary>
        /// Creation of a plan for the current intention
        /// </summary>
        /// <returns>A STRIPS plan which can be executed</returns>
        protected virtual Plan <TAction> MakePlan()
        {
            var itemsToProcess = new Stack <IStackItem>();
            var complexGoal    = new ComplexGoal();

            foreach (var intent in CurrentIntentions)
            {
                complexGoal.Goals.AddRange(intent.CreateGoal().Goals);
            }

            itemsToProcess.Push(complexGoal);
            var currentBeliefs = ExtractFactsFromBeliefBase();
            var tuple          = Planner.CreatePlan <TAction>(itemsToProcess, currentBeliefs, new List <Fact>(), new List <State>(), Actions);

            return(tuple.Item1);
        }