Skip to content

Commit 86c4c5e

Browse files
committedJan 9, 2017
Add Travis files
1 parent ab2b2ad commit 86c4c5e

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed
 

‎.travis.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: python
2+
sudo: false
3+
addons:
4+
apt:
5+
sources:
6+
- ubuntu-toolchain-r-test
7+
packages:
8+
- gcc-5
9+
- g++-5
10+
cache:
11+
directories:
12+
- $HOME/.cache/pip
13+
python:
14+
- "3.4"
15+
- "3.5"
16+
- "3.6"
17+
install:
18+
- pip install --upgrade pip
19+
- pip install numpy scipy
20+
- CC=gcc-5 CXX=g++-5 pip install -e .
21+
script:
22+
- python3 -m unittest discover .
23+
notifications:
24+
email: false

‎README.md

+41-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,44 @@
33
Linear Assignmment Problem solver using Jonker-Volgenant algorithm
44
==================================================================
55

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.

‎setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from setuptools import setup, Extension
2+
import numpy
23

34
setup(
45
name="lapjv",
@@ -13,6 +14,7 @@
1314
ext_modules=[Extension("lapjv", sources=["python.cc"], extra_compile_args=[
1415
"-fopenmp", "-std=c++11", "-march=native", "-ftree-vectorize"])],
1516
install_requires=["numpy"],
17+
include_dirs = [numpy.get_include()],
1618
classifiers=[
1719
"Development Status :: 4 - Beta",
1820
"Intended Audience :: Developers",

0 commit comments

Comments
 (0)
Please sign in to comment.