A newer version of the Gradio SDK is available:
5.44.1
license: mit
title: VRP Solver with Transformer and OR-Tools
sdk: gradio
emoji: π
colorFrom: purple
colorTo: yellow
short_description: Solves VRP with Transformer & RL. Compare with Google OR-Too
sdk_version: 5.33.0
pinned: false
app_file: app.py
use_gpu: true
allow_mount: true
π Vehicle Routing Problem Solver with Transformer-based Reinforcement Learning This project implements a deep reinforcement learning framework to solve the Vehicle Routing Problem with Time Windows (VRPTW) using Transformer-based models. It also integrates Google OR-Tools as a classical baseline for comparison.
π Project Structure bash Copy Edit . βββ Actor/ # Transformer-based RL agent βββ google_solver/ # OR-Tools baseline solver βββ train_test_utils/ # Training, validation, and baseline update routines βββ utils/ # Tensor manipulation, data formatting, etc. βββ nets/ # Neural network architecture (Transformer) βββ dataloader.py # Custom dataset handling (VRP with time windows) βββ run.py # Training pipeline βββ params.json # Hyperparameters and config βββ README.md # This file
π§ Model Description
This model is inspired by the paper βAttention, Learn to Solve Routing Problems!β (Bello et al., 2018 - arXiv:1803.08475)
It consists of:
A Transformer encoder that learns node embeddings
A decoding policy that uses attention for routing decisions
An actor-critic reinforcement learning strategy with a learnable baseline
Beam Search and Greedy decoding options
πΎ Data Persistence
This Space writes logs, model checkpoints, and training history to the /data
directory.
Make sure your run.py
and inference.py
use /data/
for saving/loading models and results.
Example:
with open("/data/train_results.txt", "a") as f:
f.write(...)
torch.save(model.state_dict(), "/data/model_state_dict.pt")