Skip to content

Fix typos in tutorials #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion docs/tutorials/01_quadratic_program.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
"metadata": {},
"source": [
"You can substitute some of variables with constants or other variables.\n",
"More precicely, `QuadraticProgram` has a method `substitute_variables(constants=..., variables=...)` to deal with the following two cases.\n",
"More precisely, `QuadraticProgram` has a method `substitute_variables(constants=..., variables=...)` to deal with the following two cases.\n",
"- $x \\leftarrow c$: when `constants` have a dictionary `{x: c}`. \n",
"- $x \\leftarrow c y$: when `variables` have a dictionary `{x: (y, c)}`."
]
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/02_converters_for_quadratic_programs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"source": [
"After converting, the formulation of the problem looks like as the follows. As we can see, the inequality constraints are replaced with equality constraints with additional integer slack variables, $xyz\\_leg\\text{@}int\\_slack$ and $xyz\\_geq\\text{@}int\\_slack$. \n",
"\n",
"Let us explain how the conversion works. For example, the lower bound of the left side of the first constraint is $0$ which is the case of $x=0$, $y=0$, and $z=0$. Thus, the upperbound of the additional integer variable must be $5$ to be able to satisfy even the case of $x=0$, $y=0$, and $z=0$. Note that we cut off the part after the decimla point in the converted formulation since the left side of the first constraint in the original formulation can be only integer values. For the second constraint, basically we apply the same approach. However, the symol in the second constraint is $\\geq$, so we add minus before $xyz\\_geq\\text{@}int\\_slack$ to be able to satisfy even the case of $x=1, y=1$, and $z=7$.\n",
"Let us explain how the conversion works. For example, the lower bound of the left side of the first constraint is $0$ which is the case of $x=0$, $y=0$, and $z=0$. Thus, the upperbound of the additional integer variable must be $5$ to be able to satisfy even the case of $x=0$, $y=0$, and $z=0$. Note that we cut off the part after the decimal point in the converted formulation since the left side of the first constraint in the original formulation can be only integer values. For the second constraint, basically we apply the same approach. However, the symbol in the second constraint is $\\geq$, so we add minus before $xyz\\_geq\\text{@}int\\_slack$ to be able to satisfy even the case of $x=1, y=1$, and $z=7$.\n",
"\n",
"\\begin{aligned}\n",
" & \\text{maximize}\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/03_minimum_eigen_optimizer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"metadata": {},
"source": [
"An interesting class of optimization problems to be addressed by quantum computing are Quadratic Unconstrained Binary Optimization (QUBO) problems.\n",
"Finding the solution to a QUBO is equivalent to finding the ground state of a corresponding Ising Hamiltonian, which is an important problem not only in optimization, but also in quantum chemistry and physics. For this translation, the binary variables taking values in $\\{0, 1\\}$ are replaced by spin variables taking values in $\\{-1, +1\\}$, which allows to replace the resulting spin variables by Pauli Z matrices, and thus, an Ising Hamiltonian. For more details on this mapping we refere to [1].\n",
"Finding the solution to a QUBO is equivalent to finding the ground state of a corresponding Ising Hamiltonian, which is an important problem not only in optimization, but also in quantum chemistry and physics. For this translation, the binary variables taking values in $\\{0, 1\\}$ are replaced by spin variables taking values in $\\{-1, +1\\}$, which allows to replace the resulting spin variables by Pauli Z matrices, and thus, an Ising Hamiltonian. For more details on this mapping we refer to [1].\n",
"\n",
"Qiskit provides automatic conversion from a suitable `QuadraticProgram` to an Ising Hamiltonian, which then allows to leverage all the `MinimumEigenSolver` such as\n",
"- `VQE`,\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/05_admm_optimizer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"The algorithm 3-ADMM-H works as follows:\n",
"\n",
"0. Initialization phase (set the parameters and the QUBO and convex solvers);\n",
"1. For each ADMM iterations ($k = 1, 2, \\ldots, $) untill termination:\n",
"1. For each ADMM iterations ($k = 1, 2, \\ldots, $) until termination:\n",
" - Solve a properly defined QUBO subproblem (with a classical or quantum solver);\n",
" - Solve properly defined convex problems (with a classical solver);\n",
" - Update the dual variables.\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/06_examples_max_cut_and_tsp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"\n",
"### Approximate Universal Quantum Computing for Optimization Problems\n",
"\n",
"There has been a considerable amount of interest in recent times about the use of quantum computers to find a solution to combinatorial optimization problems. It is important to say that, given the classical nature of combinatorial problems, exponential speedup in using quantum computers compared to the best classical algorithms is not guaranteed. However, due to the nature and importance of the target problems, it is worth investigating heuristic approaches on a quantum computer that could indeed speed up some problem instances. Here we demonstrate an approach that is based on the *Quantum Approximate Optimization Algorithm* (QAOA) by Farhi, Goldstone, and Gutman (2014). We frame the algorithm in the context of *approximate quantum computing*, given its heuristic nature. \n",
"There has been a considerable amount of interest in recent times about the use of quantum computers to find a solution to combinatorial optimization problems. It is important to say that, given the classical nature of combinatorial problems, exponential speedup in using quantum computers compared to the best classical algorithms is not guaranteed. However, due to the nature and importance of the target problems, it is worth investigating heuristic approaches on a quantum computer that could indeed speed up some problem instances. Here we demonstrate an approach that is based on the *Quantum Approximate Optimization Algorithm* (QAOA) by Farhi, Goldstone, and Gutmann (2014). We frame the algorithm in the context of *approximate quantum computing*, given its heuristic nature. \n",
"\n",
"The algorithm works as follows:\n",
"\n",
Expand Down Expand Up @@ -97,7 +97,7 @@
"### Application classes\n",
"\n",
"We use the application classes for the max-cut problem and the traveling salesman problem in this page. There are application classes for other optimization problems available as well.\n",
"See [Application Classes for Optimziation Problems](09_application_classes.ipynb) for details."
"See [Application Classes for Optimization Problems](09_application_classes.ipynb) for details."
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/07_examples_vehicle_routing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"\n",
"## The Introduction\n",
"\n",
"Logistics is a major industry, with some estimates valuing it at USD 8183 billion globally in 2015. Most service providers operate a number of vehicles (e.g., trucks and container ships), a number of depots, where the vehicles are based overnight, and serve a number of client locations with each vehicle during each day. There are many optimization and control problems that consider these parameters. Computationally, the key challenge is how to design routes from depots to a number of client locations and back to the depot, so as to minimize vehicle-miles traveled, time spent, or similar objective functions. In this notebook we formalize an idealized version of the problem and showcase its solution using the quantum approximate optimization approach of Farhi, Goldstone, and Gutman (2014). \n",
"Logistics is a major industry, with some estimates valuing it at USD 8183 billion globally in 2015. Most service providers operate a number of vehicles (e.g., trucks and container ships), a number of depots, where the vehicles are based overnight, and serve a number of client locations with each vehicle during each day. There are many optimization and control problems that consider these parameters. Computationally, the key challenge is how to design routes from depots to a number of client locations and back to the depot, so as to minimize vehicle-miles traveled, time spent, or similar objective functions. In this notebook we formalize an idealized version of the problem and showcase its solution using the quantum approximate optimization approach of Farhi, Goldstone, and Gutmann (2014). \n",
"\n",
"The overall workflow we demonstrate comprises:\n",
"\n",
Expand Down Expand Up @@ -79,7 +79,7 @@
"\n",
"## Quantum solution\n",
"\n",
"Here, we demonstrate an approach that combines classical and quantum computing steps, following the quantum approximate optimization approach of Farhi, Goldstone, and Gutman (2014). In particular, we use the variational quantum eigensolver (VQE). We stress that given the use of limited depth of the quantum circuits employed (variational forms), it is hard to discuss the speed-up of the algorithm, as the solution obtained is heuristic in nature. At the same time, due to the nature and importance of the target problems, it is worth investigating heuristic approaches, which may be worthwhile for some problem classes. \n",
"Here, we demonstrate an approach that combines classical and quantum computing steps, following the quantum approximate optimization approach of Farhi, Goldstone, and Gutmann (2014). In particular, we use the variational quantum eigensolver (VQE). We stress that given the use of limited depth of the quantum circuits employed (variational forms), it is hard to discuss the speed-up of the algorithm, as the solution obtained is heuristic in nature. At the same time, due to the nature and importance of the target problems, it is worth investigating heuristic approaches, which may be worthwhile for some problem classes. \n",
"\n",
"Following [5], the algorithm can be summarized as follows:\n",
"- Preparation steps: \n",
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/09_application_classes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Application Classes for Optimziation Problems"
"# Application Classes for Optimization Problems"
]
},
{
Expand All @@ -31,12 +31,12 @@
"6. Graph partition problem\n",
" - Given an undirected graph, find a partition into two components whose sizes are equal such that the total capacity of the edges between the two components is minimized.\n",
"7. Max-cut problem\n",
" - Given an undirected graph, find a partition of nodes into two subsets such that the total weight of the edges between the two subsets is maximimized. \n",
" - Given an undirected graph, find a partition of nodes into two subsets such that the total weight of the edges between the two subsets is maximized. \n",
"8. Stable set problem\n",
" - Given an undirected graph, find a subset of nodes such that no edge connects the nodes in the subset and the number of nodes is maximized.\n",
"9. Traveling salesman problem\n",
" - Given a graph, find a route with the minimum distance such that the route visits each city exacly once.\n",
"10. Vechile routing problem\n",
" - Given a graph, find a route with the minimum distance such that the route visits each city exactly once.\n",
"10. Vehicle routing problem\n",
" - Given a graph, a depot node, and the number of vehicles (routes), find a set of routes such that each node is covered exactly once except the depot and the total distance of the routes is minimized.\n",
"11. Vertex cover problem\n",
" - Given an undirected graph, find a subset of nodes with the minimum size such that each edge has at least one endpoint in the subsets.\n",
Expand All @@ -49,9 +49,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We introdcue examples of the vertex cover problem and the knapsack problem in this page.\n",
"We introduce examples of the vertex cover problem and the knapsack problem in this page.\n",
"\n",
"Examples of the max-cut problem and the traveling salesman problem are avaiable in [Max-Cut and Traveling Salesman Problem](06_examples_max_cut_and_tsp.ipynb)."
"Examples of the max-cut problem and the traveling salesman problem are available in [Max-Cut and Traveling Salesman Problem](06_examples_max_cut_and_tsp.ipynb)."
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/10_warm_start_qaoa.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@
"id": "tropical-armstrong",
"metadata": {},
"source": [
"Next, we create the mixer operator for QAOA. When warm-starting QAOA we must ensure that the mixer operator has the initial state as gound state. We therefore chose the Hamiltonian\n",
"Next, we create the mixer operator for QAOA. When warm-starting QAOA we must ensure that the mixer operator has the initial state as ground state. We therefore chose the Hamiltonian\n",
"\n",
"\\begin{align}\n",
"H_{M,i}^{(ws)}=\n",
Expand Down Expand Up @@ -615,7 +615,7 @@
"source": [
"## Warm-start QAOA\n",
"\n",
"The warm-start features above are available in the Qiskit optimization module as a single optimizer named `WarmStartQAOAOptimizer` which is illustrated below. This solver will solve a QUBO with a warm-start QAOA. It computs $c^*$ by relaxing the problem. This behaviour is controlled by setting `relax_for_pre_solver` to `True`."
"The warm-start features above are available in the Qiskit optimization module as a single optimizer named `WarmStartQAOAOptimizer` which is illustrated below. This solver will solve a QUBO with a warm-start QAOA. It computes $c^*$ by relaxing the problem. This behaviour is controlled by setting `relax_for_pre_solver` to `True`."
]
},
{
Expand Down