1

I'm not sure if this is a producer/consumer problem but I couldn't find a better way to phrase my question.

I'm wondering if this problem (or a similar one) has already been solved. If it hasn't, is it an NP problem? Here is the description of the problem and the question I'm trying to answer

  • Assume you have 4 producers and 2 consumers.
  • Assume you already know everything the producers are going to produce (as a list of items, each items being of a different size)
  • Assume each consumer can consume any data at different speeds (e.g consumer1 will consume any item twice as fast as consumer2)

QUESTION: If I control the scheduler (meaning which consumer gets what item), How do I find out what assignment of the items will make the consumers finish the fastest (consuming all the items).

I hope that makes sense. I spent a couple of hours thinking about this and then a couple of more hours looking for possible solutions but still no luck. Hoping I can get some brainstorming/solutions from everyone. Thanks in advance!

Deguit0
  • 11
  • 2
  • Could you post something you've already tried? – Henrik Andersson Apr 24 '13 at 13:40
  • What do you mean by something I've already tried? I don't have any code if that's what you are asking about. I don't even know where to begin which is why I am wondering if there's a similar problem or a variation of an algorithm I should be using. – Deguit0 Apr 24 '13 at 13:49
  • I personally don't have much of a problem with the current question format, but ... you spent a "couple of hours thinking" and "a couple of ... hours looking for ... solutions", so I'm guessing you've got a nice list of things that won't work or will be too slow. It should help to add a few of them to the question. – Bernhard Barker Apr 24 '13 at 19:46
  • Sounds a bit similar to [the mista2013 challenge](http://allserv.kahosl.be/mista2013challenge/files/problem-description.pdf). [Here's an implementation of that.](https://github.com/triceo/mista13/) – Geoffrey De Smet Apr 26 '13 at 08:31

1 Answers1

0

I believe that this is a variant on the bin-packing problem, where instead of one bin you have two different-sized bins; you want to minimize the total number of bins used, and you want to use approximately the same quantity of each bin type. This is an NP-Hard problem.

Note that I don't think that the number of producers used is relevant here.

Zim-Zam O'Pootertoot
  • 17,888
  • 4
  • 41
  • 69
  • I see, thank you for that pointer. I thought about it as a bin-packing problem as well, but reading your response I'm rethinking it. What do you mean by minimize the total number of bins? What's the parallel? Is it the number of consumers I described in my OP? (in my problem that's fixed) Yes I want to try and use the same quantity of each bin type (meaning I'd like to have my consumers be busy) – Deguit0 Apr 24 '13 at 21:40
  • Another possibility is [job shop scheduling](http://en.wikipedia.org/wiki/Job_shop_scheduling), but this is usually for a set of heterogeneous jobs whereas your jobs are homogenous. – Zim-Zam O'Pootertoot Apr 24 '13 at 21:42
  • YES! Thank you SO much for pointing me to job shop scheduling, that's extremely similar to my problem. The only difference is that my "machines" are not identical, but process jobs at different speeds. This answers my question, thanks again! – Deguit0 Apr 24 '13 at 22:09