English | 日本語
A simulation and experimentation platform for vehicular computation offloading, combining Deep Q-Networks, Stackelberg-based pricing, SUMO mobility, and analytical or Knative serverless execution.
Developed as the implementation component of a graduation thesis, the project evaluates how connected vehicles can select an execution path for deadline-sensitive computation tasks while balancing latency, energy consumption, service payment, queue pressure, and infrastructure capacity.
The Hybrid Stackelberg-DQN strategy was compared with the pure Stackelberg strategy at three vehicle scales using identical SUMO inputs.
| Vehicles | Stackelberg | Hybrid Stackelberg-DQN | Improvement |
|---|---|---|---|
| 1,000 | 96.40% | 100.00% | +3.60 pp |
| 2,000 | 95.58% | 100.00% | +4.42 pp |
| 4,000 | 90.32% | 91.36% | +1.04 pp |
Each generated task can be executed through one of three paths:
- Local: execute on the originating vehicle.
- V2V: offload to an available nearby vehicle over a bounded multi-hop route.
- V2I: offload to a cloud function through an analytical model or an HTTP serverless backend.
flowchart LR
M["Mobility<br/>SUMO or synthetic"] --> T["Seeded vehicle tasks"]
T --> N["Network, queue, energy,<br/>deadline and price estimates"]
N --> P{"Offloading strategy"}
P --> R["Random"]
P --> G["Greedy"]
P --> D["DQN"]
P --> S["Stackelberg"]
P --> H["Hybrid Stackelberg-DQN"]
R --> A{"Execution path"}
G --> A
D --> A
S --> A
H --> A
A --> L["Local"]
A --> V["V2V<br/>multi-hop"]
A --> C["V2I / Serverless"]
C --> B["Analytical backend"]
C --> K["Docker / Knative HTTP function"]
L --> O["Task records and run summaries"]
V --> O
B --> O
K --> O
| Strategy | Role |
|---|---|
| Random | Selects among feasible execution paths as a reference baseline. |
| Greedy | Chooses the path with the minimum estimated completion delay. |
| DQN | Learns an offloading policy from temporal transitions and action masks. |
| Stackelberg | Uses queue-sensitive leader pricing and service-vehicle follower decisions. |
| Hybrid Stackelberg-DQN | Applies game-based decisions to clear cases and delegates ambiguous feasible choices to the learned policy. |
- A configuration-driven simulator for task generation, mobility, wireless communication, queueing, pricing, energy consumption, and deadline handling.
- DQN training with experience replay, target-network updates, action masking, and Double-DQN targets.
- Distance-aware Shannon/SNR capacity estimation, spatial indexing, and bounded multi-hop V2V routing.
- Shared analytical and HTTP serverless interfaces, including concurrent V2I execution, cold-start observation, platform-overhead measurement, and bounded autoscaling controls.
- Reproducible strategy comparison with shared mobility traces, tasks, and configuration snapshots.
- Experiment aggregation across multiple strategies and vehicle scales.
- Automated tests for configuration, routing, network estimation, strategies, DQN training, simulation, metrics, experiments, and the serverless function.
See docs/architecture.md for the detailed simulation flow and serverless execution boundary.
.
|-- configs/ # Simulation and experiment profiles
|-- deploy/knative/ # Knative Service definition
|-- docs/ # Architecture documentation and figures
|-- scripts/ # Training, deployment, and benchmark tools
|-- serverless_function/ # Containerized HTTP computation function
|-- src/vehicular_offloading/ # Simulator, algorithms, metrics, and CLI
|-- tests/ # Automated test suite
|-- compose.yaml # Local simulator/function environment
`-- Dockerfile # Simulator image
Python 3.11 is required.
python -m venv .venvActivate the environment:
# Linux / macOS
source .venv/bin/activate
# Windows PowerShell
.venv\Scripts\Activate.ps1Install the project and run the test suite:
python -m pip install --upgrade pip
python -m pip install -e .
python -m unittest discover -s tests -vRun the deterministic synthetic simulation:
python -m vehicular_offloading simulate --config configs/smoke.tomlEvery simulation writes machine-readable task records, a run summary, and the resolved configuration to its output directory.
Build and run the simulator together with the HTTP computation function:
docker compose up --buildThe Compose environment exercises the same HTTP contract used by the Knative backend. The serverless function performs bounded deterministic CPU work and reports container processing time separately from end-to-end request latency.
PowerShell automation is provided for a local Minikube and Knative deployment:
.\scripts\bootstrap-minikube.ps1
.\scripts\deploy-knative.ps1
.\scripts\benchmark-knative.ps1vehicular-offloading simulate Run one configured simulation
vehicular-offloading experiment Run a strategy/vehicle/seed matrix
vehicular-offloading generate-routes Generate valid SUMO routes
vehicular-offloading serverless-benchmark Benchmark an HTTP function endpoint
vehicular-offloading plot-results Plot a saved experiment summary
After installation, either the vehicular-offloading command or python -m vehicular_offloading can be used.
- Python 3.11
- PyTorch, NumPy, and SciPy
- Eclipse SUMO and
sumolib - Flask and Requests
- Docker Compose
- Knative Serving and Minikube
The research system models computation offloading as a joint decision across communication delay, processing time, queueing, energy consumption, monetary payment, task deadlines, and cloud capacity. The implementation provides a common evaluation environment for comparing heuristic, reinforcement-learning, game-theoretic, and hybrid decision policies under identical task and mobility conditions.