Skip to content

Demonstrates various methods for solving the Traveling Salesman Problem (TSP), which seeks the optimal route among a set of locations based on distance.

License

Notifications You must be signed in to change notification settings

aimms/traveling-salesman

Repository files navigation

Traveling Salesman

Downloads AIMMS Version WebUI Version DEX Version

This repository contains a comprehensive AIMMS example for the Traveling Salesman Problem (TSP). It illustrates multiple approaches to solving one of the most famous optimization challenges: finding the shortest possible route that visits a set of cities and returns to the origin.

🎯 Business Problem

The TSP is a cornerstone of logistics and supply chain optimization. This model demonstrates how to:

  • Minimize Travel Distance: Reducing fuel costs and transit time.
  • Compare Solvers: Analyzing the trade-offs between fast Heuristics (2-opt) and exact MIP (Mixed Integer Programming) solutions.
  • Handle Subtours: Implementing subtour elimination constraints to ensure a single, continuous tour.
  • Geocoding: Converting city names into geographical coordinates using external Rest APIs.

📖 How to Use This Example

To get the most out of this model, we highly recommend reading our detailed step-by-step guide on the AIMMS How-to website:

👉 Read the Full Article: Traveling Salesman Guide

Prerequisites

Technical Highlights

  • Heuristic Algorithms: Implementation of 2-opt initial, simultaneous, and cyclic heuristics with real-time visualization.
  • MIP with Lazy Constraints: Uses a binary variable formulation with an exponential number of subtour elimination constraints added via callbacks.
  • Haversine Formula: Precise distance calculation between geographical coordinates on a sphere.
  • REST API & DEX: Advanced use of the AIMMS Data Exchange library to fetch and map JSON data from external web services.

🚀 Getting Started

  1. Download the Release: Go to the Releases page and download the .zip file.
  2. Set up API Key: Open the project and enter your PositionStack access key in the sp_apiKey parameter.
  3. Run the Heuristics: Use the "Heuristic" page to see the 2-opt algorithm iterating in real-time on the map.
  4. Solve to Optimality: Switch to the MIP page to solve the problem using exact mathematical programming.

🤝 Support & Feedback

This example is maintained by the AIMMS User Support Team.


Maintained by the AIMMS User Support Team. We optimize the way you build optimization.