algorithm - minimize makespan: m machines doing n jobs in parallel (with different arrival times) -
- let n number of jobs.1 < n < 1000.
- jobs independent.
- each job arrives @ time: ai ( jobs can arrive in same time)
- we have m machines can run in parallel: 1 <= m <= 30.
- each machine can finish job in time. 1 <= tj <= 20.
the goal minimize makespan: time taken before jobs finished.
this part of exercice requires solved in 1s using 1ghz cpu. is: o(n^2) / o(n^2lgn) algorithm needed. therefore brute force cannot used.
my first approach was:
each job,sorted arrival time, select machine finishes first.
aka: max(ai,machine.ready)+tj minimal.
the problem jobs arriving @ 0,1 , machines times 3,4, example, program: choses 3 0 , 4 1 finishes @ 5 while if chose 4 0 , 3 for1,it finish @ 4.
+++
-++++
vs
++++
-+++
a second approach same starting last arriving job.
but take jobs:0 , 2 , machines 3,7:
- job 2 takes machine 3 reserves form t=0 t=5.
- then job 0 must take machine 7 leading 7 finish time
while can see it's better if use machine 3 0 3 , 3 6.
--+++
+++++++
vs
++++++
i'm learning website doesn't show correction until problem solved (you pass test cases (the input hidden)) problem guaranteed have solution have no idea how.
Comments
Post a Comment