/// <summary> /// Reconstructs the plan by going backwards from the goal. /// </summary> /// <param name="goalState">The goal state from which to start going backwards</param> public Plan(AgentState goalState) { AgentState currentNode = goalState; this.locationsAtTimes = new LinkedList <List <Move> >(); // TODO: Initialize list with #agents while (currentNode != null) { var l = new List <Move>(); l.Add(currentNode.GetMove()); this.locationsAtTimes.AddFirst(l); currentNode = currentNode.prev; } }
public SinglePlan(AgentState goalState) { this.agentNum = goalState.agent.agentNum; AgentState currentNode = goalState; LinkedList <Move> locations = new LinkedList <Move>(); while (currentNode != null) { locations.AddFirst(currentNode.GetMove()); currentNode = currentNode.prev; } this.locationAtTimes = locations.ToList <Move>(); }