"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>"
"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"
]
},
{
...
...
@@ -124,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
...
...
@@ -155,7 +141,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
...
...
@@ -196,7 +182,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
...
...
@@ -222,7 +208,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
...
...
@@ -250,7 +236,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
...
...
@@ -286,44 +272,30 @@
"source": [
"## Optimization ##\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",