public List <AgentDecisionTask> RationaleDecision(List <AgentTasksInfo> agentTasks) { bestSet = null; List <List <Task> > allTasks = new List <List <Task> >(); //Handle currenTask, only task in iteration task? or sent appart? foreach (AgentTasksInfo a in agentTasks) { List <Task> tasks = new List <Task>(a.GetIterationTasks()); allTasks.Add(tasks); } FormSets(allTasks, 0, new List <Task>()); if (bestSet == null) { return(null); } List <AgentDecisionTask> agentsDecisions = new List <AgentDecisionTask>(); List <Task> bestTasks = bestSet.GetSet(); for (int i = 0; i < bestTasks.Count; i++) { AgentDecisionTask adt = new AgentDecisionTask(bestTasks[i], agentTasks[i].GetId()); agentsDecisions.Add(adt); } return(agentsDecisions); }
private void PrintSet(TaskSet set) { string print = "Set = ("; foreach (Task t in set.GetSet()) { print += t.GetId() + ", "; } print += ")"; Debug.Log(print); }
private void CalculateSetUtility(TaskSet set) { int cost = 0; List <Task> tasks = set.GetSet(); for (int i = 0; i < tasks.Count - 1; i++) { cost += tasks[i].GetPath().Count; for (int j = i + 1; j < tasks.Count; j++) { if (ExistsCollision(tasks[i].GetPath(), tasks[j].GetPath())) { cost += this.colisionPenalty; } if (tasks[i].GetAction().GetActionType().Equals(tasks[j].GetAction().GetActionType())) { cost += this.concurrencyPenalty; } } } set.SetCost(cost); }