Academic project developed for the Operations Research course
Faculty of Applied Sciences
An interactive application for solving the classic Transportation Problem using a step-by-step approach that mirrors the manual academic workflow. The application finds the minimum-cost transportation plan between suppliers and beneficiaries, displaying every intermediate tableau and computation.
🔗 Open Transportation Problem Application
Note: All in-code comments are written in Romanian.
| Name | Group |
|---|---|
| Dedu Anișoara-Nicoleta | 1333a |
| Dumitrescu Andreea Mihaela | 1333a |
| Iliescu Daria-Gabriela | 1333a |
| Lungu Ionela-Diana | 1333a |
The algorithm follows the canonical four-step procedure taught in the Operations Research course.
Checks whether the problem is balanced (Σ Supply = Σ Demand):
| Condition | Action |
|---|---|
Σ Supply = Σ Demand |
Proceed as-is (balanced) |
Σ Supply > Σ Demand |
Introduce a dummy beneficiary B* with zero transport costs |
Σ Supply < Σ Demand |
Introduce a dummy supplier A* with zero transport costs |
The North-West Corner Method is applied to construct the first allocation table T₀. After filling, the algorithm checks for degeneracy:
V = m + n - 1 (required number of basic variables)
NC = number of filled cells in T₀
- If
NC = V→ non-degenerate solution, proceed normally. - If
NC < V→ degenerate solution, zero-value allocations (ε) are added for perturbation.
The initial transportation cost is computed as:
f₀ = Σ cᵢⱼ · Xᵢⱼ (sum over all basic cells)
At each iteration Iₖ, the algorithm applies the Modified Distribution (MODI) Method:
① Potential System — solves for uᵢ and vⱼ using the basic cells:
uᵢ + vⱼ = cᵢⱼ for all (i, j) in basis, with u₁ = 0
② Theoretical Cost Table C̃:
C̃ᵢⱼ = uᵢ + vⱼ
③ Reduced Cost Table Δ:
δᵢⱼ = cᵢⱼ − C̃ᵢⱼ
④ Optimality Check:
- If
δᵢⱼ ≥ 0for all non-basic cells → optimal solution reached (STOP). - Otherwise → identify the most negative
δᵢⱼand perform a pivot.
Pivoting procedure:
- Find the circuit (loop) through the current basis passing through the entering cell.
- Compute
θ = min{ Xᵢⱼ at (−) positions }. - Update allocations along the circuit (
+θand−θalternately). - The cell reaching zero exits the basis; the entering cell joins.
- Update cost:
fₖ₊₁ = fₖ + δ_entering · θ
Once the optimality condition is met, the application displays:
- The final allocation table with supply/demand totals.
- The minimum total transportation cost.
- A managerial interpretation listing each beneficiary's supply sources and quantities.
Optimality is confirmed when all reduced costs for non-basic cells are non-negative:
δᵢⱼ ≥ 0 for all (i, j) ∉ basis
Every row and column constraint is met:
Σⱼ Xᵢⱼ = aᵢ (supply) Σᵢ Xᵢⱼ = bⱼ (demand)
The final cost is verified against the direct summation:
f* = Σ cᵢⱼ · Xᵢⱼ (over all basic cells in the final tableau)
| Component | Technology |
|---|---|
| Core Engine | Python 3.x — NumPy (matrix operations), Pandas (table display) |
| Frontend | Streamlit — reactive interface with real-time editable cost matrix |
| Visual Design | Custom CSS — pink-themed UI with animated 🎀 falling ribbon effect on solve |
| Number Formatting | Custom fmt() utility — suppresses unnecessary decimals (e.g. 25.0 → 25) |
Step 1 — Configuration
Use the sidebar to set the number of suppliers (Aᵢ) and beneficiaries (Bⱼ), between 2 and 6 each.
Step 2 — Data Input
Fill in the unit cost matrix cᵢⱼ, the supply vector aᵢ, and the demand vector bⱼ using the integrated data editor. A default example is preloaded.
Step 3 — Solve
Click "Rezolvă Problema Pas cu Pas" to run the algorithm. Each step is displayed with full LaTeX-rendered formulas, intermediate tableaux, and highlighted basic cells.
Step 4 — Interpret Results
Read the final allocation table and the managerial transportation plan at the bottom of the page.