A SimPy-based discrete-event WiFi simulation framework that compares classic packet schedulers (FIFO, Priority, WFQ) against four contextual multi-armed bandit schedulers (PlainUCB, LinUCB, DLinUCB, DKernelUCB), measured by Jain's Fairness Index, normalized throughput, and a composite reward.
LinUCB achieves JFI 0.6722 vs FIFO 0.5767 -- a 16.5 percent fairness improvement -- while still maintaining competitive throughput. The bandit schedulers consistently dominate the fairness axis, while WFQ and FIFO retain a slight throughput edge.
| Scheduler | Jain Index | Norm. Throughput | Composite Reward |
|---|---|---|---|
| FIFO | 0.5767 | 0.8140 | 0.6479 |
| Priority | 0.5778 | 0.8111 | 0.6478 |
| WFQ | 0.6003 | 0.8089 | 0.6629 |
| PlainUCB | 0.6503 | 0.6745 | 0.6576 |
| LinUCB | 0.6722 | 0.6301 | 0.6596 |
| DLinUCB | 0.6532 | 0.6487 | 0.6519 |
| DKernelUCB | 0.6123 | 0.6415 | 0.6211 |
Composite reward = 0.7 x Jain Index + 0.3 x Normalized Throughput.
When the traffic mix changes mid-simulation (priority fraction shifts, queue depth varies), bandit schedulers re-converge on the new optimum within the first few hundred decision rounds while static policies do not adapt.
Sweeping the composite-reward fairness weight from 0 to 1 traces the fairness-vs-throughput Pareto frontier. The bandit schedulers occupy the high-fairness end of the frontier; WFQ and FIFO occupy the high-throughput end.
The simulator models a single WiFi access point serving multiple users with heterogeneous traffic patterns. Each tick:
- Users generate packets according to their traffic model (Poisson, ON/OFF, periodic, etc.).
- The scheduler picks one user to transmit (or applies its weighted round-robin / bandit policy).
- The metrics layer records per-user throughput, queue depth, and the running Jain's Fairness Index.
- For bandit schedulers, the reward (JFI + throughput) is fed back to update the per-arm value estimate.
The simulation is deterministic given a seed; reproducibility is built
into run_experiments.py.
| File | Scheduler | Type |
|---|---|---|
schedulers/fifo.py |
FIFO | First-come, first-served (baseline) |
schedulers/priority.py |
Priority | Strict priority by user class |
schedulers/wfq.py |
WFQ | Weighted Fair Queueing |
schedulers/bandit.py |
PlainUCB | UCB1 over discrete user arms |
schedulers/bandit.py |
LinUCB | Linear UCB with per-arm context features |
schedulers/bandit.py |
DLinUCB | Disjoint LinUCB (separate models per arm) |
schedulers/bandit.py |
DKernelUCB | Disjoint kernelized UCB |
The bandit context vector is 4-dimensional: (queue_depth, active_users, priority_fraction, current_jfi). Each scheduler observes this state
each decision round and selects an arm.
FairShare-WiFi/
engine/
access_point.py # event-driven AP, packet flow
simulation.py # SimPy simulation harness
schedulers/
base.py # abstract Scheduler interface
fifo.py, priority.py, wfq.py
bandit.py # PlainUCB, LinUCB, DLinUCB, DKernelUCB
metrics/
evaluator.py # Jain's Fairness Index, throughput, reward
logger.py # per-run CSV / JSON logging
plots.py # matplotlib plot generation
report.py # summary table builder
frontend/
app.py # Flask dashboard
templates/index.html # live metrics UI
results/
exp{1..5}_summary.json # per-experiment summary
exp*_timeseries.csv # per-step time series
plots/ # 12 PNG figures
docs/
DOCUMENTATION.md # design notes
paper.pdf # IEEE-format conference paper
proposal.pdf # original project proposal
wireless_models.py # channel / traffic models
run_experiments.py # entry point: runs all 5 experiments
run_tests.py # unit tests
requirements.txt
Python 3.9+ with the packages listed in requirements.txt:
pip install -r requirements.txtKey dependencies: simpy, numpy, matplotlib, flask (dashboard only).
python run_experiments.pyWrites results/exp<N>_*.csv time series, exp<N>_summary.json
aggregates, and regenerates all plots in results/plots/.
- Static scheduler comparison (FIFO vs Priority vs WFQ)
- Bandit vs static schedulers under stationary traffic
- Non-stationary traffic -- bandit adaptability test
- Ablation study -- cold-start vs warm-start bandit behavior
- Reward sweep -- fairness-vs-throughput Pareto frontier
python run_tests.pypython frontend/app.pyThen open http://localhost:5000 in a browser. The dashboard polls the running simulation and plots metrics in real time.
A full conference-style writeup is in docs/paper.pdf. It covers the
problem formulation, the contextual-bandit framework, the four UCB
variants, the experimental protocol, and the result interpretation.


