Home > Net >  A job allocating proble
A job allocating proble

Time:06-22

I got n people, need to do N tasks, each task takes (x man-day), tasks have dependence, such as task A must start after task B finished. How should I arrangement it? Thank you so much!

I set up 4 rules for this question:

  1. one Task could set most num of people to do it (such as 5)
  2. there are logical dependence between tasks
  3. one Task will cost determinated man-days
  4. everyday concurrent working people can not be above current people num(n)

the rules are above, but i don't know how to calculate a minimum total time. Please tell me a method to solve it or some inspiration, thank you so much!

CodePudding user response:

Make topological sort of jobs.

Now you have sequence of events (time; job start/job end)

On start of the job assign a man, if there are free workers, otherwise wait.

On job end free a worker, assign him to the waiting job if exists.

CodePudding user response:

This problem is well-known to be NP-complete. Even the simple version with no dependencies, and only one worker per job, is NP-complete.

So you likely need to accept a reasonable heuristic. Here is one.

With a breadth-first search starting from the jobs which nothing else depends on, figure out for each job the minimum wall-clock time (max out workers on the job, and everything that depends on it, even if that is not actually possible) from starting that job to finishing.

And now you start at the top. Always assign workers to jobs by the following rules:

  1. Longest wallclock time to finish first.
  2. Break ties in favor of longest job.
  3. Break ties in favor of job with fewest max workers.

In other words you're prioritizing putting people to work on the critical path and any slow jobs.

  • Related