✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: December 29, 2025
  • 6 min read

Per‑Instance TSP Solver Using PPO Sets New Benchmark


Per‑instance TSP Solver illustration

The per‑instance TSP solver using Proximal Policy Optimization (PPO) is a reinforcement‑learning method that solves individual Travelling Salesman Problem instances without any pre‑training, achieving a sub‑2 % optimality gap on the TSPLIB d1291 benchmark in just a few hours.

Introduction

Travelling Salesman Problem (TSP) research has long been a proving ground for combinatorial optimization and AI. A recent discussion on Hacker News highlighted a breakthrough: a per‑instance TSP solver that leverages Proximal Policy Optimization (PPO) to learn on the fly. Unlike traditional approaches that rely on massive pre‑trained models or exhaustive heuristics, this method adapts to a single problem instance, delivering high‑quality tours with minimal computational overhead.

In this article we unpack the technical foundations, present the key performance metrics, and explore the broader implications for AI‑driven optimization. The analysis is tailored for AI researchers, machine learning engineers, optimization specialists, and tech enthusiasts eager to apply cutting‑edge reinforcement learning (RL) to real‑world problems.

Overview of the Per‑Instance TSP Solver and PPO

Why Per‑Instance Matters

Traditional TSP solvers fall into two camps:

  • Exact algorithms (e.g., branch‑and‑bound) that guarantee optimality but scale poorly.
  • Heuristic or meta‑heuristic methods (e.g., Lin‑Kernighan, genetic algorithms) that trade optimality for speed.

Both categories assume a one‑size‑fits‑all strategy. A per‑instance approach, however, treats each TSP instance as a unique learning problem, allowing the model to exploit specific geometric and topological cues present in that instance.

Proximal Policy Optimization (PPO) in a Nutshell

PPO is a state‑of‑the‑art policy‑gradient algorithm that balances exploration and exploitation by clipping policy updates. Its stability and sample efficiency make it ideal for problems where the environment (the TSP graph) is static but the optimal policy (the tour) is unknown.

Key PPO features leveraged in the solver:

  1. Clipped surrogate objective – prevents large policy swings that could destabilize learning.
  2. Advantage estimation – provides a low‑variance signal for edge selection.
  3. Entropy bonus – encourages diverse tour constructions during early training phases.

Architectural Highlights

The solver’s architecture consists of three core modules:

  • Encoder: Projects city coordinates into a latent space using a lightweight graph neural network.
  • Policy Network: Generates a probability distribution over the next city to visit, conditioned on the current partial tour.
  • Reward Shaper: Computes the negative tour length as the RL reward, with optional shaping to prioritize “exception edges” (edges that deviate from nearest‑neighbor heuristics).

By training directly on the target instance, the model learns to recognize and exploit these exception edges, dramatically reducing the search space.

Key Results and Performance Metrics

The experimental evaluation focused on the TSPLIB d1291 dataset, a classic benchmark with 1,291 cities. The solver was executed on a single NVIDIA A100 GPU for approximately 5.6 hours. Below are the headline figures:

Metric Value
Optimality Gap 1.66 %
Training Time ≈ 5.6 hours (single A100)
Memory Footprint ~ 7 GB VRAM
Inference Speed ~ 0.3 seconds per tour after training

These results are remarkable because they were achieved without any pre‑training on other TSP instances. For comparison, many deep‑learning TSP solvers require extensive pre‑training on thousands of instances to reach similar gaps.

Ablation Study: Exception Edge Bias

To validate the hypothesis that “exception edges” drive performance, the authors conducted an ablation where the inductive bias was removed. The optimality gap rose to 4.3 %, confirming that guiding the policy toward these rare edges is a decisive factor.

Scalability Outlook

While the current implementation targets medium‑scale instances (up to ~2,000 cities), the modular design suggests straightforward scaling:

  • Replacing the encoder with a more expressive transformer‑based graph model.
  • Parallelizing rollout generation across multiple GPUs.
  • Integrating curriculum learning to gradually increase instance size.

Implications for AI‑Driven Optimization

The success of a per‑instance RL solver reshapes how we think about combinatorial problems in AI:

From Generalist to Specialist Models

Instead of investing massive resources into universal models, practitioners can now deploy lightweight specialist agents that train on demand. This aligns perfectly with the emerging Enterprise AI platform by UBOS, which emphasizes modular AI services that spin up per‑task.

Rapid Prototyping and Customization

Businesses can embed a per‑instance solver into existing workflows, customizing the reward function to reflect domain‑specific costs (e.g., fuel consumption, time windows). The Workflow automation studio makes it trivial to chain the solver with data ingestion pipelines.

Synergy with Generative AI Tools

Combining the solver with generative language models opens new horizons. For instance, a OpenAI ChatGPT integration can translate natural‑language routing constraints into reward shaping terms, while a Chroma DB integration can store and retrieve previously solved instances for warm‑starting future runs.

Impact on Related Domains

Beyond logistics, any domain that can be modeled as a graph traversal problem stands to benefit:

  • Network routing and load balancing.
  • Genome assembly in bioinformatics.
  • Robotic path planning in dynamic environments.

Links and References

For a deeper dive into the code and reproducibility, the author released a public repository and a Colab notebook. The community has already begun extending the approach to other benchmark sets.

Relevant resources from the UBOS ecosystem that complement this research:

External references:

Conclusion

The emergence of a per‑instance TSP solver powered by PPO demonstrates that reinforcement learning can move beyond generic, pre‑trained models to deliver highly specialized, on‑demand optimization. With a sub‑2 % optimality gap on a challenging benchmark and modest hardware requirements, this approach is poised to influence logistics, network design, and any domain where graph traversal is central.

By integrating the solver with platforms like Enterprise AI platform by UBOS, developers can rapidly prototype, deploy, and scale AI‑driven decision engines. The open‑source nature of the project invites the community to extend the methodology—adding richer encoders, multi‑objective rewards, or hybrid heuristics—thereby accelerating the next wave of AI‑powered optimization.

Stay tuned to the UBOS ecosystem for upcoming templates, tutorials, and partner collaborations that will make per‑instance reinforcement learning accessible to every AI practitioner.


© 2025 UBOS Technologies. All rights reserved.


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.