This repository contains the complete implementation for the submitted manuscript: "Compressed Traffic Assignment with Augmented Lagrangian Method".
This work proposes a compressed representation of the path-flow space using low-rank Singular Value Decomposition (SVD), effectively projecting the high-dimensional path-flow variables onto a compact subspace. It separates paths into major paths (retained explicitly) and minor paths (captured implicitly via the low-rank basis), drastically reducing the number of decision variables.
The resulting compressed problem is solved using an Augmented Lagrangian Method (ALM), which handles OD flow conservation constraints and non-negativity of compressed path flows as soft penalties. The dual multipliers are updated iteratively in an outer loop, while each inner subproblem is solved efficiently with L-BFGS-B — a quasi-Newton method well-suited for large-scale bound-constrained optimization.
where
Given that
This gives the fully expanded gradients:
Expanding
Therefore
| Math expression | Python code |
|---|---|
v = v0 + B1.T @ y + D @ z |
|
u = U_r @ z |
|
od_error = A1 @ y + M @ z - d_multi |
|
max_term_minor = np.maximum(0, mu - c2 * u) |
|
grad_v = bpr_gradient(v, capacity, t_0, alpha, beta) |
|
grad_y = B1 @ grad_v + A1.T @ (lambda_od + c1 * od_error) |
|
grad_z = D.T @ grad_v + M.T @ (lambda_od + c1 * od_error) - U_r.T @ max_term_minor |
The implementation is fully consistent with the paper. Besides, the code also includes three other gradient implementations for testing and benchmarking purposes. Please refer to E. Gradients Computation and Overhead for complexity analysis and performance comparison.
objective_and_gradient_chain_ruleobjective_and_gradient_factoredobjective_and_gradient_mixed
Place GMNS-format input files under data/<network>/:
| File | Contents |
|---|---|
link.csv |
Link attributes: capacity, length, free speed, reference link flow |
node.csv |
Node coordinates and associated zones |
demand.csv |
OD demand matrix (optional; inferred from path flows (columns.csv) if absent) |
columns.csv |
Route assignment generated from the reference user-equilibrium solver (OpenDTA) |
Two sample networks are included at data/, namely two_corridor and chicago_sketch. More networks will be added in the future.
Key runtime parameters are configured in config.json.
| Parameter | Default | Description |
|---|---|---|
data_dir |
"two_corridor" |
Network folder under data/
|
rank |
50 |
SVD rank |
random_state |
42 |
Global random seed used by randomized SVD and ALM cold-start noise |
tolerance |
1e-4 |
ALM convergence tolerance |
threshold_index |
0 |
Index into thresholds returned by setup_thresholds
|
demand_file |
null |
Optional demand file path; auto-detected if omitted |
link_perf_file |
null |
Optional link performance file path; auto-detected if omitted |
alm.c1_init |
1e3 |
Initial penalty for OD conservation |
alm.c2_init |
1e3 |
Initial penalty for minor non-negativity |
alm.beta_penalty |
4.0 |
Penalty growth factor |
alm.max_outer_iter |
20 |
Maximum ALM outer iterations |
alm.max_inner_iter |
200 |
Maximum L-BFGS-B inner iterations per outer step |
alm.stagnation_tol |
1e-6 |
Relative stagnation tolerance |
alm.stagnation_window |
3 |
Number of outer iterations for stagnation detection |
The code is implemented in Python, and requires the following libraries.
numpy
scipy
pandas
scikit-learn
Install the dependencies with:
pip install -r requirements.txtDefault mode loads config.json from the repository root:
python compressed_tap.pyUse a custom config file:
python compressed_tap.py --config path/to/your_config.jsonTo run a different setup, edit config.json (or pass a different config file path).
Results are printed to the console including link volume accuracy (