lapx
Linear assignment problem solvers, including single and batch solvers.
What it is and what it does
lapx is a linear assignment problem solver package that evolved from maintaining an earlier lap package. It implements Jonker-Volgenant algorithms optimized for both dense (LAPJV) and sparse (LAPMOD) cost matrices, solving the problem of finding optimal one-to-one assignments between two sets of items to minimize total cost. The package supports square and rectangular matrices, single-problem and batch processing, and offers multiple output formats to match different downstream use cases.
The core solver functions are based on academic papers and public-domain implementations. lapx provides lapjv, lapmod, lapjvx (SciPy-style output), lapjvxa (direct assignment array output), lapjvc (optimized for square matrices), lapjvs and lapjvsa (sparse variants), and batch versions of each. It depends only on numpy and is available as pre-built wheels for Python 3.7 through 3.14 across macOS, Linux, Windows, and ARM architectures, with optional performance tuning via environment variables during source builds.
Use it for:
- Object tracking: match detected objects across video frames by minimizing distance or appearance cost.
- Bipartite graph matching: find optimal pairings between two sets of nodes in applications like job scheduling or resource allocation.
- Data association: assign sensor measurements to tracked targets in multi-object tracking systems.
- Batch processing: solve multiple assignment problems in parallel using batch solver functions.
- Rectangular assignment: handle cases where the number of rows and columns differ, extending costs as needed.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Solves linear assignment problems using Jonker-Volgenant and related algorithms, supporting single and batch operations on square and rectangular cost matrices.
Yes. lapx is actively maintained, has no known vulnerabilities, and offers a stable, performant implementation of linear assignment solvers with multiple output formats and batch support. Install it if you need to solve assignment problems and want more flexibility or batch processing capabilities. The requirement not to install both lap and lapx simultaneously is a minor gotcha but well-documented.
Install
lapx on PyPI
pip
pip install lapxuv
uv add lapxpoetry
poetry add lapxInstalling lapx
Before you install
Medium install friction due to compiled wheels; pre-built binaries cover Python 3.10–3.14 and major platforms (macOS, Linux, Windows, ARM), reducing build overhead. Active maintenance with recent releases and no reported vulnerabilities.
License in practice
MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal attribution requirements.
Quickstart
pip install lapx
import numpy as np
import lapx
cost_matrix = np.random.rand(100, 150)
total_cost, row_indices, col_indices = lapx.lapjvx(cost_matrix, extend_cost=True, return_cost=True)
assignments = np.column_stack((row_indices, col_indices))
Requires numpy; import name is lapx; do not install both lap and lapx simultaneously as they provide the same import namespace.
Verify before relying
- Performance comparison to scipy.optimize.linear_sum_assignment and other LAP solvers under typical workloads.
- Numerical stability guarantees or known edge cases (e.g., degenerate cost matrices, very large or very small values).
- Memory usage characteristics for batch operations on large matrices.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 219 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 727,850/month — #5,214 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lapx-0.9.4-cp310-cp310-macosx_10_9_x86_64.whl; lapx-0.9.4-cp310-cp310-macosx_11_0_arm64.whl; lapx-0.9.4-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; lapx-0.9.4-cp310-cp310-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl; lapx-0.9.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; lapx-0.9.4-cp310-cp310-musllinux_1_2_aarch64.whl; lapx-0.9.4-cp310-cp310-musllinux_1_2_armv7l.whl; lapx-0.9.4-cp310-cp310-musllinux_1_2_x86_64.whl; lapx-0.9.4-cp310-cp310-win_amd64.whl; lapx-0.9.4-cp310-cp310-win_arm64.whl; lapx-0.9.4-cp311-cp311-macosx_10_9_x86_64.whl; lapx-0.9.4-cp311-cp311-macosx_11_0_arm64.whl; lapx-0.9.4-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; lapx-0.9.4-cp311-cp311-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl; lapx-0.9.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; lapx-0.9.4-cp311-cp311-musllinux_1_2_aarch64.whl; lapx-0.9.4-cp311-cp311-musllinux_1_2_armv7l.whl; lapx-0.9.4-cp311-cp311-musllinux_1_2_x86_64.whl; lapx-0.9.4-cp311-cp311-win_amd64.whl; lapx-0.9.4-cp311-cp311-win_arm64.whl
Keywords: Linear Assignment Problem Solver, LAP solver, Jonker-Volgenant Algorithm, LAPJV, LAPMOD, lap, lapx, lapjvx, lapjvxa, lapjvc, lapjvs, lapjvsa, lapjvx_batch, lapjvxa_batch, lapjvs_batch, lapjvsa_batch
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
lapSolves the linear assignment problem using the…
permissive · top 5,000 on PyPI
munkresImplements the Munkres algorithm (Hungarian…
permissive · top 15,000 on PyPI
nvidia-cusolverProvides CUDA solver native runtime libraries…
unclear · top 1,000 on PyPI
qpsolversProvides a unified Python interface to solve…
copyleft · top 5,000 on PyPI
ortoolsOR-Tools provides constraint programming,…
permissive · top 5,000 on PyPI
PuLPPuLP is a linear and mixed-integer programming…
permissive · top 5,000 on PyPI
nvidia-cusolver-cu12Provides CUDA solver native runtime libraries…
unclear · top 1,000 on PyPI
linear-operatorLinearOperator abstracts structured matrix…
permissive · top 5,000 on PyPI
MosekMOSEK solves large-scale convex and…
unclear · top 15,000 on PyPI
lineaxLineax solves linear systems and least-squares…
permissive · top 15,000 on PyPI