Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 149 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,150 @@
.history
# =============================================================================
# macOS
# =============================================================================
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# =============================================================================
# Windows
# =============================================================================
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
*.stackdump
[Dd]esktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msix
*.msm
*.msp
*.lnk

# =============================================================================
# Python
# =============================================================================
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
*.manifest
*.spec
pip-log.txt
pip-delete-this-directory.txt
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
*.mo
*.pot
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
instance/
.webassets-cache
.scrapy
docs/_build/
.pybuilder/
target/
.ipynb_checkpoints
profile_default/
ipython_config.py
__pypackages__/
celerybeat-schedule
celerybeat.pid
*.sage.py
.env
.venv
__pycache__
*.pyc
env/
venv/
ENV/
env.bak/
venv.bak/
.spyderproject.db
.spyproject
.ropeproject
/site
.mypy_cache/
.dmypy.json
dmypy.json
.pyre/
.pytype/
cython_debug/

# =============================================================================
# JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.)
# =============================================================================
.idea/
*.iws
*.iml
*.ipr
out/
.idea_modules/
atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# =============================================================================
# Visual Studio Code
# =============================================================================
.vscode/
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
.history/
*.vsix

# Project Specific
papers/
data/
*.mps
*.mst
*.sol
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
68 changes: 61 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,67 @@
# Weapon Target Allocation (WTA) Optimizer

This repository contains a comparative study of **Exact Mixed-Integer Programming (MIP)** formulations and **Fast Heuristic algorithms** for solving the Static Weapon Target Allocation (WTA) problem.
This repository contains a comparative study of exact and heuristic algorithms for solving the **Static Weapon-Target Assignment (WTA)** problem.

The Static WTA problem is a classic NP-hard combinatorial optimization challenge. The core objective of this project is to analyze the fundamental trade-off between guaranteed mathematical optimality and computational feasibility, especially for large-scale, real-time systems where execution time is critical.
The Static WTA problem is a classic NP-hard combinatorial optimization challenge. Given a set of weapons and targets, each weapon must be assigned to exactly one target to minimise the total expected survival value. The core objective of this project is to analyse the trade-off between guaranteed mathematical optimality and computational feasibility.

## Solvers implemented

## Methodology
| Method | Category | Backend | Notes |
|--------|----------|---------|-------|
| **Exact MIP** | Exact | PuLP / CBC | Piecewise-linear approximation of the log-sum objective (Camm et al.) |
| **Branch & Adjust** | Exact | PySCIPOpt / SCIP | 20-segment piecewise linearisation; SCIP event handler tracks true objective |
| **Outer Approximation** | Exact | PySCIPOpt / SCIP | Iterative cutting-plane (Kelley) method; adds tangent cuts to `exp(y_j)` until convergence |
| **Greedy** | Heuristic | – | Iteratively allocates the most cost-effective weapon to the highest-value target |
| **Greedy + Local Search** | Heuristic | – | Greedy solution refined by 2-opt neighbourhood search |
| **Simulated Annealing** | Heuristic | – | SA on greedy initialisation |

1. **Exact Approach:** Minimizes the expected survival value of targets using a strict mathematical formulation. To bypass the non-linear product terms (which cause standard solvers to fail), the model implements a logarithmic transformation trick.
2. **Heuristic Approach:** Prioritizes real-time execution by iteratively allocating the most effective weapons to the highest-value targets, optionally refined by local search to escape local minima.
The Outer Approximation solver is based on the cutting-plane framework described in:
> Andersen, Pavlikov & Toffolo (2022). *Weapon-target assignment problem: Exact and approximate solution algorithms.* Annals of Operations Research.

## Benchmark schemes

Results are reported on two families of instances:

* **Andersen instances** — real WTA benchmark files from Mendeley Data (N = 5 … 200, square N×N), sourced from Sonuç, Sen & Bayır (2017).
* **Bertsimas–Paskov instances** — synthetically generated following the two schemes from:
> Bertsimas & Paskov (2025). *Solving Large-Scale Weapon-Target Assignment Problems in Seconds Using Branch-Price-And-Cut.* Naval Research Logistics.
* Scheme 1 (hard): $p_{ij} \sim U(0,1)$, $v_j \sim U_{\text{int}}[1, 100]$
* Scheme 2: $p_{ij} \sim U(0.6, 0.9)$, $v_j \sim U_{\text{int}}[25, 100]$

## Repository structure

```
src/wta_optimization/
models.py – WTAInstance / WTASolution dataclasses
data.py – instance generators and file loader
exact.py – solve_exact, solve_branch_and_adjust, solve_outer_approximation
heuristic.py – solve_greedy, solve_local_search, solve_simulated_annealing
benchmark.py – CLI benchmark runner (see Usage below)
compare_bpc.py – comparison chart: our OA/BnA vs Bertsimas BPC (Table 1)
demo_oa.py – interactive demo showing OA cutting-plane iterations
data/WTA/ – Andersen benchmark instances (wta5.txt … wta200.txt)
results/ – saved CSVs and plots
```

## Usage

```bash
# Run on Andersen file-based instances (wta5–wta200)
python benchmark.py --mode files

# Run on randomly generated instances (N = 5–30)
python benchmark.py --mode random

# Run on Bertsimas Scheme 1/2 instances (N = 5–30)
python benchmark.py --mode bertsimas --exact-limit-seconds 120

# Live demo: watch OA add cutting planes iteration by iteration
python demo_oa.py --n 10
python demo_oa.py --n 15 --scheme 2

# Comparison chart vs Bertsimas BPC (Table 1 from paper)
python compare_bpc.py
```

## Team

Expand All @@ -17,8 +70,9 @@ The Static WTA problem is a classic NP-hard combinatorial optimization challenge
* [Norbert Frydrysiak](https://github.com/fantasy2fry)

---
*Developed as a course project for Optimization in Data Analysis @ WUT.
*Developed as a course project for Optimization in Data Analysis @ WUT.*

## Data

The benchmark tests in this repository include experiments run using the dataset published on Mendeley Data: https://data.mendeley.com/datasets/jt2ppwr62p/2
Andersen benchmark instances: Mendeley Data — https://data.mendeley.com/datasets/jt2ppwr62p/2

Loading