File size: 2,006 Bytes
5c5bfbd
08c15f4
 
883aafe
08c15f4
 
 
 
46d72f5
8f68d28
 
 
 
177fa02
08c15f4
 
9e1bb92
 
177fa02
08c15f4
 
 
 
 
 
 
 
 
 
 
 
a8b98ac
 
 
08c15f4
a8b98ac
08c15f4
 
 
 
 
 
 
 
 
 
 
 
16b551b
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
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:
```python
with open("/data/train_results.txt", "a") as f:
    f.write(...)
torch.save(model.state_dict(), "/data/model_state_dict.pt")