Commit 4feb1e4b authored by Abhishek's avatar Abhishek

.

parent f7b7d79c
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"nbgrader": { "nbgrader": {
"grade": false, "grade": false,
...@@ -26,17 +26,7 @@ ...@@ -26,17 +26,7 @@
"solution": false "solution": false
} }
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Available frameworks:\n",
"Qiskit\n",
"D-Wave Ocean\n"
]
}
],
"source": [ "source": [
"%run -i \"assignment_helper_QML.py\"\n", "%run -i \"assignment_helper_QML.py\"\n",
"%matplotlib inline" "%matplotlib inline"
...@@ -63,7 +53,7 @@ ...@@ -63,7 +53,7 @@
"The aim of MaxCut is to maximize the number of edges (yellow lines) in a graph that are \"cut\" by\n", "The aim of MaxCut is to maximize the number of edges (yellow lines) in a graph that are \"cut\" by\n",
"a given partition of the vertices (blue circles) into two sets (see figure below).\n", "a given partition of the vertices (blue circles) into two sets (see figure below).\n",
"\n", "\n",
"<img src=\"images/maxcut_example.png\" style=\"width: 400px;\"/>" "<img src=\"images/qaoa_maxcut_partition.png\" style=\"width: 400px;\"/>"
] ]
}, },
{ {
...@@ -74,11 +64,7 @@ ...@@ -74,11 +64,7 @@
"\n", "\n",
"$$\\begin{align}C(z) = \\sum_{\\alpha=1}^{m}C_\\alpha(z),\\end{align}$$\n", "$$\\begin{align}C(z) = \\sum_{\\alpha=1}^{m}C_\\alpha(z),\\end{align}$$\n",
"\n", "\n",
"where $C$ counts the number of edges cut. $C_\\alpha(z)=1$ if $z$ places one vertex from the $\\alpha^\\text{th}$ edge in set $A$ and the other in set $B$, and $C_\\alpha(z)=0$ otherwise. Finding a cut which yields the maximum possible value of $C$ is an NP-complete problem, so our best hope for a polynomial-time algorithm lies in an approximate optimization. In the case of MaxCut, this means finding a partition $z$ which yields a value for $C(z)$ that is close to the maximum possible value.\n", "where $C$ counts the number of edges cut. $C_\\alpha(z)=1$ if $z$ places one vertex from the $\\alpha^\\text{th}$ edge in set $A$ and the other in set $B$, and $C_\\alpha(z)=0$ otherwise. Finding a cut which yields the maximum possible value of $C$ is an NP-complete problem, so our best hope for a polynomial-time algorithm lies in an approximate optimization. In the case of MaxCut, this means finding a partition $z$ which yields a value for $C(z)$ that is close to the maximum possible value.\n"
"\n",
"We can represent the assignment of vertices to set $A$ or $B$ using a bitstring, $z=z_1...z_n$ where $z_i=0$ if the $i^\\text{th}$ vertex is in $A$ and $z_i = 1$ if it is in $B$. For instance, in the situation depicted in the figure above the bitstring representation is $z=0101\\text{,}$ indicating that the $0^{\\text{th}}$ and $2^{\\text{nd}}$ vertices are in $A$ while the $1^{\\text{st}}$ and $3^{\\text{rd}}$ are in $B$. This assignment yields a value for the objective function (the number of yellow lines cut) $C=4$, which turns out to be the maximum cut. In the following sections, we will represent partitions using computational basis states and use PennyLane to rediscover this maximum cut.\n",
"\n",
"<div class=\"alert alert-info\"><h4>Note</h4><p>In the graph above, $z=1010$ could equally well serve as the maximum cut.</p></div>"
] ]
}, },
{ {
...@@ -124,7 +110,7 @@ ...@@ -124,7 +110,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"jupyter": { "jupyter": {
...@@ -155,7 +141,7 @@ ...@@ -155,7 +141,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"jupyter": { "jupyter": {
...@@ -196,7 +182,7 @@ ...@@ -196,7 +182,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"jupyter": { "jupyter": {
...@@ -222,7 +208,7 @@ ...@@ -222,7 +208,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"jupyter": { "jupyter": {
...@@ -250,7 +236,7 @@ ...@@ -250,7 +236,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"jupyter": { "jupyter": {
...@@ -286,44 +272,30 @@ ...@@ -286,44 +272,30 @@
"source": [ "source": [
"## Optimization ##\n", "## Optimization ##\n",
"\n", "\n",
"Finally, we optimize the objective over the angle parameters $\\boldsymbol{\\gamma}$ (``params[0]``) and $\\boldsymbol{\\beta}$ (``params[1]``) and then sample the optimized circuit multiple times to yield a distribution of bitstrings. One of the optimal partitions ($z=0101$ or $z=1010$) should be the most frequently sampled bitstring. We perform a maximization of $C$ by minimizing $-C$, following the convention that optimizations are cast as minimizations in PennyLane.\n", "Finally, we optimize the objective over the angle parameters $\\boldsymbol{\\gamma}$ (``params[0]``) and $\\boldsymbol{\\beta}$ (``params[1]``) and then sample the optimized circuit multiple times to yield a distribution of bitstrings. One of the optimal partitions should be the most frequently sampled bitstring. We perform a maximization of $C$ by minimizing $-C$, following the convention that optimizations are cast as minimizations in PennyLane.\n",
"\n" "\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"jupyter": { "jupyter": {
"outputs_hidden": false "outputs_hidden": false
} }
}, },
"outputs": [ "outputs": [],
{ "source": [
"name": "stdout", "n_layers = 1 # Enter the layes you want\n"
"output_type": "stream", ]
"text": [ },
"\n", {
"p=1\n", "cell_type": "code",
"Objective after step 5: 2.7870528\n", "execution_count": null,
"Objective after step 10: 2.9983800\n", "metadata": {},
"Optimized (gamma, beta) vectors:\n", "outputs": [],
"[[-0.78539768]\n",
" [-1.1923295 ]]\n",
"Most frequently sampled bit string is: 1010\n"
]
}
],
"source": [ "source": [
"n_layers = 1 # Enter the layes you want\n",
"\n",
"\n",
"print(\"\\np={:d}\".format(n_layers))\n",
"\n",
"# initialize the parameters near zero\n",
"init_params = 0.01 * np.random.rand(2, n_layers)\n",
"\n",
"# minimize the negative of the objective function\n", "# minimize the negative of the objective function\n",
"def objective(params):\n", "def objective(params):\n",
" gammas = params[0]\n", " gammas = params[0]\n",
...@@ -332,18 +304,34 @@ ...@@ -332,18 +304,34 @@
" for edge in graph:\n", " for edge in graph:\n",
" # objective for the MaxCut problem\n", " # objective for the MaxCut problem\n",
" neg_obj -= 0.5 * (1 - circuit(gammas, betas, edge=edge, n_layers=n_layers))\n", " neg_obj -= 0.5 * (1 - circuit(gammas, betas, edge=edge, n_layers=n_layers))\n",
" return neg_obj\n", " return neg_obj\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n", "\n",
"# initialize optimizer: Adagrad works well empirically\n", "# initialize optimizer: Adagrad works well empirically\n",
"opt = qml.AdagradOptimizer(stepsize=0.5)\n", "opt = qml.AdagradOptimizer(stepsize=0.1)\n",
"\n", "\n",
"# optimize parameters in objective\n", "# optimize parameters in objective\n",
"params = init_params\n", "params = 0.01 * np.random.rand(2, n_layers)\n",
"steps = 10\n", "steps = 10\n",
"for i in range(steps):\n", "for i in range(steps):\n",
" params = opt.step(objective, params)\n", " params = opt.step(objective, params)\n",
" if (i + 1) % 5 == 0:\n", " if (i + 1) % 5 == 0:\n",
" print(\"Objective after step {:5d}: {: .7f}\".format(i + 1, -objective(params)))\n", " print(\"Objective after step {:5d}: {: .7f}\".format(i + 1, -objective(params)))\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n", "\n",
"# sample measured bitstrings 100 times\n", "# sample measured bitstrings 100 times\n",
"bit_strings = []\n", "bit_strings = []\n",
...@@ -359,50 +347,25 @@ ...@@ -359,50 +347,25 @@
"\n" "\n"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the case where we set ``n_layers=2``, we recover the optimal\n",
"objective function $C=4$\n",
"\n"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Plotting the results\n", "Plotting the results\n",
"--------------------\n", "--------------------\n",
"We can plot the distribution of measurements obtained from the optimized circuits. As\n", "We can plot the distribution of measurements obtained from the optimized circuits."
"expected for this graph, the partitions 0101 and 1010 are measured with the highest frequencies,\n",
"and in the case where we set ``n_layers=2`` we obtain one of the optimal partitions with 100% certainty.\n",
"\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"jupyter": { "jupyter": {
"outputs_hidden": false "outputs_hidden": false
} }
}, },
"outputs": [ "outputs": [],
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi40LCBodHRwOi8vbWF0cGxvdGxpYi5vcmcv7US4rQAAGUhJREFUeJzt3Xm0ZXV55vHvEwZbgQhISZCpiANCh4impLUdFmpQDFkRbCc0iMRYro6kpbVXW9pZih3tLuIY2zigIGUccFYiDigSaTUiBSKUEMWhEBGhbEQhigq+/cfZBbdu3aHuqbPP/Z17v5+17qpz9vDu99atus/Ze//23qkqJElqze8sdgOSJM3EgJIkNcmAkiQ1yYCSJDXJgJIkNcmAkiQ1yYCSepLkyCQ/XOw+pEllQEmSmmRASUtIkh0XuwdpVAwoaRsl2ZjkvyW5PMnPknwgyb9bwPprknw3yS1JrkxyXDd95yQ3JTlsyrL3TvKLJCu693+a5LIkNyf5SpI/nNbXS5JcDvxbkh2799d12/pWkseN8K9CGgsDSlqYpwFHAwcBfwg8ZwHrfhd4FHBP4JXAe5LsU1W/Bs4G/nzKsscD51fVpiQPBs4Eng/cC3g7cE6Su01b/hhgd+C+wM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CHb643Zd6ruxpfzeBmqSS5b/f+iiSvSnJrN32fJBd2PWxI8qjF+WuShmdAScM5GHhLVR0C/Bz4q80zqmoN8MuqOryqngUcDfyoqh7U7XV9pqreBPwIeExVPaZbdRfgom656cN/dwG+WlUPAi4EntdN/3vg76vqMO566CTAM4HPVtXhwIOAra6jkVpnQEnDubaqvty9fg/wyDmWvQI4KslpSR5VVT+bZbk7gI/MMu/XDC7aBLgEWNm9fjjwoe71+6YsfzFwUpJTgcOq6pY5+pOaZEBJw5l+8nbWk7lV9W3gIQyC6lVJXj7LorfNcd7pN3XXCeM7mOcuMFV1IfBoBnexOCvJs+daXmqRASUN54AkD+9ePxOYfkjuN0l2AkhyH+AXVfUe4DUMwgrgFmC37ezjq8B/6l7f+ZDJJAcCN1TVO4B3TtmmNDEMKGk43wJekOQqBs/leeu0+acDlyd5L3AY8LUklwGvAF41ZZnPbB4kMaRTgBd1N/+8H7D58OGRwDeSfB14OoNzVdJEcZi5NMG666h+WVWV5BnA8VX1pMXuSxqFZX03c2kJ+CPgzUkC3Az8xSL3I42Me1CSpCZ5DkqS1CQDSpLUJANKktQkA0qS1CQDSpLUpP8PsCCOczNYLcoAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [ "source": [
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"\n", "\n",
...@@ -420,11 +383,20 @@ ...@@ -420,11 +383,20 @@
] ]
}, },
{ {
"cell_type": "code", "cell_type": "markdown",
"execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "source": [
"source": [] "**Exercise 1**: Check for more layers and iterations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Exercise 2**: Find the MAX CUT for the graph below.\n",
"\n",
"<img src=\"images/output-onlinepngtools.png\" style=\"width: 300px;\"/>\n"
]
} }
], ],
"metadata": { "metadata": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment