I'm looking for exact algorithm which find the best solution on task schedule in N identical processors.
The time of this algorithm is not important, the most important is one best solution (miminum time of all processors when the last task will be finished).
In theory equation describing this algorithm is as follows: P||Cmax
If anyone has an algorithm (especially in Java) or pseudocode I will be grathefull for help.
I tried write my own exact algoritm but id doesn't work :(. In the code below the permUtil is a class which corresponds for permutations.
Method args:
- tasks --> all task where index identity the task and value time
- op --> assignment processor (processor which assign a tasks)
// we have a global array op processors proc where index is identity and value is task schedule time on this processor
public void schedule(Byte[] tasks, int op)
{
PermUtil<Byte> permA = new PermUtil<Byte>(tasks);
Byte[] a;
// permutation of all tasks
while ((a = permA.next()) != null)
{
// assign tasks
for(int i=1; i< a.length; i++)
{
// get the b set from i to end
Byte[] b = Arrays.copyOfRange(a, i, a.length);
// all permutations off b set
PermUtil<Byte> permB = new PermUtil<Byte>(b);
while ((b = permB.next()) != null)
{
// task on assign processor
proc[op] = sum(Arrays.copyOfRange(a, 0, i));
if (op < proc.length)
schedule(b, ++op);
else
{
proc[++op] = sum(b);
}
}
}
}
}