Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Quantum TSP

This repository contains code for an open source program solving the Travelling Salesman Problem with Quantum Computing.


There are two directories. src contains all the source code necessary to solve TSP. research contains reports and references to research, which lead to improving the code base.

Libraries used

This project makes a use of quantum computing libraries, you can install them with pip:

pip install pyquil
pip install quantum-grove


Pyquil is a library allowing you to create code for quantum computers to be executed using Rigetti Forest platform. It's developed by Rigetti Computing. To run your code on the quantum virtual machine or quantum processor you need to configure file, as described here:


Grove is a collection of quantum algorithms built using the Rigetti Forest platform. I use its implementation of QAOA for pyquil.


DWave is a quantum annealer - another type of quantum computing devices. To use it you need the following library:

pip install dwave-system

and have your own sapi-token. You can obtain it here:, though I am not sure if anyone is eligible to get it.


There are a couple of things worth knowing when it comes to this version:

  1. The biggest number of cities that can be solved on D-Wave 2000Q is 9. The amount of qubits needed to solve the problem grows as N^2 and finding embedding for the case with 10 cities will fail in most (if not all) cases.

  2. This implementation doesn't allow you to specify the starting point - it needs some modifications to take this information into account.

  3. If you experience any unexpected problems with D-Wave libraries, you might want to install an older version - this script definitely worked with dwave-system==0.5.1: