Skip to content

About

Interactive Streamlit application for balanced and unbalanced assignment problems using the Hungarian algorithm, with dynamic cost matrices, optimal matching, rich visual analytics, and CSV/Excel exports.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Interactive Assignment Problem Solver — Hungarian Method

A Streamlit application for balanced and unbalanced assignment problems. Dynamically configure 1–15 jobs and 1–15 tasks, edit the cost matrix, solve the minimum-cost one-to-one matching using the Hungarian algorithm, explore interactive visualizations, and export CSV/Excel results.

Features

  • Dynamic job/task dimensions and editable labels.
  • Editable cost, time, distance, or penalty matrix.
  • Balanced and rectangular/unbalanced models.
  • Automatic zero-cost dummy rows/columns.
  • Hungarian shortest-augmenting-path solver (O(n³)).
  • Optimal assignments, unmatched jobs, and unfilled tasks.
  • Original, row-reduced, and row/column-reduced heatmaps.
  • Assignment map, selected-cost bar charts, cost-share pie chart, benchmark chart, and augmentation-stage view.
  • CSV and multi-sheet Excel exports.
  • Validation for non-numeric and non-finite values.

How unbalanced cases are handled

The matrix is padded to a square matrix of size max(number of jobs, number of tasks). If jobs exceed tasks, dummy task columns are added; if tasks exceed jobs, dummy job rows are added. Dummy costs default to zero. A job matched to a dummy task is unassigned; a task matched to a dummy job remains unfilled. Set non-zero dummy penalties in a future customized version if leaving an entity unmatched has a cost.

Mathematical model

Minimize Z = sum(i,j) c[i,j] * x[i,j], subject to each job and each task being assigned at most once, with x[i,j] binary. For balanced complete assignment, row and column constraints are equalities.

Run locally

Requires Python 3.10 or newer.

python -m venv .venv
# Activate the environment, then:
pip install -r requirements.txt
streamlit run app.py

Open the local URL printed by Streamlit (normally http://localhost:8501).

Deploy on Streamlit Community Cloud

  1. Push app.py, requirements.txt, and README.md to GitHub.
  2. Sign in to Streamlit Community Cloud and create a new app.
  3. Select your repository, branch, and app.py as the entry point.
  4. Deploy; dependencies are installed from requirements.txt.

Suggested GitHub repository description

Interactive Streamlit application for balanced and unbalanced assignment problems using the Hungarian algorithm, featuring dynamic cost matrices, optimal matching, rich visual analytics, and CSV/Excel exports.

Suggested GitHub topics

assignment-problem, hungarian-algorithm, operations-research, linear-assignment, optimization, streamlit, python, decision-science, cost-minimization, data-visualization

Project files

  • app.py — Streamlit UI, solver, charts, and exports.
  • requirements.txt — runtime dependencies.
  • README.md — project guide.

Assumptions and limitations

This is a single-objective minimization model with one-to-one matching. Costs may be finite negative, zero, or positive values. Dummy assignments have zero cost by default. Forbidden assignments, capacities, multiple assignments per job, precedence constraints, and non-assignment penalties are not currently included. The independent row/column minima are benchmarks only and may not be feasible one-to-one solutions. Verify model assumptions before operational use.

License

Add a license suitable for your intended distribution (for example, MIT).

About

Interactive Streamlit application for balanced and unbalanced assignment problems using the Hungarian algorithm, with dynamic cost matrices, optimal matching, rich visual analytics, and CSV/Excel exports.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages