Skip to content

Commit

Permalink
FIx a bunch of badly formatted equations
Browse files Browse the repository at this point in the history
  • Loading branch information
Q-lds authored Apr 29, 2023
1 parent bf7c718 commit 3282643
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion docs/problems/knapsack.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ $$\begin{equation}

Now that we have an equality constraint, the corresponding QUBO formulation is retrieved by turning the constraint into a so-called quadratic penalty. That is, the cost function is

$$C(\textbf{x}, \vec{y}) = -\sum_{i=0}^n v_i x_i + P\Big(\sum_{i=1}^n w_i x_i + \sum_{k=0}^k 2^i y_i- W\Big)^2,$$
$$
C(\textbf{x}, \vec{y}) = -\sum_{i=0}^n v_i x_i + P\Big(\sum_{i=1}^n w_i x_i + \sum_{k=0}^k 2^i y_i- W\Big)^2,
$$
where $\textbf{x} = \{0,1\}^n, \ \ \vec{y} = \{0, 1\}^k$.

This cost function can be converted in the form of an Ising formulation (so that variables take values in $\{-1, 1\}$) in order to be used with the QAOA algorithm (see [what-is-a-qubo](/problems/what-is-a-qubo)).
Expand Down
7 changes: 4 additions & 3 deletions docs/problems/minimum-vertex-cover.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ The Minimum Vertex Cover (MVC) problem is a common constrained optimization prob
## The Cost Function

The corresponding function to minimize can be derived as:
$$\begin{equation*}
C(\textbf{x}) = \sum_{i \in V}x_i + P\sum_{(i, j) \in E}\left(1-x_i\right)\left(1-x_j\right),
\end{equation*}$$
$$
C(\textbf{x}) = \sum_{i \in V}x_i + P\sum_{(i, j) \in E}\left(1-x_i\right)\left(1-x_j\right),
$$

where $\boldsymbol{x}\in \{0, 1\}^{|V|}$ and $P>1$ is a parameter controlling the strength of penalization of configurations which are not covers.

Interpreting a variable $x_i$ being equal to 1 as being part of the vertex cover, the first summation counts the size of the selected cover while the second summation ensures that the selected cover indeed covers all edges. Hence, minimizing it ensures we find the minimum vertex cover.
Expand Down
4 changes: 2 additions & 2 deletions docs/problems/number-partition.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ For example, given the set of numbers $S=\{1, 2, 3, 6, 10\}$, one can find that

The function to minimize can be defined as

$$C(\boldsymbol{\sigma}) = \left(\sum_{i=1}^k n_i\sigma_i\right)^2 = \sum_{i, j=1}^kn_in_j\sigma_i\sigma_j,$$
$$C(\sigma) = \left(\sum_{i=1}^k n_i\sigma_i\right)^2 = \sum_{i, j=1}^kn_in_j\sigma_i\sigma_j,$$

where $\boldsymbol{\sigma}\in \{-1, 1\}^k$. That is, a variable $\sigma_i$ is attached to each number $n_i$, and the variable's value determines on which side of the partition the number is assigned to. The smallest value $C(\cdot)$ can take is 0, which happens when $\boldsymbol{\sigma}$ is a perfect partition.
where $\sigma \in \{-1, 1\}^k$. That is, a variable $\sigma_i$ is attached to each number $n_i$, and the variable's value determines on which side of the partition the number is assigned to. The smallest value $C(\cdot)$ can take is 0, which happens when $\sigma$ is a perfect partition.

Since this formulation is already in terms of Ising variables, it can be used directly in QAOA.

Expand Down

0 comments on commit 3282643

Please sign in to comment.