Skip to content

Implementation of the Held-Karp algorithm for solving the Travelling Salesman Problem

License

Notifications You must be signed in to change notification settings

piotrdurniat/tsp-held-karp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Held-Karp Algorithm for Solving the Travelling Salesman Problem

This project is a C++ implementation of the Held-Karp algorithm for solving the Travelling Salesman Problem (TSP). The TSP is an optimization problem of finding the minimum Hamiltonian cycle in a complete weighted graph.

Build the project

Run:

make

Define the algorithm settings:

  • To change the algorithm settings, edit the settings.ini file.
  • The settings file defines basic parameters of the algorithm as well as the instances which will be used by the algorithm.
  • Example instance files are located in the instances directory
  • Instance files define the graphs on which the algorithm will be called. They can have two extensions:
    • .tsp for undirected graphs (e.g. gr17.tsp)
    • .atsp for directed graphs (e.g. m6.atsp)

Run the algorithm:

Run:

./bin/main

The results will be saved as .csv files in the directory specified in the settings.ini file.

Filtering out 'outliers' from the results

You can remove outlying results by running the rm_outlier.py script. (files from which outliers should be removed are wonderfully hard-coded in the script)

python3 rm_outliers

Measure RAM usage over time:

valgrind --tool=massif ./bin/main

Get max RAM usage

Read "Maximum resident set size (kbytes)" value from:

/usr/bin/time -v ./bin/main

About

Implementation of the Held-Karp algorithm for solving the Travelling Salesman Problem

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages