0

I'm honestly not sure where / what to post this as, but I will be very grateful to anyone for any advice that you may be able to provide.

I am looking to create an algorithm which will calculate the most optimal schedule for a taxi (long-distance private hire) company, with multiple drivers and multiple bookings.

On any one day, there may be up to around 5-10 jobs, each taking varying amounts of times with varying amounts of miles.

I can obtain the coordinates, and distance between all locations through the Google Distance API.

I want to calculate the optimal schedule whereby driver mileage/time is minimised in order to complete ALL jobs as effectively as possible. The job times and locations are fixed, however the driver can be any from a pool of up to 10. Each driver does not necessarily have to complete a job each day. Some drivers may complete multiple jobs in one day, as long as they do not overlap.


For Example:

Driver A goes from Point A to Point B.

There is another job from Point B later in the day, so Driver A should naturally be assigned to this job, as Driver A can wait at Point B until the next job's start time, rather than wasting fuel for another driver to go to Point B with an empty car.


I have tried to be concise, apologies for the length. I don't expect a full answer but if anyone's attempted similar, some tips would be appreciated!

Scott
  • 86
  • 1
  • 12

1 Answers1

1

I will try to help you with with some scheduling pseudo-code. Let's try!

First of all, you need a scheduling structure with N queues and M slots per queue. You must have a schedule for each day, a queue for each possible driver and a variable number of slots.

In my view, I would break the day into 15 minute slots. With this structure in mind, the scheduling algorithm will be a interactive process where each new interaction will try to allocate a new route.

The first step will be to order all the pending routes finding the nearest start point for each of the ending points in the routes. With this big stream of ordered routes the next step is to move these routes in order to the first available driver until all of his slots for the day are filled. You keep doing the same split for the next drivers until there is no more deliveries to be scheduled.

It is possible to deal with this kind of problem without all the notion of "slots" but I think that it is a safe measure to avoid making a impossibly super tight schedule. This proposed algorithm also doesn't deal with the time need to go from and back to the starting point (where the truck is loaded). I think you can have a fair but non-optimized solution by doing a second pass over all the schedules and adding the needed routes from and back to the load point. By doing so you will need to move some of the drivers' last route to another driver so that the "back to home" route can be fit.

Good luck with you job. Hope that it helped!

rodrigovr
  • 454
  • 2
  • 7