Looking at the links published by Lawrence, I thought I would try to whip something. The algorithm should assign the longest test to the shortest list of tasks (repeat until all tests are assigned). Using your examples and random test times, the std deviation was pretty low, less than 2 minutes when you ran it several times (C # code, but nothing that would not be trivial to convert):
private static void BuildJobs()
{
PriorityQueue<Task> tasks = new PriorityQueue<Task>();
for (int i = 0; i < 60; i++)
{
Task t = new Task();
tasks.Enqueue(t);
}
int[] testList = new int[2000];
for (int i = 0; i < testList.Length; i++)
{
testList[i] = random.Next(5, 90);
}
Array.Sort<int>(testList);
Array.Reverse(testList);
foreach (int time in testList)
{
Task t = tasks.Dequeue();
t.addTest(time);
tasks.Enqueue(t);
}
Debug.WriteLine(CalculateStdDev(tasks));
}
source
share