Consider an Organization which provides technicians for different types of jobs.

Each job type varies in completion time and technician count. For e.g., Job type 1 requires 2 technicians and 1 hour to complete and job type 2 requires 1 technician and 30 minutes to complete. All technicians are available all the time (Organization working time is 09:00-18:00) unless they are assigned any jobs.

A customer can request the service online and an available time slot should be displayed based on the selected job type.

There are no other constraints like minimum shift or maximum shift per technician, and also assume that all technicians are equally skilled.

What is the best possible way to generate the time slot?

  • Do you also need to consider the time needed by the technician to travel from 1 customer to the next? Is the time slot given to the customer the start and end time of the job or is it a larger time frame during which the job should start and end?
    – Renaud M.
    Sep 16, 2015 at 7:18
  • Right now I'm not considering travel time, and yes, the larger time frame should be displayed.
    – frosty
    Sep 16, 2015 at 7:26
  • Are there any limitations for the completion times of jobs and available time slots? Are there jobs that require days to complete? Should it be possible to begin a two hour job at 17:00 and finish it next day at 10:00?
    Sep 16, 2015 at 7:47
  • Time slots should be within the Organization working hours. Some jobs may require more than a day to complete. It is also possible to begin a two hour job at 17:00 and finish it next day at 10:00.
    – frosty
    Sep 16, 2015 at 8:54

1 Answer 1


As usual, there is no silver bullet that can be declared as the best way.

That being said, I suggest you take a look at constraint-based scheduling. These types of scheduling problems are very common and constraint programming has had tremendous success in solving and more importantly describing them.

With a CP solver you can specify the constraints similar to what you have already described in your post (of course there's some syntax to adhere too) and the solver does the hard work of calculating the best time slots.

Depending on your constraints and your fitness function (i.e. you may want to tell the solver why one solution is better than another) this can get more and more complicated. CP is sometimes considered as a programming paradigm, so it does have a lot of breadth and depth you can get lost in. But starting with any of the available solvers and playing around with it to check if this might be worthwhile in your case certainly is possible in a limited scope. If the problem is not too involved, I found that most people get a hang of how to encode it and let it be solved rather quickly.

The good and most important imho thing with a CP solution is that you have a direct representation of your constraints which a) helps for communication and b) makes changes much easier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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