I haven't done much algorithm writing till now. I have a specific scenario and I am wondering which approach shall I take.


Let us suppose that

  1. we have 4 guys (A,B,C,D)
  2. We want to assign them a certain task whose duration varies from 40 mins - 1 hr 15 mins.
  3. The task duration varies depending on the number of people (1-6) which he needs to serve. (i.e 40 mins for 1 person and 75mins for 6).
  4. Now we want to utilise these 4 guys(A,B,C,D) in particular time slots. let's say:

    06:30 to 11:00 & 16:00 to 22:00

I don't only want the code rather I would love to get some info about good algorithms which are best suited for this scenario following with some code.

  • All resources have equal efficiency. Efficiency is not much of our concern.
  • We can have any number of customers who are to be served. I'll try to explain this by one scenario:

    A,B,C,D are cooks(assume) who need to work during the mentioned time slots(6:30 to 11:00 & 16:00 to 22:00). Customers(as an individual or some group who are living together in a flat) can book the cooks to cook food for them. The cooking time (40 mins to 75 mins) is directly proportional to the number of people for whom it is being cooked. The customer should be able to register himself on some website and the website would allocate the resources(A,B,C,D) to the registered users accordingly.


  1. How many people are enrolling for the service
  2. Desired time slots


  1. Available cooks as per the selected time slot

Update 2:

  1. There can any number of cooks.
  2. There can any number of customers with no relation to cooks.
  3. Once a customer books any cook , its not compulsory that the cook has to serve in both(lunch & dinner) time slots. The customer can select opt for the same cook if he's(the cook) available or else the customer will be asked to select another cook who is available during that time
  • 2
    $\begingroup$ What research did you already do? Scheduling is a pretty wide field. $\endgroup$ – adrianN Sep 22 '16 at 10:24
  • $\begingroup$ @adrianN: Well, i m going through some links like: eventhelix.com/RealtimeMantra/Patterns/… and thought Future Resource Booking might be the kinda scenario I want but can't find documentation on google $\endgroup$ – Samuel Sep 22 '16 at 11:32
  • 1
    $\begingroup$ I don't see the difficulty here. Since there are no dependencies between tasks or different costs or rewards, just serve people in any order. There certainly is no scheduling problem here; it's more of an assignment problem. What are you currently doing? Why is that not sufficient? $\endgroup$ – Raphael Sep 22 '16 at 12:39
  • $\begingroup$ @Raphael: Well, for it to be assignment problem , it has to be kinda square matrix. right? The customer and cook number can be anything here. and I want to assign cooks depending on their availability time. Let me update the question in more details $\endgroup$ – Samuel Sep 22 '16 at 14:03
  • $\begingroup$ @Raphael: Shoot me some suggestions and I'll dig deep into it. $\endgroup$ – Samuel Sep 22 '16 at 14:10

This looks like an instance of the assignment problem. (No, it doesn't require a square matrix.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.