Skip to content

Commit fd35f35

Browse files
committed
02 QAOA - work in progress.
1 parent c0198fd commit fd35f35

File tree

2 files changed

+184
-2
lines changed

2 files changed

+184
-2
lines changed

tutorials/01_Introduction_to_TSP.ipynb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
"For now, we will use only classical algorithms - we will go quantum in the next tutorial."
1616
]
1717
},
18+
{
19+
"cell_type": "markdown",
20+
"metadata": {},
21+
"source": [
22+
"In this tutorial you will learn the following:\n",
23+
"- What is the Travelling Salesman Problem?\n",
24+
"- Why it's important?\n",
25+
"- How can we solve it?"
26+
]
27+
},
1828
{
1929
"cell_type": "markdown",
2030
"metadata": {},
@@ -583,7 +593,7 @@
583593
"cell_type": "markdown",
584594
"metadata": {},
585595
"source": [
586-
"What we covered?\n",
596+
"What we learned?\n",
587597
"\n",
588598
"- TSP is an optimization problem, where we want to find the shortest route which allows us to visit all the cities\n",
589599
"- TSP has many variations and formulations, many applications and can be solved in many ways\n",
@@ -599,7 +609,7 @@
599609
"cell_type": "markdown",
600610
"metadata": {},
601611
"source": [
602-
"## Additional sources"
612+
"## Additional resources"
603613
]
604614
},
605615
{

tutorials/02_QAOA.ipynb

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# QAOA - Quantum Approximate Optimization Algorithm"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"In this notebook I would like to cover one of the most prominent algorithms in the quantum computing in the last few years."
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"In this tutorial you will learn the following:\n",
22+
"- How to use pyQuil - python platform for quantum computing?\n",
23+
"- What is QAOA?\n",
24+
"TODO"
25+
]
26+
},
27+
{
28+
"cell_type": "markdown",
29+
"metadata": {},
30+
"source": [
31+
"## Prerequisites"
32+
]
33+
},
34+
{
35+
"cell_type": "markdown",
36+
"metadata": {},
37+
"source": [
38+
"Before we can go into QAOA itself, you should prepare a couple of things:\n",
39+
"1. Configure your Forest API Key - go to http://forest.rigetti.com, find section \"Get API Key\" and follow the instructions\n",
40+
"2. Install [pyQuil](https://github.com/rigetticomputing/pyquil) and [Grove](https://github.com/rigetticomputing/grove)\n",
41+
"3. Learn the basics of quantum computing by yourself - there are plenty of great resources about the basics in the web and I decided I don't want to reinvent the wheel in this tutorial. I recommend going to [pyQuil documentation](http://pyquil.readthedocs.io/en/stable/).\n",
42+
"\n",
43+
"Even though I tried to make this tutorial as accessible to the not-quantum-computing people as possible, you probably need some level of familiarity with the following concepts:\n",
44+
"- qubits\n",
45+
"- quantum gates\n",
46+
"- superposition\n",
47+
"- entanglement\n",
48+
"\n",
49+
"You don't need to go very in-depth - if something is confusing you can always come back to the documentation when you need it."
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"## QAOA - intro"
57+
]
58+
},
59+
{
60+
"cell_type": "markdown",
61+
"metadata": {},
62+
"source": [
63+
"QAOA is an algorithm for solving a broad range of optimization problems using NISQ (Noisy Intermediate-Scale Quantum) devices. \n",
64+
"\n",
65+
"Let's start easy and instead of going straight to the TSP we will solve MaxCut problem."
66+
]
67+
},
68+
{
69+
"cell_type": "markdown",
70+
"metadata": {},
71+
"source": [
72+
"### MaxCut - explanation"
73+
]
74+
},
75+
{
76+
"cell_type": "markdown",
77+
"metadata": {},
78+
"source": [
79+
"In the MaxCut problem we start with a graph and we want to divide it into two subgraphs in such way, that the edges between them would have the higher possible sum."
80+
]
81+
},
82+
{
83+
"cell_type": "markdown",
84+
"metadata": {},
85+
"source": [
86+
"#TODO Picture"
87+
]
88+
},
89+
{
90+
"cell_type": "markdown",
91+
"metadata": {},
92+
"source": [
93+
"### QAOA solves MaxCut"
94+
]
95+
},
96+
{
97+
"cell_type": "markdown",
98+
"metadata": {},
99+
"source": [
100+
"We will use a class maxcut_solver which we can find in the grove library."
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": 3,
106+
"metadata": {},
107+
"outputs": [],
108+
"source": [
109+
"import numpy as np\n",
110+
"from grove.pyqaoa.maxcut_qaoa import maxcut_qaoa\n",
111+
"import pyquil.api as api\n",
112+
"qvm_connection = api.QVMConnection()"
113+
]
114+
},
115+
{
116+
"cell_type": "code",
117+
"execution_count": null,
118+
"metadata": {},
119+
"outputs": [],
120+
"source": []
121+
},
122+
{
123+
"cell_type": "markdown",
124+
"metadata": {},
125+
"source": [
126+
"## QAOA - how does it work?"
127+
]
128+
},
129+
{
130+
"cell_type": "markdown",
131+
"metadata": {},
132+
"source": [
133+
"## Additional resources"
134+
]
135+
},
136+
{
137+
"cell_type": "markdown",
138+
"metadata": {},
139+
"source": [
140+
"- https://arxiv.org/pdf/1801.00862.pdf"
141+
]
142+
},
143+
{
144+
"cell_type": "code",
145+
"execution_count": null,
146+
"metadata": {},
147+
"outputs": [],
148+
"source": []
149+
}
150+
],
151+
"metadata": {
152+
"kernelspec": {
153+
"display_name": "qenv",
154+
"language": "python",
155+
"name": "qenv"
156+
},
157+
"language_info": {
158+
"codemirror_mode": {
159+
"name": "ipython",
160+
"version": 3
161+
},
162+
"file_extension": ".py",
163+
"mimetype": "text/x-python",
164+
"name": "python",
165+
"nbconvert_exporter": "python",
166+
"pygments_lexer": "ipython3",
167+
"version": "3.6.4"
168+
}
169+
},
170+
"nbformat": 4,
171+
"nbformat_minor": 2
172+
}

0 commit comments

Comments
 (0)