Fast Approximate Quadratic Assignment Problem Solver
This is a Python implementation of an algorithm for approximately solving quadratic assignment problems described in
Joshua T. Vogelstein and John M. Conroy and Vince Lyzinski and Louis J. Podrazik and Steven G. Kratzer and Eric T. Harley and Donniell E. Fishkind and R. Jacob Vogelstein and Carey E. Priebe (2012) Fast Approximate Quadratic Programming for Large (Brain) Graph Matching. arXiv:1112.5507.
It solves
min𝑃∈𝒫<𝐹, 𝑃𝐷𝑃𝖳>
where 𝐷, 𝐹 ∈ ℝ𝑛×𝑛, 𝒫 is the set of 𝑛×𝑛 permutation matrices and <., .> denotes the Frobenius inner product.
The implementation employs the Frank–Wolfe algorithm.
Example
import numpy as np
from faqap import minimize
# Make runs deterministic, descent origins are chosen randomly by default.
np.random.seed(123456789)
D = np.array(
[
[0, 0, 0, -4],
[0, 0, -3, 0],
[0, -2, 0, 0],
[-1, 0, 0, 0]
],
dtype=np.float64
)
F = np.array(
[
[0, 0, 0, +1],
[0, 0, +2, 0],
[0, +3, 0, 0],
[+4, 0, 0, 0]
],
dtype=np.float64
)
solution_permutation = minimize(D=D, F=F, descents_count=1).x
# Expected is the permutation reversing elements.
print("solution permutation =", solution_permutation)
Output
solution permutation = [3 2 1 0]
Install
pip install faqap
Dependencies
- Python (>=3.5)
- NumPy (>=1.10)
- SciPy (>=1.4)
Metadata
Release files for faqap 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| faqap-0.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Release files / faqap-0.2.0-py2.py3-none-any.whl
| Download URL | faqap-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
12a8e954be2f99cefdff28b3d854b3e5dc6535d81b388a128d5f510f30ab817f
|
|
BLAKE2b-256 checksum How to use checksums |
d1f340c2f91ee3142734f3346f7a0363ad8bb0f94f48880330e86f6ffbc80716
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.6
|