I have a logistic app in PHP that determines auto routes for orders. For that, we have a matrix of routes and route points, where the points in the route could be in more than one route. So, we could have defined routes like this:
Route1 = ['Depo','City 1','City 3','City 4']
Route2 = ['Depo','City 1','City 2','City 3', 'City 5']
Route3 = ['Depo','City 2','City4','City 5']
The routes are fixed, the points from route are defined from the nearest to the farest point from the 'Depo' warehouse The planner selects from orders the lines that have to be delivered, and the app fires one array with points for delivery like this:
['City 1','City 3','City 4','City 2', 'City 1', 'City 3', 'City 2', 'City 5','City 1']
The question: How could I get to determine the ideal route for given array? I want the result to take into consideration the fact that an ideal route is the one with most points covered. The system could fire a result with more than one route, in this case, let's say the result could be Route 1 and Route 2
If anyone needs more details just comment Thanks!