This repository contains code with tutorials of how to approach optimization problems using quantum computing.
Branch: master
Clone or download
Latest commit 7fad34b Feb 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Fixes from Katerina Feb 7, 2019

Quantum TSP tutorial


This repository contains code with tutorials on how to approach optimization problems using quantum computing. I used Travelling Salesman Problem for this tutorials, though the idea is, that after finishing it, you should be able to implement any similar optimization problem.

Is this tutorial right for you?

I have created this tutorial with specific audience in mind. It means people, who:

  • are curious about quantum computing,
  • don't have any background in quantum physics,
  • have some programming experience,
  • really want to learn this topic.

The last point is the most important. My goal here is not to show you how to solve TSP with a quantum computer. My goal is to teach you how to solve optimization problems with QC, make sure your solution works and how to improve it. To do all that you need to put some effort into it and spend a couple of hours trying to understand all the concepts. But this is on purpose - this is the best way I know to actually learn the topic and integrate this knowledge.

I did my best to provide you with all the necessary knowledge, code examples etc. If you think something is not clear, missing, you have a better idea - well, I encourage you to do one of these two things:

I don't want to say that it is super advanced and hard - as stated earlier, you don't have to be a quantum computing expert.


In this tutorial I used pyquil 2.2.1 and grove 1.7.0 . API of these librares may change in next versions - let me know if something is broken so I can fix it :)

About the author

My name is Michał and I do research on quantum algorithms at Bohr Technology. I focus on applying near-term devices for solving optimization problems and enchance machine learning (so called QML).

You can read my story in this article on Medium. I also have a blog called Musty thoughts.

If you want to contact me - feel free to do so: .

Unitary Fund

This project is supported by Unitary Fund. If you have an idea for an open-source project for near term hybrid quantum-classical programming, this is a good place for you!

Unitary Fund


Thanks to Jacek Łysiak and Katerina Gratsea for feedback!