Beispiel #1
0
    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);
    }