In this section, we review QAOA, dualization, and the 3-SAT problem.
2.1. QAOA
In order to use QAOA to solve a CO problem, we apply two operators,
and
, in succession on an initial state. The initial state is the uniform superposition,
, where the sum is over the computation basis
. The outcome of one iteration of QAOA is
Here
C encodes the problem to be solved and
B is a mixing operator. Often,
C is the sum over a collection of clauses,
, and
B is typically
, where
is the Pauli-X operator acting on the
qubit. For more detail about QAOA, see [
1,
2,
20].
There is a direct correlation between the circuit depth and level of noise in a quantum circuit [
21,
22,
23], so it is important to consider the circuit depth when developing a circuit that implements QAOA. Throughout this paper, we use unitary circuit depth to mean the depth of the unitary operators needed in a circuit. The actual circuit depth would be the unitary circuit depth times the number of gates needed to implement each operator. In the next subsection, we review dualization and the related previous work that determines the unitary circuit depth of one iteration of QAOA.
2.2. Dualization and Unitary Circuit Depth
Previously [
14], we considered the method of dualizing constraints to solve CO problems of the form
where
is contained in the collection of polynomial constraints
P. Both
and
c are polynomial functions in
and
. We eliminate constraints via dualization by subtracting
from both sides, adding in slack variables, squaring both sides, and adding the new expression to the objective function [
14]. The
derived (hyper)graph from dualization is one in which there is a vertex for each variable and (hyper)edges between variables that appear in a monomial together. For example, if
appears in the dualization, there is an edge between vertices
and
.
In graph theory, a proper edge coloring of a graph is a function
such that if two edges share a vertex, they receive different values, e.g.,
and
,
. Given the set
, each element of this set can be thought of as a color, hence the name edge coloring. The smallest number
m such that a proper edge coloring of a graph
G is possible with
m colors is denoted
and called either the chromatic index or the edge chromatic number. It has been shown that chromatic index of the derived (hyper)graph is directly related to the unitary circuit depth of one iteration of QAOA, if the size of each monomial in the objective function is at most the gate size the hardware can support [
14]. In particular, the following theorem holds:
Theorem 1.
Let H be the hypergraph derived from a combinatorial optimization problem instance. Every proper edge coloring of H corresponds to a valid circuit for a , where the unitary depth of the shallowest circuit is .
Unitary Circuit Depth Example: MaxCut
We will consider MaxCut as an example for how to construct a quantum circuit with minimal unitary depth. This process applies when determining the unitary circuit depth for QAOA to solve a general combinatorial optimization problem. Consider the triangle graph, which consists of three vertices that are pairwise adjacent, as seen in
Figure 1. In the combinatorial optimization problem MaxCut, the vertices of a graph,
, are partitioned into two sets such that the number of edges with an end point in each set is maximized. This problem can be formulated as
In order to solve MaxCut on the triangle graph, we want to minimize
There are three vertices in the derived graph for this function, namely
and
. There are also three edges, which are
,
, and
. Thus, the derived graph for this combinatorial optimization problem is also a triangle. To calculate the unitary circuit depth, we will properly edge color this graph in
Figure 2. This graph requires three colors to be properly edge colored. Since each edge color class must be implemented in series, the unitary circuit depth is four, which is seen in
Figure 3.
2.3. SAT
A Boolean satisfiability problem (SAT) is one type of CO problem that has the form of Equations (
1)–(3). It is defined by a collection of clauses,
C, consisting of
N literals. The goal is to determine if the values TRUE or FALSE can be assigned to each literal in a clause such that every clause is TRUE. This problem is classically NP-complete [
24], even when each clause contains only three literals. When each clause contains precisely three literals, the problem is known as a 3-SAT problem. We will use 3-SAT as the key example throughout the paper. Each clause has the form
where
. Now, we look at two formulations of 3-SAT problems.
2.3.1. SAT Linear Formulation
Let
be the collection of variables indicating if clause
c is satisfied, and
be the indicator variable denoting if literal
i is satisfied. Let
be the set of literals that must be true to satisfy
c, and
the rest. Then, 3-SAT can be written as
Equation (5) has this form because 3-SAT is defined to have only OR conditions, so at least one must be satisfied when . Standard QAOA does not have a way to incorporate constraints; we therefore adopt the aforementioned strategy of dualizing the constraints to yield an unconstrained optimization problem suitable for QAOA as follows.
Before we can dualize Equation (5), we must change the inequality so it matches that of Equation (2). We therefore take the contrapositive of each constraint so Equation (5) has the form
. We can express this constraint as an equality,
by introducing two slack variables
and
that guarantee equality holds for any choice of
satisfying the constraint.
The quantity
is equal to zero when the constraints are satisfied. 3-SAT can now be expressed as an unconstrained optimization problem by introducing
as a penalty term
where
is a large number [
25]. The variables
and
can take values of either 0 or 1, however, choices that violate
give penalties
. This ensures that the optimal solution is identical to the original constrained problem. Since we introduce two
variables and one
z per clause in the dualization, this formulation requires
ancillary qubits. The term
must be expanded in order to determine all of the edges of the derived graph.
The unitary circuit depth for one layer of QAOA is the chromatic index plus one, and the chromatic index is either the maximum degree of the derived graph, or the maximum degree of the derived graph plus one. Thus, the unitary circuit depth is either the maximum degree of the derived graph plus one or the maximum degree of the derived graph plus two.
To compute the maximum degree, let
be the set of clauses containing
. Then the degree of the
in the derived graph is
where
is the set of clauses containing both
and
. This value lies between
and
. The lower bound is because
is adjacent to both
variables and one
z per clause and the upper bound is because
can also be adjacent to distinct
and
in each clause. Notice that
and
. Since
for some
i, the maximum degree of the graph is
, so the unitary circuit depth for one layer of QAOA is either
or
.
2.3.2. SAT Product Formulation
Alternatively, SAT can be written as a product of monomials. To see this, note that
is satisfied if
. Thus, we can write SAT as the polynomial unconstrained binary optimization (PUBO) problem
where
indicates if literal
is satisfied. There are no ancillary qubits needed to write this PUBO, however expanding it does give monomials in three variables, as seen in
Table 1. A straightforward implementation of an
n variable monomial requires an
n-qubit gate, however, current hardware is often limited to two-qubit gates. We therefore need a method to decompose these large monomials into products of at most two variables.
2.4. Example: Linear and Product Formulations
Consider the 3-SAT problem
Labeling the indicator variable for the first clause
, the second
, and so on, we can write the objective function for this problem as
subject to the constraints
We consider the unitary circuit depth for one layer of QAOA to solve this problem. First, we look at the linear characterization found in
Section 2.3.1. Then, we look at the product formulation and compare the degrees of the resulting derived graphs to determine the unitary circuit depth for one layer of QAOA from each method, assuming three qubit gates are possible. We next devise a variable-substitution method to use the product formulation in
Section 2.5, and analyze the unitary circuit depth for a two-qubit gate implementation of the product formulation in
Section 2.5.3.
2.4.1. Linear Formulation
When we use the linear formulation of the above problem, the contrapositive of the simplified dualized constraint for the first clause is
In order to dualize the constraint, we add in two slack variables,
and
and change the inequality to equality to obtain
Upon squaring both sides, we get all terms of the form
,
,
,
, and
where
,
and
. The other clauses are handled similarly and the derived graph is found in
Figure 4. The degree of the vertex that is maximal in the derived graph is thirteen, so the unitary circuit depth is either fourteen or fifteen for one layer of QAOA.
2.4.2. Product Formulation
Instead of solving the linear formulation, each clause can be rewritten as a product of combinations of and . For Example 1, the first statement holds if and only if holds. Upon expanding, we get the expression . The other clauses are handled similarly. If there are three-qubit gates, this method requires no ancillary qubits.
Expanding the product formulation of a single 3-SAT clause results in a monomial that contains three variables and possibly one or more monomials in two variables. The variables that occur in degree two monomials are all contained in the three variable monomial. Since each monomial represents a gate that acts on the qubits contained in the monomial, we need only implement the three-qubit gates from each clause. Thus, we can eliminate all edges from the derived graph and are left with a hypergraph,
Figure 5. The unitary circuit depth is equal to the chromatic index of the hypergraph plus one.
2.5. Global Variable Substitution
The previous sections assume that three-qubit gates are possible on the hardware, however, that may not always be the case. Thus, we examine how to decompose monomials in three or more variables via a process called global variable substitution (GVS). In order to substitute variables, we require constraints on the problem to ensure the substitution is valid. We then eliminate the constraints via dualization and can determine the unitary circuit depth of one layer of QAOA.
Let us define a substitution of size s as one in which s variables are combined into one, e.g., . Throughout the remainder of this paper we use the boldface variable to refer to lists of indices, , where . A substitution is denoted . When we wish to refer to specific substitutions, we will specify indices of the variables, e.g., .
The goal of this work is to write an n variable monomial as a product of two variables. One variable replaces s of the variables of the original monomial, and another variable is substituted for the remaining . Since the order of the variables in each monomial is not important, we assume without loss of generality that the first s variables are substituted for one variable and the last for the other. In this formulation, we allow no overlap in the substitutions, i.e., if is a variable in the substitution of size s, then it is not a variable in the substitution of size .
In order to substitute a new variable
for
, we add in the constraints
where
denotes the number of variables
replaces and
, depending on if
takes the value of 0 or 1 for each
. The first constraint ensures that if
, then
, while the second guarantees that if
for some
i, then
. Note that
, so the two can be used interchangeably. After dualizing these constraints, we are able to determine the degree of each vertex in the derived graph. To facilitate the discussion, in Theorem 1 we focus only on the vertices and edges associated with the dualized substitution terms, which form a sub-graph of the total derived graph. We then show how these are related to the total derived graph and describe how to compute the unitary circuit depth for one layer of QAOA in
Section 2.5.2.
2.5.1. Degree of Substituted Variables
We now give a formula for the degrees of vertices
and
, as well as determine the contribution of each substitution to the degree of
. These degrees, in conjunction with the
terms, can be used to compute the unitary circuit depth, as shown explicitly in the example of
Section 2.5.3.
Theorem 2.
Let U denote the set of all substitutions made. Let us denote the set of substitutions containing as . For we let denote the number of variables substituted in substitution . The number of edges incident to each vertex in the derived graph due to the substitution is denoted and iswhere denotes the number of variables in Equation (7) for the substitution , is an indicator variable denoting whether or not , refers to the number of monomials containing which do not have any containing substituted, and refers to the number of monomials with more than two variables using the substitution .
Proof. First, we will consider the degree of each by counting the number of terms that contain in each dualized constraint. Note that in the first constraint, there are variables total, so of these are multiplied times a single term upon dualization. Thus, the degree of in this constraint is . In each of the following constraints, note that there are three variables: , and . Thus, the degree of from these constraints is 2. Since the terms in each constraint are different, they do not add, so .
Next, we consider the degree of each in the graph derived from the dualization. In the first constraint, there are terms containing each and there is exactly one constraint aside from the first that contains . This constraint only has two terms containing , but the contribution to the degree from this is one since the edge already exists in the graph from the first constraint. Now, we must consider how many contain as a variable. If there is more than one substitution containing , there are multiple constraints that have the form of the first one. Each of those constraints contain new variables and new variables since the substitutions are different. Thus, the only double counting that can happen is in products of , since these are the only other edges possible in the graph derived from the dualization. We must subtract the number of times each of these terms occurs in each constraint except for one. Additionally, we must count the clauses that contain but in which is not contained in a substitution, since it will be incident to the substitution in the derived graph. We denote the number of these clauses as . Then, .
Finally, we need to consider the degree of each substituted variable, . The first constraint contributes to the degree and the other constraints contribute 1 to the degree since the first constraint accounts for the terms. Finally, each is substituted into a clause, so is multiplied by the variable not contained in the substitution. We denote the number of clauses into which is substituted as . Thus, . □
The derived graph for the problem consists of variables and edges induced by the substitution, as well as variables and edges
that exist in the original problem. The variables specific to the substitutions,
and
, have degrees determined solely by Theorem 2. The chromatic index of the derived graph is the unitary circuit depth for one layer of QAOA, and the maximum of the degrees from Theorem 2 plus one provides a lower bound for this quantity. We show how to compute the exact unitary circuit depth in
Section 2.5.2, including the extra edge terms
.
2.5.2. 3-SAT
Notice that Theorem 2 reduces to
for 3-SAT since
,
, and
. This is the degree for each variable due to the substitution. In order to determine the total degree, we need to look at two variable terms in the expansions and add one to the degree for each unique term.
To compute the unitary circuit depth for one layer of QAOA, we must compute the maximum vertex degree in the derived graph. We focus here on the example of 3-SAT. A similar approach can be used to decompose other classes of combinatorial optimization problems. In order to calculate the total degree of a vertex in the derived graph from 3-SAT, we need to add the degrees of a vertex due to a substitution , from Theorem 2, to the degree from two vertex monomials that were not substituted. Since and are introduced in order to make the substitutions, their degrees are exactly the quantity in Theorem 2.
In order to count the number of edges induced by pairs that are not substituted, we define P as the set of all two variable monomials that result from the expansion of the product formulation of each clause in a 3-SAT instance. These two variable monomials will be denoted . For example, if we have the clauses and and the substitutions and are made, in this case, . The subset of P containing a vertex a is denoted . Here, , since is in each monomial, , and . Let .
These sets can be used to determine the number of edges incident to a vertex
that are from the two variable terms in the expansions of each clause, which we denote
. Let us fix variable
. Since
counts the number of two variable terms containing
, it is added to Theorem 2. If one of the two variable terms from the expansion of the clauses is substituted, i.e., if
and
is a substitution, then adding
to the degree double counts the edge
. Thus, the number of substitutions that appear in
need to be subtracted. If
is the set of substitutions containing variable
and
is an indicator variable that determines if the substitution
was used, the total degree of
is
where
.
The QAOA unitary circuit depth is then given as
, where
for 3-SAT. Note that
since the size of each substitution
and
, which also simplifies
. Furthermore, note that
, which simplifies
.
2.5.3. Example: Global Variable Substitution
To give an example of the GVS method, we will apply it to the product formulation of Example 1. We want to decompose the three-variable terms into two-variable terms by substituting a new variable to represent the product of the variables. In order to do so, we first choose substitutions and then create the derived graph. For Example 1, we substitute
and
. Thus, the first clause, which can be written as
is equal to
. With the substitution
, the edge
is already accounted for in the first constraint. We then need only add the edge between
and
to the derived graph since the monomial
exists in the expansion of the first clause. Note that each clause can be decomposed similarly and will end up with a sum of terms, at least one of which contains three variables, with the others containing one or two depending on the number of
expressions. The other edges that need to be added due to the two variable terms in the expansions are
,
,
and
. See
Table 1 for the contribution of unsubstituted monomials from a particular clause to
for a generic substitution
. The increase in degree ranges from 0 to 2, with the maximum addition being
for general
k-SAT.
Next, we list each constraint of the form Equations (
7) and (8) and dualize them. For the first clause
in the example,
When dualizing these constraints, the terms
are added to the objective function, up to constant
, and similar terms are added for the
substitution. Since all variables,
v, in the equations above have the value zero or one,
. The entire derived graph can be seen in
Figure 6. Note that the degrees match the theorem plus the number of edges induced by pairs that are not substituted. The largest degree vertex is
, which has degree eight, so the unitary circuit depth for one layer of QAOA is either nine or ten. This is less than the unitary circuit depth for the linear 3-SAT formulation and requires fewer ancillary qubits.
2.6. Optimizing Global Variable Substitutions for 3-SAT
As seen above, the number of substitutions impacts the degrees of the vertices. We want to minimize both the number of ancillary qubits and the maximum degree of the derived graph. This problem is difficult for large gates, but in this section, we explore how to solve this problem with gates with three or fewer variables such as in 3-SAT.
2.6.1. Global Variable Substitution Integer Program
Each substitution introduces new variables that correspond to ancillary qubits and impacts the degree of each vertex in the derived graph. In order to determine which of the possible combinations of substitutions are feasible, we create a graph
, which we call the lcovering graph. There are two sets of vertices in this graph. One set is the set of all 2-sets representing all possible two-variable substitutions
. We call this set of vertices
S and denote the pairs
in
S as
. Each
is a possible substitution, but not each
will result in a substitution
. The other set is the one containing all three variable terms from the expansion, which we will call the lexpansion 3-set,
. Edges are placed between vertices
g and
h if the variables in the label of
g are a proper subset of the variables in the label of
h. There are no edges between any sets of the same size, making the graph bipartite. See
Figure 7 for an example, where
S is the left set of vertices and
is the right set for Example 1.
The nature of this problem naturally lends itself to a set covering or bipartite matching style formulation as each substitution
can cover, or be matched with, any clause containing the literals in that substitution. We have chosen to use a set covering problem formulation, i.e., we want to find a subset of
S such that each vertex in
is incident to a vertex in the subset. Since covering a vertex in
more than once leads to unnecessary ancillary qubits and increases the degree, we need to add constraints to ensure that each clause
is covered by exactly one substitution
. Notice that more than one covering may be possible as seen in
Figure 7.
The objective of 3-SAT is to minimize the maximum degrees found in Equations (
9) and (11),
which are derived from the GVS method. The covering graph developed in the previous paragraphs is used to aid in the minimization process. The integer program formulation of this problem is subject to the set covering constraints. Each clause
is covered by a pair
and has a variable
that is not in a substitution. The indicator variable
is defined as
The full integer program formulation to minimize the maximum degree vertex in the derived graph,
, is as follows:
Equation (15) is our objective function. We have added the penalty in Equation (15) which minimizes the total number of unique substitutions to help minimize the number of ancillary qubits. Equation (16) indicates that the maximum degree of each vertex must be less than or equal to the objective value. The last term of this constraint counts the number of clauses that contain variable but in which is not substituted. This is equivalent to in Theorem 2 and the example. Similarly, Equation (17) indicates that the maximum degree of any substituted variable must be less than or equal to the objective value. These two constraints effectively allow us to minimize the maximum degree of the graph. Note, the degree of the slack variables are not included in this formulation as they are either 2 or 3 and will never yield the maximum degree in a problem of sufficient size. Equation (18) is our set covering constraint. This asserts that each is required to be covered by exactly one covering . Equation (19) asserts that if at least one substitutes the pair , is set to 1.
2.6.2. IP Formulation and Solution for Example 1
Let us examine Example 1,
The reformulation and expansion of each of these four 3-SAT clauses yields a three variable monomial
c, two variable monomials
, and potential coverings
.The first statement holds if and only if
holds. The other clauses, when expanded, give expressions
,
, and
. The two variable terms are
. Each
has
pairs that can cover it. In this example, we have five variables and four clauses. A summary of the clauses, their corresponding
P and potential covering are found in
Table 2.
After determining these sets, we are able to formulate our constraints. First we add a constraint for each literal vertex
in the form of Equation (16). For
:
Next, we add a constraint for each unique substitution
corresponding to an
in the form of Equation (17). For
:
For each
we add a constraint in the form of Equation (18) to assert that a clause
c must be covered by exactly one of its three potential coverings found in
Table 2. For clause
:
Finally, for each covering containing a pair
, we add a constraint in the form of Equation (19). This asserts that if any covering containing
is selected for a substitution,
is forced to 1. For
we add the constraints
The solution to this IP is
which indicates that the optimal solution is to substitute pairs
and
. Using these substitutions,
and the degree of each vertex in the derived graph is
so the unitary circuit depth is at most nine.
2.6.3. Heuristic Approximation
The previous integer programming approach will provide an optimal solution. However, depending on the 3-SAT instance, it might be a very difficult problem to solve. As an alternative, we have developed a heuristic to approximate it. Greedy algorithms are a common way to approximate large scale set covering problems [
26]. Generally, this involves a greedy selection of elements that cover the greatest amount of sets until all sets are covered. We have chosen to use a similar approach as the degree of the graph derived using GVS is directly impacted by the number of substitutions made. Therefore, we expect by selecting the coverings with the highest degree in the covering graph, we will be able to minimize the total number of substitutions made and obtain a locally minimal solution. Let
U be the set of uncovered clauses. Let
K be the set of covered clauses. At the beginning of the iteration,
K is empty and
, where
C is the set of all clauses in the 3-SAT instance. The greedy algorithm is described in Algorithm 1. Often in step 2, multiple
pairs may cover the same number of clauses. To break these ties, we randomly select a pair
of the current largest degree in the covering graph.
Algorithm 1 Greedy by Covering Heuristic |
|