You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 24, 2024. It is now read-only.
The Hungarian algorithm returns a minimum cost perfect matching (every node has a degree of 1) on a complete bipartite graph (complete means any top node is connected to every bottom node) where the number of top and bottom nodes is identical (in our case this would mean equal number of drivers and passengers). In cases where the graph is imbalanced (eg. for more drivers than passengers), we can generate dummy nodes with zero cost connections to valid nodes. We can then run the Hungarian Algorithm on this augmented graph, then remove the dummy nodes and any solution edges incident to them. Hanna et al. 2016 points out the solution is a minimum cost maximal matching, since not every node is used (eg. some drivers are not assigned) but if any more edges are selected the solution would not be a matching.
My mixed-integer programming problem finds a solution to the following:
Maximize the sum of weights. Weights are determined from max_travel_time_in_graph - travel_time, meaning that maximizing the weights is equivalent to minimizing the aggregate travel time.
If a pick-up cannot be connected with a drop-off, np.nan is used in the corresponding cost matrix element, and not included in the MIP problem.
Each drop-off is assigned at most 1 pick-up.
Each pick-up is assigned at most 1 drop-off.
The last two criteria constrain the solution to be a matching (with number of elements equal or fewer than the maximum cardinality). The first criterion can be argued to be a minimum aggregate travel time maximal matching since:
If there is a free pick-up with a feasible link to a free drop-off, the link can be selected without affecting the rest of the solution. Its edge weight will simply add to the sum of weights, so including this free edge is always favourable. Therefore the algorithm will pick up free links until adding a new link will violate condition 3 or 4. Therefore the algorithm produces a maximal matching.
By definition the solution maximizes the sum of weights, equivalently minimizing the travel time.
Note that trying to minimize the sum of weights given criteria 3 and 4 will lead to a solution of zero links.
This "sketch of a proof" might have holes in it, so I should check it (or ask someone who knows graph theory) before uploading it to the wiki or adding it to the documentation. For now, I'll name the MIP matching algorithm MinWeightMaximalLinker, and write docstrings assuming the above is correct.
The text was updated successfully, but these errors were encountered:
The Hungarian algorithm returns a minimum cost perfect matching (every node has a degree of 1) on a complete bipartite graph (complete means any top node is connected to every bottom node) where the number of top and bottom nodes is identical (in our case this would mean equal number of drivers and passengers). In cases where the graph is imbalanced (eg. for more drivers than passengers), we can generate dummy nodes with zero cost connections to valid nodes. We can then run the Hungarian Algorithm on this augmented graph, then remove the dummy nodes and any solution edges incident to them. Hanna et al. 2016 points out the solution is a minimum cost maximal matching, since not every node is used (eg. some drivers are not assigned) but if any more edges are selected the solution would not be a matching.
My mixed-integer programming problem finds a solution to the following:
max_travel_time_in_graph - travel_time
, meaning that maximizing the weights is equivalent to minimizing the aggregate travel time.np.nan
is used in the corresponding cost matrix element, and not included in the MIP problem.The last two criteria constrain the solution to be a matching (with number of elements equal or fewer than the maximum cardinality). The first criterion can be argued to be a minimum aggregate travel time maximal matching since:
Note that trying to minimize the sum of weights given criteria 3 and 4 will lead to a solution of zero links.
This "sketch of a proof" might have holes in it, so I should check it (or ask someone who knows graph theory) before uploading it to the wiki or adding it to the documentation. For now, I'll name the MIP matching algorithm
MinWeightMaximalLinker
, and write docstrings assuming the above is correct.The text was updated successfully, but these errors were encountered: