Skip to content

Command line script that uses the Hungarian Method to solve the taxi assignment problem

Notifications You must be signed in to change notification settings

afilabs/munkres_solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

munkres_solver

Google LMFS: Routes Preferred ComputeRouteMatrix API

Taken from:

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:

  1. cd into your project and install munkres-js by running npm install munkres-js
  2. Run node taxi_dispatch_solver.js

Please contact afian@afi.io if you have any questions or suggestions. Pull requests are welcome.

About

Command line script that uses the Hungarian Method to solve the taxi assignment problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published