Taken from:
- Google Mobility: An introduction to Google ODRD, LMFS and Cloud Fleet Routing APIs (part 1 of 5)
- Google ODRD: Routes Preferred ComputeRoutes API (part 2 of 5)
- Google LMFS: Routes Preferred ComputeRouteMatrix API (part 3 of 5)
- Google Cloud Fleet Routing: OptimizeTours API (part 4 of 5)
- Google ODRD: Navigation SDK (coming soon)
In the context of taxi dispatch, the assignment problem aims to pair available taxis (referred to as agents) with an equal number of customers (referred to as tasks) who want to be picked up promptly. This project guides you through the process of solving this problem using the munkres-js library. The solution relies on a cost matrix provided by the Google Maps Routes Preferred ComputeRouteMatrix API.
const pairings = [
["blue - c1", "blue - c2", "blue - c3"],
["purple - c1", "purple - c2", "purple - c3"],
["green - c1", "green - c2", "green - c3"]
];
const costMatrix = [
[843, 1933, 623],
[1150, 2288, 572],
[699, 982, 1363]
];
const result = munkres(costMatrix);
How to run the app:
- cd into your project and install
munkres-js
by runningnpm install munkres-js
- Run
node taxi_dispatch_solver.js
Please contact afian@afi.io if you have any questions or suggestions. Pull requests are welcome.