public static SinglePlan[] GetSinglePlans(WorldState goalState) // FIXME: Duplication with other methods. { LinkedList <Move>[] allroutes = new LinkedList <Move> [goalState.allAgentsState.Length]; for (int i = 0; i < allroutes.Length; i++) { allroutes[i] = new LinkedList <Move>(); } WorldState currentNode = goalState; while (currentNode != null) { for (int i = 0; i < allroutes.Length; i++) { allroutes[i].AddFirst(currentNode.GetSingleAgentMove(i)); } currentNode = currentNode.prevStep; } SinglePlan[] ans = new SinglePlan[goalState.allAgentsState.Length]; for (int i = 0; i < ans.Length; i++) { ans[i] = new SinglePlan(allroutes[i], goalState.allAgentsState[i].agent.agentNum); } return(ans); }
/// <summary> /// Not used /// </summary> /// <param name="goalState"></param> /// <param name="agentIndex"></param> public SinglePlan(WorldState goalState, int agentIndex) { this.agentNum = goalState.allAgentsState[agentIndex].agent.agentNum; WorldState currentNode = goalState; LinkedList <Move> locations = new LinkedList <Move>(); while (currentNode != null) { locations.AddFirst(currentNode.GetSingleAgentMove(agentIndex)); currentNode = currentNode.prevStep; } this.locationAtTimes = locations.ToList <Move>(); }