private void SetNodeActionDetails() { g = parent.g + action.Cost; state = parent.state.Clone(); state.ClearMetPreconditions(action.GetEffects()); state.AddUnmetPreconditions(action.GetPreconditions()); h = GetNumUnmetPreconditions(); }
public AINode(IAIAgent <L, V> agent, IAIGoal <L, V> goal, IAIAction <L, V> action = null, AINode <L, V> parent = null) { this.agent = agent; this.action = action; this.parent = parent; if (action == null) { // This is a goal node state = new AIState <L, V>(goal, agent.Memory.CloneState()); state.AddUnmetPreconditions(goal.GetConditions()); g = 0; } else { // This is an action node state = new AIState <L, V>(); g = float.MaxValue; } }