diff --git a/01-exploring-pegasus.ipynb b/01-exploring-pegasus.ipynb index 15c2216..d338052 100644 --- a/01-exploring-pegasus.ipynb +++ b/01-exploring-pegasus.ipynb @@ -42,7 +42,8 @@ "source": [ "## Minor-Embedding: Mapping Problems to Qubits\n", "\n", - "
Note: If you already understand how problems are mapped to the D-Wave system, please skip ahead to the next text cell by clicking the **Run** button.
\n", + "> **Note:** If you already understand how problems are mapped to the D-Wave system, please skip ahead to the \n", + " next text cell by clicking the **Run** button.\n", " \n", "D-Wave systems solve binary quadratic models (BQMs): the [Ising model](https://en.wikipedia.org/wiki/Ising_model) traditionally used in statistical mechanics and its computer-science equivalent, the quadratic unconstrained binary optimization ([QUBO](https://en.wikipedia.org/wiki/Quadratic_unconstrained_binary_optimization)) problem. Given $N$ variables $x_1,...,x_N$, where each variable $x_i$ can have binary values $0$ or $1$, the system finds assignments of values that minimize the QUBO,\n", "\n", @@ -50,7 +51,7 @@ "\n", "where $q_i$ and $q_{i,j}$ are configurable (linear and quadratic) coefficients. \n", "\n", - "Such [objective functions](https://docs.ocean.dwavesys.com/en/stable/concepts) can be represented by graphs. A graph comprises a collection of nodes, representing variables, and edges representing the connections between them. For example, a Boolean AND, $z \\Leftrightarrow x_1 \\wedge x_2$, expressed in [QUBO formulation](https://docs.dwavesys.com/docs/latest/c_handbook_3.html) as, \n", + "Such [objective functions](https://docs.ocean.dwavesys.com/en/stable/concepts) can be represented by graphs. A graph comprises a collection of nodes, representing variables, and edges representing the connections between them. For example, a Boolean AND, $z \\Leftrightarrow x_1 \\wedge x_2$, expressed in [QUBO formulation](https://docs.dwavesys.com/docs/latest/handbook_reformulating.html) as, \n", "\n", "$x_1 x_2 - 2(x_1+x_2)z +3z$, \n", "\n", @@ -157,7 +158,8 @@ "\n", "To demonstrate the benefits of the Pegasus topology, the following subsections compare its performance with that of the Chimera. This is done by generating and embedding many random graphs that are representative of problems of sizes commensurate with the size of a DW-2000Q QPU. \n", "\n", - "
The demonstrations of this section do not submit problems to a D-Wave system for solution, and so are not associated with a cost for QPU usage time.
\n", + "\n", + "
The demonstrations of this section do not submit problems to a D-Wave system for solution, and so are not associated with a cost for QPU usage time.
\n", "\n", "The next three code cells import three functions used throughout this section. You can see (and modify) the code for these functions by selecting Jupyter File Explorer View from the Online Learning page.\n", "\n", @@ -205,7 +207,9 @@ "source": [ "The second function, `try_embedding`, uses one of Ocean's embedding tools to find a minor-embedding for a given problem. You can configure the number or attempts this heuristic algorithm makes, `tries`, and a timeout value for those attempts, `timeout`. \n", "\n", - "
You can also update the code (located in the helpers folder for this notebook) to configure additional embedding parameters, described here: minorminer.
\n", + "> **NOTE:** You can also update the code (located in the `helpers` folder for this notebook) to configure \n", + " additional embedding parameters, described here: [minorminer](https://docs.ocean.dwavesys.com/en/stable/docs_minorminer/source/sdk_index.html)\n", + "\n", "Run it on the graph you generated in the previous code cell:" ] }, @@ -231,7 +235,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `try_embedding` function returns for both QPU topologies the longest chain it needed for the embedding. As mentioned above, for a group of qubits to act as a chain, you need to strongly couple them so that they tend to return a single value for the variable the chain represents. In this context \"strong\" is relative to values used for the problem's quadratic interactions, which are also represented by coupling strengths. Because coupling values have a finite range, relatively strong, long chains can come at the [cost](https://docs.dwavesys.com/docs/latest/c_handbook_6.html) of a smaller range of coupling strengths for representing the problem's quadratic interactions. \n", + "The `try_embedding` function returns for both QPU topologies the longest chain it needed for the embedding. As mentioned above, for a group of qubits to act as a chain, you need to strongly couple them so that they tend to return a single value for the variable the chain represents. In this context \"strong\" is relative to values used for the problem's quadratic interactions, which are also represented by coupling strengths. Because coupling values have a finite range, relatively strong, long chains can come at the [cost](https://docs.dwavesys.com/docs/latest/handbook_embedding.html) of a smaller range of coupling strengths for representing the problem's quadratic interactions. \n", "\n", "The last of the three functions,`embedding_loop`, runs the two previous ones and saves some of the parameters and results in a [pandas](https://pandas.pydata.org/pandas-docs/stable/index.html) data structure for convenient analysis." ] @@ -284,9 +288,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ + " \n", "

Important: Loops that run multiple attempts at embeddings on multiple graphs, some of them big, can take minutes to execute. To reduce runtimes, the code cells below run by default on quarter-sized, C8 and P8, graphs. You can run on the full-sized C16 and P16 graphs by setting the flag fast_run=False in the code cells below.

\n", "\n", - "

Note: In this and similar code cells below, you can shorten the runtime by setting a lower value to the problems parameter, which represents the number of graphs of each size, and/or modifying the loop variable, nodes, to fewer and smaller values.

You can also modify the embedding_timeout and embedding_tries parameters used to configure the minorminer embedding heuristic.

" + "> **Note:** In this and similar code cells below, you can shorten the runtime by setting a lower value to the \n", + " `problems` parameter, which represents the number of graphs of each size, and/or modifying the loop variable, \n", + " `nodes`, to fewer and smaller values. You can also modify the `embedding_timeout` and `embedding_tries` parameters\n", + " used to configure the\n", + " [minorminer](https://docs.ocean.dwavesys.com/en/stable/docs_minorminer/source/sdk_index.html) embedding heuristic." ] }, { @@ -515,7 +524,9 @@ "\n", "\n", "\n", - "
Note that if your problems are represented by sparse graphs, using a clique embedding can be (1) wasteful of qubits, needlessly limiting the size of problem you can embed and (2) result in longer chains and possibly lower-quality solutions.
" + "> **Note:** If your problems are represented by sparse graphs, using a clique embedding can be (1) wasteful of \n", + " qubits, needlessly limiting the size of problem you can embed and (2) result in longer chains and possibly \n", + " lower-quality solutions." ] }, { @@ -528,7 +539,9 @@ "QPU architecture is described in more detail in the [documentation](https://docs.dwavesys.com/docs/latest/c_gs_4.html) and below; for now it's sufficient to know that the Chimera topology's structure is a grid of unit cells, each with four horizontal qubits connected to four vertical qubits via couplers. Graphs that can be split into two sets of vertices, with all vertices of one set connected to all vertices of the second, are known as *bicliques* or complete bipartite graphs; a Chimera unit cell is a $K_{4,4}$ [biclique](https://en.wikipedia.org/wiki/Complete_bipartite_graph). Unit cells are tiled vertically and horizontally with adjacent qubits connected, creating a lattice of sparsely connected qubits.\n", "\n", "The figure below shows a C3 $3x3$ lattice of Chimera unit cells.\n", + "\n", "\n", + "\n", "If repeated structures of a problem can be embedded in a unit cell, you might then be able to duplicate that across unit cells and interconnect these in a very efficient overall embedding. " ] },