basically, I'm trying to implement an algorithm that dispatches drivers to deliver batches (a batch is a collection of orders). The algorithm takes all the batches and all the drivers available, then dispatches a driver that fits the batch the most. Now, what makes a driver the best to take a batch? This depends on the following: The distance the driver is to the batch and the amount of items the driver can carry (A driver can be on a bicycle, some will be on a motorbike, some in a car and others in a van). For example, let's say a batch is waiting at location x, driver 1(on a motorbike) is 1 mile away from location x and driver 2 (in a car) is 3 miles away from location x. The algorithm gives driver 1 the batch because he/she is closer to the batch. Now if the batch has a bunch of items/orders, let's say 20 items. It'll give driver 2 because he/she has a car that should be able to contain the batch. I have a method/function that takes the positions(latitude and longitude) of both the driver and order and returns the distance between them. I also have a method/function that manages the order capacity of a driver.
I'm curious as to how to do the matching (preferably an algorithm), is there a widely accepted solution that does something like this in a scalable manner?
PS: If you're curious as to how I currently do this, I basically show all the drivers the same list of batches, they can take a peek on what each batch contains and accepts which ones they'll work on.