|
3 | 3 | Linear Assignmment Problem solver using Jonker-Volgenant algorithm
|
4 | 4 | ==================================================================
|
5 | 5 |
|
6 |
| -This project is the rewrite of [pyLAPJV](https://github.com/hrldcpr/pyLAPJV) for |
7 |
| -Python 3 and updated core code. |
| 6 | +This project is the rewrite of [pyLAPJV](https://github.com/hrldcpr/pyLAPJV) which |
| 7 | +supports Python 3 and updated core code. It is a native Python 3 module and does |
| 8 | +not work with Python 2.x, use pyLAPJV if you are stuck in the previous decade. |
| 9 | + |
| 10 | +[Linear assignment problem](https://en.wikipedia.org/wiki/Assignment_problem) |
| 11 | +is the bijection between two sets with equal cardinality which optimizes the sum |
| 12 | +of the individual mapping costs taken from the fixed cost matrix. It naturally |
| 13 | +arises e.g. when we want to fit [t-SNE](https://lvdmaaten.github.io/tsne/) results |
| 14 | +into a rectangular regular grid. |
| 15 | +See this awesome notebook for the details why LAP matters: |
| 16 | +[CloudToGrid](https://github.com/kylemcdonald/CloudToGrid/blob/master/CloudToGrid.ipynb). |
| 17 | + |
| 18 | +Jonker-Volgenant algorithm is described in the paper: |
| 19 | + |
| 20 | +R. Jonker and A. Volgenant, "A Shortest Augmenting Path Algorithm for Dense and Sparse Linear Assignment Problems," _Computing_, vol. 38, pp. 325-340, 1987. |
| 21 | + |
| 22 | +It is faster in practice than the [Hungarian algorithm](https://en.wikipedia.org/wiki/Hungarian_algorithm), |
| 23 | +though it is not clear how complexities differ. The mentioned article is not publicly |
| 24 | +available, and spending money just to figure this out seems to be an overkill. |
| 25 | + |
| 26 | +The C++ source of the algorithm comes from http://www.magiclogic.com/assignment.html |
| 27 | +It has been reworked and partially optimized with OpenMP 4.0 SIMD. |
| 28 | + |
| 29 | +Installing |
| 30 | +---------- |
| 31 | +``` |
| 32 | +pip3 install lapjv |
| 33 | +``` |
| 34 | + |
| 35 | +Usage |
| 36 | +----- |
| 37 | +Refer to [test.py](test.py) for the complete code. |
| 38 | + |
| 39 | +``` |
| 40 | +from lapjv import lapjv |
| 41 | +row_ind, col_ind, _ = lapjv(cost_matrix) |
| 42 | +``` |
| 43 | + |
| 44 | +License |
| 45 | +------- |
| 46 | +MIT. |
0 commit comments