Пример #1
0
 private void SetNodeActionDetails()
 {
     g     = parent.g + action.Cost;
     state = parent.CloneState();
     state.ClearMetPreconditions(action.GetEffects());
     state.AddUnmetPreconditions(action.GetPreconditions());
     h = GetNumUnmetPreconditions();
 }
Пример #2
0
        public AINode(AIAgent agent, AIPlanner planner, AIAction action = null, AINode parent = null)
        {
            this.agent   = agent;
            this.planner = planner;
            this.action  = action;
            this.parent  = parent;

            if (action == null)
            {
                // This is a goal node
                state = new AIState(planner.GetGoal(), agent.GetMemory().CloneState());
                state.AddUnmetPreconditions(planner.GetGoal().GetConditions());
                g = 0;
            }
            else
            {
                // Initialise Action node
                state = new AIState();
                g     = float.MaxValue;
            }
        }