a-ragab-h-m's picture
Update README.md
16b551b verified

A newer version of the Gradio SDK is available: 5.44.1

Upgrade
metadata
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")