Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.

Fix some VS Code formatting problems #17

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions 01-hybrid-computing-getting-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"\n",
"## Prerequisite Knowledge\n",
"\n",
"These notebooks assume basic familiarity with [Ocean Software](https://docs.ocean.dwavesys.com/en/stable/index.html) and its binary quadratic model ([BQM](https://docs.ocean.dwavesys.com/en/stable/concepts/bqm.html)) approach to formulating problems on quantum computers. [Leap's](https://cloud.dwavesys.com/leap) *Structural Imbalance* and *Factoring* Jupyter Notebooks are good introductions to the basics of solving problems on a quantum computer, as is the [Getting Started with the D-Wave System](https://docs.dwavesys.com/docs/latest/doc_getting_started.html) guide. For an introduction to Ocean software, see [Ocean Software documentation](https://docs.ocean.dwavesys.com/en/stable/getting_started.html#gs). "
"These notebooks assume basic familiarity with [Ocean Software](https://docs.ocean.dwavesys.com/en/stable/index.html) and its binary quadratic model ([BQM](https://docs.ocean.dwavesys.com/en/stable/concepts/bqm.html)) approach to formulating problems on quantum computers. The [Structural Imbalance](https://github.com/dwave-examples/structural-imbalance-notebook) and [Factoring](https://github.com/dwave-examples/factoring-notebook) Jupyter Notebooks are good introductions to the basics of solving problems on a quantum computer, as is the [Getting Started with the D-Wave System](https://docs.dwavesys.com/docs/latest/doc_getting_started.html) guide. For an introduction to Ocean software, see [Ocean Software documentation](https://docs.ocean.dwavesys.com/en/stable/getting_started.html#gs). "
]
},
{
Expand Down Expand Up @@ -66,16 +66,17 @@
"\n",
"<img src=\"images/cover.png\" width=200x>\n",
"\n",
"Such a graph might represent the problem of [antenna selection](https://github.com/dwave-examples/antenna-selection), finding good coverage for a sprinkler system, or many other real-world optimization problems. If the graph represents a sprinkler system, with edges corresponding to overlaps in sprinklers' watering, a [maximum independent set](https://en.wikipedia.org/wiki/Independent_set_(graph_theory)) solves the problem of watering a lawn evenly with the lowest number of sprinklers. "
"Such a graph might represent the problem of [antenna selection](https://github.com/dwave-examples/antenna-selection), finding good coverage for a sprinkler system, or many other real-world optimization problems. If the graph represents a sprinkler system, with edges corresponding to overlaps in sprinklers' watering, a [maximum independent set](https://w.wiki/4zwn) solves the problem of watering a lawn evenly with the lowest number of sprinklers. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The first code cell below uses [networkx](https://networkx.github.io) to build a random sparse graph&mdash;the `random_geometric_graph()` function places uniformly at random a specified number of nodes, `problem_node_count`, in a unit cube, joining edges of any two if the distance is below a given `radius`&mdash;and utility graphics code to plot it. To see this graphics code, select **Jupyter File Explorer View** from the Online Learning page and navigate to the folder for this notebook.\n",
"The first code cell below uses [networkx](https://networkx.github.io) to build a random sparse graph&mdash;the `random_geometric_graph()` function places uniformly at random a specified number of nodes, `problem_node_count`, in a unit cube, joining edges of any two if the distance is below a given `radius`&mdash;and utility graphics code to plot it. To see this graphics code, navigate to the `helpers` folder of this repository.\n",
"\n",
"<div class=\"alert alert-warning\" role=\"alert\" style=\"margin: 10px\">Note: Problem size (nodes and density of edges) selected below ensures that runtimes on compute resources (virtual CPUs) provided by the Leap environment do not exceed a few minutes.</div>"
"<style>.alert-info {color: #0399A9; background: #B2EBF3; border: 2px solid #4FD1E1; }</style>\n",
"<div class=\"alert alert-info\" role=\"alert\" style=\"margin: 10px\">Note: Problem size (nodes and density of edges) selected below ensures that runtimes on compute resources (virtual CPUs) provided by the Leap environment do not exceed a few minutes.</div>"
]
},
{
Expand Down Expand Up @@ -127,7 +128,8 @@
"\n",
"This section provides a demonstration of using a Leap hybrid solver.\n",
"\n",
"<div class=\"alert alert-warning\" role=\"alert\" style=\"margin: 10px\">Note: Not all accounts have access to this type of solver. This is the only section of the Hybrid Computing notebooks that uses these solvers&mdash;if you do not see solvers in the Hybrid section of Supported Solvers in your Leap dashboard, skip to the next section. </div>"
"<style>.alert-warning {color: #F67C00; background: #FFE0B2; border: 2px solid #FFC165;}</style>\n",
"<div class=\"alert alert-warning\" role=\"alert\" style=\"margin: 10px\">Note: Not all accounts have access to this type of solver. This is the only section of the Hybrid Computing notebooks that uses these solvers&mdash;if you do not see solvers in the Hybrid section of Solvers in your Leap dashboard, skip to the next section. </div>"
]
},
{
Expand Down
14 changes: 8 additions & 6 deletions 02-hybrid-computing-workflows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
"# A Sample Problem\n",
"This section recreates the [Quantum-Classical Hybrid Computing: Getting Started](01-hybrid-computing-getting-started.ipynb) problem for use in the following sections. \n",
"\n",
"<div class=\"alert alert-warning\" role=\"alert\" style=\"margin: 10px\">Note: Problem size (nodes and density of edges) selected below ensures that runtimes on compute resources (virtual CPUs) provided by the Leap environment do not exceed a few minutes.</div>\n",
"<style>.alert-info {color: #0399A9; background: #B2EBF3; border: 2px solid #4FD1E1;}</style>\n",
"<div class=\"alert alert-info\" role=\"alert\" style=\"margin: 10px\">Note: Problem size (nodes and density of edges) selected below ensures that runtimes on compute resources (virtual CPUs) provided by the Leap environment do not exceed a few minutes.</div>\n",
"\n",
"<div class=\"alert alert-warning\" role=\"alert\" style=\"margin: 10px\">Note: The code cell below imports from <code>helpers</code>, a folder colocated with this Jupyter Notebook. Users running it in <a href=\"https://cloud.dwavesys.com/leap\">Leap</a> can see helper functions by selecting <i>Jupyter File Explorer View</i> on the <i>Online Learning</i> page.</div>"
"> **Note:** The code cell below imports from the `helpers` module. To see this code, navigate to the `helpers` folder \n",
" of this repository."
]
},
{
Expand Down Expand Up @@ -210,6 +212,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<style>.alert-success {color: #388E3C; background: #C8E6C9; border: 2px solid #81C784;}</style>\n",
"<div class=\"alert alert-success\" role=\"alert\" style=\"margin: 10px\"> \n",
" <b>Exercise:</b> By default, TabuProblemSampler runs for 100 ms. In the placeholder code cell below, modify the previous example to increase the timeout <a href=\"https://docs.ocean.dwavesys.com/en/stable/docs_hybrid/reference/samplers.html\">parameter</a> or the tabu tenure and see if that produces a better solution. \n",
"</div>"
Expand Down Expand Up @@ -258,9 +261,7 @@
"source": [
"<div class=\"alert alert-success\" role=\"alert\" style=\"margin: 10px\"> \n",
" <b>Exercise:</b> Use the Runnable Lambda to add an \"info\" field to an input state.\n",
"\n",
"<p>Hint 1: <a href=\"https://docs.ocean.dwavesys.com/en/stable/docs_hybrid/reference/flow.html\">Lambda</a> creates a Runnable on the fly. You can use <code>Lambda(next)</code>&mdash;where callable <code>next</code> can be a lambda expression that accepts the Runnable instance and state instance&mdash;to process an input state. For example, <code>hybrid.Lambda(lambda _, s: s)</code>, like the <code>Identity</code> used above, returns a copy of the input state.</p><p>Hint 2: For this exercise, use the <a href=\"https://docs.ocean.dwavesys.com/en/stable/docs_hybrid/reference/core.html\">State</a> method <code>updated()</code> that returns a copy of a state updated from specified arguments.</p>\n",
"</div>"
" <p>Hint 1: <a href=\"https://docs.ocean.dwavesys.com/en/stable/docs_hybrid/reference/flow.html\">Lambda</a> creates a Runnable on the fly. You can use <code>Lambda(next)</code>&mdash;where callable <code>next</code> can be a lambda expression that accepts the Runnable instance and state instance&mdash;to process an input state. For example, <code>hybrid.Lambda(lambda _, s: s)</code>, like the <code>Identity</code> used above, returns a copy of the input state.</p><p>Hint 2: For this exercise, use the <a href=\"https://docs.ocean.dwavesys.com/en/stable/docs_hybrid/reference/core.html\">State</a> method <code>updated()</code> that returns a copy of a state updated from specified arguments.</p></div>"
]
},
{
Expand Down Expand Up @@ -338,7 +339,8 @@
"<p>Hint: You have seen that the samples field of a state is of type <a href=\"https://docs.ocean.dwavesys.com/en/stable/docs_dimod/reference/sampleset.html\">dimod SampleSet</a>, which has methods to convert from samples, and state has its own convenience method, <code>from_sample</code>, for constructing a state from a raw (dict) sample.</p> \n",
"</div>\n",
"\n",
"<div class=\"alert alert-warning\" role=\"alert\" style=\"margin: 10px\">Note: When using a hybrid tabu sampler, be sure to correctly configure how it expands input-state samples into its initial states.</div>"
"> **Note:** When using a hybrid tabu sampler, be sure to correctly configure how it expands input-state samples into \n",
" its initial states."
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion 03-hybrid-computing-components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"# A Sample Problem\n",
"This section recreates the [Quantum-Classical Hybrid Computing: Getting Started](01-hybrid-computing-getting-started.ipynb) problem for use in the following sections. \n",
"\n",
"<div class=\"alert alert-warning\" role=\"alert\" style=\"margin: 10px\">Note: Problem size (nodes and density of edges) selected below ensures that runtimes on compute resources (virtual CPUs) provided by the Leap environment do not exceed a few minutes.</div>"
"<style>.alert-info {color: #0399A9; background: #B2EBF3; border: 2px solid #4FD1E1;}</style>\n",
"<div class=\"alert alert-info\" role=\"alert\" style=\"margin: 10px\">Note: Problem size (nodes and density of edges) selected below ensures that runtimes on compute resources (virtual CPUs) provided by the Leap environment do not exceed a few minutes.</div>"
]
},
{
Expand Down Expand Up @@ -388,6 +389,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<style>.alert-success {color: #388E3C; background: #C8E6C9; border: 2px solid #81C784;}</style>\n",
"<div class=\"alert alert-success\" role=\"alert\" style=\"margin: 10px\"> \n",
" <b>Exercise:</b> In the placeholder code cell below, modify <code>IncrementCount</code> to also print the state's best energy. Test your code in the EXERCISE TEST CELL below.\n",
" <p>Note: a <code>samples</code> field is present in the tested input state, <code>state_count_0</code>, and for simplicity, assume this is always the case. In the <i>Adding Custom Traits</i> subsection below, you will see how to ensure this is always the case.</p></div>"
Expand Down