skillfed

lapx

Linear assignment problem solvers, including single and batch solvers.

lapx v0.9.4 727.9K downloads/30d#5,214 on PyPI44
Permissive license MIT Active released

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 lapx

uv

uv add lapx

poetry

poetry add lapx

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: EducationTopic :: Education :: TestingTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: MathematicsTopic :: Software DevelopmentTopic :: Software Development :: Libraries

Tags

linear assignment problem solverjonker-volgenant algorithmlapjv lapmodoptimal matching algorithmcost matrix assignmentbatch assignment solverhungarian algorithm alternative
optimizationmatching-algorithmbatch-processing

More Software Development packages

Further reading