Skip to content

A C++ program to solve the Traveling Salesman Problem using Simulated Annealing. The program reads city coordinates from a .tsp file, performs optimization, and outputs an approximate shortest tour.

Notifications You must be signed in to change notification settings

JAI0118/TRIMESTER-1-PROJECT-IITG-X-MASAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Traveling Salesman Problem Solver Using Simulated Annealing

This project is a C++ program that solves the Traveling Salesman Problem (TSP) using the Simulated Annealing algorithm. Given a set of cities with specific coordinates, the program attempts to find the shortest possible tour that visits each city exactly once and returns to the starting point.

Table of Contents

Description

This program reads city coordinates from a .tsp file, optimizes the route using Simulated Annealing, and outputs the best tour and its distance. Simulated Annealing is a probabilistic technique that searches for an approximate global optimum in a large solution space, making it well-suited for TSP, an NP-hard problem.

Requirements

  • C++ Compiler: A compiler that supports C++11 or later.
  • Input File: A .tsp file containing city coordinates in the TSPLIB format.

Usage

  1. Clone the Repository

    git clone <repository_url>
    cd <repository_name>
  2. Compile the Program

    g++ -o tsp_solver tsp_solver.cpp -std=c++11
  3. Run the Program

    ./tsp_solver
  4. Input the Filename When prompted, enter the name of the .tsp file (e.g., xqf131.tsp).

About

A C++ program to solve the Traveling Salesman Problem using Simulated Annealing. The program reads city coordinates from a .tsp file, performs optimization, and outputs an approximate shortest tour.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages