Ejemplo n.º 1
0
    private void FormSets(List <List <Task> > allTasks, int index, List <Task> currentSet)
    {
        foreach (Task t in allTasks[index])
        {
            List <Task> cloneSet = new List <Task>(currentSet);
            cloneSet.Add(t);

            if (index < allTasks.Count - 1)
            {
                index++;
                FormSets(allTasks, index, cloneSet);
                index--;
            }
            else
            {
                TaskSet set = new TaskSet(cloneSet);
                CalculateSetUtility(set);
                if (this.bestSet == null)
                {
                    bestSet = set;
                }
                else
                {
                    if (set.GetCost() < bestSet.GetCost())
                    {
                        bestSet = set;
                    }
                }
            }
        }
    }