private void planForAgent(Agent agent)
	{
		TaskDispenser td = agent.td;
		Node node = agent.node;
		
		// Remove completed task from queue
		
		if (agent.request != null) {
			if (agent.request.requestBox.atField == agent.request.requestGoal) {
				agent.request = null;
//				System.err.println("Completed request");
			}
		}

		if (agent.taskQueue != null &&
			agent.taskQueue.size() > 0 && 
			(agent.taskQueue.peek().commandQueue == null ||
			agent.taskQueue.peek().commandQueue.size() == 0))
		{
			if (agent.taskQueue.peek() instanceof DockTask) {
				DockTask t = (DockTask) agent.taskQueue.peek();
				t.box.reserved = false;
				t.moveBoxTo.reserved = false;
			}
			 
			agent.taskQueue.poll();
			
		}
		
		// If agent has no tasks, try to find a task
		if (agent.taskQueue.size() == 0 )
		{
//			System.err.println("agentId " + agent.getId());
			
			agent.taskQueue.clear();
			
			if(agent.td.agents.size() == 1){
				agent.taskQueue.addAll(td.newDispenseTaskForAgent(agent));
			}
			else{
				agent.taskQueue.addAll(td.simpleDispenseTaskForAgent(agent));
			}

				
		}
	}