Constructing Driver Hamiltonians for Optimization Problems with Linear Constraints
Abstract
Recent advances in the field of adiabatic quantum computing and the closely related field of quantum annealing have centered around using more advanced and novel Hamiltonian representations to solve optimization problems. One of these advances has centered around the development of driver Hamiltonians that commute with the constraints of an optimization problem - allowing for another avenue to satisfying those constraints instead of imposing penalty terms for each of them. In particular, the approach is able to use sparser connectivity to embed several practical problems on quantum devices in comparison to the standard approach of using penalty terms. However, designing the driver Hamiltonians that successfully commute with several constraints has largely been based on strong intuition for specific problems and with no simple general algorithm for generating them for arbitrary constraints. In this work, we develop a simple and intuitive algebraic framework for reasoning about the commutation of Hamiltonians with linear constraints - one that allows us to classify the complexity of finding a driver Hamiltonian for an arbitrary set of linear constraints as NP-Complete. Because unitary operators are exponentials of Hermitian operators, these results can also be applied to the construction of mixers in the Quantum Alternating Operator Ansatz (QAOA) framework.
I Introduction
Quantum annealing has been proposed as a heuristic method to exploit quantum mechanical effects in order to solve discrete optimization problems. Typically, these problems require optimizing a quadratic cost function subject to a set of linear constraints. The usual approach to treating these constraints consists of adding them to the cost function as penalty terms, thereby transforming the constrained optimization into an unconstrained one. This approach has some drawbacks, including an increase in the required resources (i.e., higher connectivity and increased dynamical range for the parameters that define the instance). In Ref.hen2016quantum , the authors introduced the idea of constrained quantum annealing (CQA), that uses specially tailored driver Hamiltonians for a specific set of constraints. These tailored Hamiltonians have several advantages, such as reducing the size of the search space of the problem and reducing the number of needed interactions to implement the annealing protocol. At the heart of the approach is the idea that a Hamiltonian which commutes with the operator embedding of the constraints and starts within the feasible space of configurations will remain in it throughout the evolution.
While Ref.hen2016quantum looked primarily at commuting with a single global constraint, the work in Ref.hen2016driver focused on finding driver Hamiltonians for several constraints. Under special conditions, the authors were able to construct appropriate driver Hamiltonians for several optimization problems of practical interest. In this paper, we ask and answer the general question of, given a set of arbitrary linear constraints, can we construct a driver Hamiltonian which will commute with the operator embedding of the constraints? Our main result is that this problem is NP-Complete – answering a question posited originally in Ref.hen2016driver . Along the way, we will derive a simple formula for describing the commutation relation and exploit it to understand many facets of CQA. These results can be naturally applied to the Quantum Alternating Operator Ansatz (QAOA) framework hadfield2017quantum, where one of the central tasks is to find mixer operators that connect feasible solutions of a constrained optimization problem. Since unitary operators are exponentials of Hermitian operators (for every unitary matrix , there exists a Hermitian matrix such that ) and therefore the existence of a unitary matrix with this commutative property necessitates the existence of the Hermitian matrix with the same commutative property (since ), our results directly translate into this setting as well.
The paper is organized as follows. In Section II we review the basic ideas behind constrained quantum annealing. In Section III, we derive a simple algebraic condition for the commutation relation of the driver Hamiltonian and the constraint operators. For many practical applications, Hamiltonians with bounded weight interaction (local) terms are often desired; in Section IV we show how brute forcing the simple algebraic condition from Section III to find driver Hamiltonians of bounded weight. In Section V, we introduce several variations of the problem ILP-QCOMMUTE, the problem of finding a Hermitian matrix that will commute with the constraint operators. We also reduce the EQUAL SUBSET SUM problem to the problem ILP-QCOMMUTE (and in Appendix A we show it for the special case of binary valued linear constraints). The EQUAL SUBSET SUM problem is known to be NP-Complete, thus proving our main result. We define a related complexity class, ILP-QCOMMUTE-k-LOCAL, about finding a Hermitian matrix that commutes with the constraints and has interaction terms up to weight. ILP-QCOMMUTE-k-LOCAL is in P by the approach detailed in Section IV. Other questions of interest, such as finding a driver Hamiltonian that has full reachability over a constrained space for a CQA protocol, will be addressed through our formulation in Section VI. We conclude with a discussion of the significance of our result and open problems related to what we have shown in this work.
II Background
In the quantum annealing (QA) framework, gradually decreasing quantum fluctuations are used to traverse the barriers of an energy landscape in the search of global minima to complicated cost functions kadowaki1998quantum ; farhi2000quantum . For an overview of these approaches, we refer the reader to Ref.albash2018adiabatic . Quantum annealing has gained traction for combinatorial optimization farhi2001quantum ; santoro2006optimization ; bian2016mapping ; hauke2020perspectives as a way to solve hard optimization problems faster and, more recently, for machine learning adachi2015application ; mott2017solving ; amin2018quantum ; biamonte2017quantum ; li2018quantum ; kumar2018quantum as a way to naturally sample desired probability distributions quickly. In the case of solving an optimization problem, the problem is encoded in the Hamiltonian such that the ground state is the optimum solution. Usually this is readily done by expressing the problem as an Ising model, a model for spin glassesbrush1967history ; sherrington1975solvable ; castellani2005spin ; troyer2005computational .
Once the problem Hamiltonian is described, the QA framework prescribes an evolution to the final Hamiltonian from some readily preparable Hamiltonian - usually through a linear interpolation of and :
(1) |
where there is a continuous smooth function for such that and . If the process is varied slowly enough, the adiabatic theorem ensures that the wave function of the system will be close to the instantaneous ground state of the system for any and therefore any . By the adiabatic theorem, if the total time that the system is evolved for is large compared to the inverse of the minimum gap squared, then the wavefunction of the system will be close to the ground state of . For the purpose of our presentation here, we restrict our focus to the case of binary linear optimization problems, a heavily studied optimization class. Specifically, we can consider a set of linear constraints . Suppose that the solutions to the optimization problem are subject to constraints such that a solution state satisfies for some . Because is a simple linear function, we can associate a vector with it such that where . When referring to constraints throughout this paper, we are referring specifically to linear constraints, for which our main results are pertinent to.
II.1 Constraint Quantum Annealing for Integer Linear Programming
We use the ordinary embedding of binary variables in the computational basis for quantum annealing, such that is represented by (i.e. ) and the final Hamiltonian is diagonal in the computational basis so that we can read off a solution by measuring in that basis. Following the framework of CQA, given a constraint , we associate with an embedded constraint operator . Let us consider the case of a single constraint - - over variables. This is also the first case presented in Ref.hen2016quantum . It is simple to check that commutes with the constraint embedded operator . For example, this type of constraint may arise in graph partitioning, since the partitions must split the graph into equal size. For the Graph Partition problem, one is given a graph and is asked to partition the vertices into equal subsets such that the number of edges between the two is minimized. In terms of the Ising model, we can consider a collection of qubits, such that () for qubit represents placing vertex in partition 1 (2). As such, we design a penalty Hamiltonian and a driver Hamiltonian such that the final state will be a solution to the graph partitioning problem. Assuming the transverse field driver Hamiltonian - - a simple penalty Hamiltonian can be:
(2) |
where the first term assigns a positive potentiality to each edge that connects vertices across the partitions and the second term is the constraint operator squared.
In general the penalty factor must be greater than where is the maximal degree of lucas2014ising . Note that the term is and requires two body interaction terms to implement. However, if we choose our such that , then we can use the simpler penalty Hamiltonian:
(3) |
Note that since is diagonal in the spin-z basis, it trivially commutes with the constraints.
One benefit to this construction is that the driver , for example, commutes with and only requires two body interaction terms to implement. As such, the total number of two body terms required to solve the problem can be greatly reduced by using driver Hamiltonians beyond the transverse field if they commute with a set of constraints. As long as the initial wavefunction has an expected value of for ( or if is odd), the wavefunction will remain in the subspace with this expected value for the entirety of the anneal. As an example of Graph Partition that we will return to later, consider a graph with 4 vertices , connected into a single path by edges with . Then in this case, . Since we are interested in an even partition, the starting state should have an equal number of 1s and 0s. For example, is in the correct subspace. It is important to note that driver Hamiltonians are constructed irrespective of the value that the constraint is set to, since the eigenvalue of the constraint operator with respect to the initial wavefunction will determine what value is preserved during the anneal. For a wavefunction that is not an eigenvector of a constraint operator, the commuting property of the driver Hamiltonian with the constraint operator will mean that the projection of the wavefunction onto each specific eigenspace will evolve independently of the rest of the wavefunction.
For the purpose of adiabatic quantum computing, the initial wavefunction of the system has to be in the ground state of the initial Hamiltonian, while a general driver Hamiltonian from this construction can be highly nontrivial if there are many constraints. Therefore, specifying an alternative initial Hamiltonian for CQA is also a major area of research, since we want the initial Hamiltonian to have a ground state that is easy to prepare. One approach to overcome this is to use an initial Hamiltonian diagonal in the computational basis and linear on the operators, that has as its ground state a specific solution in the feasible space in the spin-z basis, and then evolve from this initial Hamiltonian to the driver Hamiltonian (whose ground state will have support on all or a subset of the feasible space). There are many hard problems for which finding a feasible solution is simple. For example, it is straightforward to find a single partition for Graph Partition, but it is hard to find the best partition. As such, a useful avenue for exploiting CQA is in the case where linear constraints specify a nontrivial feasibility space, but one where finding a nonoptimum element in the feasibility space is still tractable.
The work in Ref.hen2016driver extended the framework for cases where a driver should commute with multiple constraint operators. In particular, given a set , they consider finding a Hamiltonian such that:
(4) |
As they note, in general, tailoring driver Hamiltonians for a set can be difficult. In this paper, we answer specifically the computational complexity of such a task by reducing an NP-Complete problem to ILP-QCOMMUTE. We also discuss the related task of finding such that it can reach every state in the solution space, but reaches no state outside the solution space in Section VI. This result in some ways may appear intuitive, since describing the feasible space of is hard and knowing a Hamiltonian that would keep a wavefunction within this space - and only this space - should require some characterization of it. Simply knowing that a nontrivial exists at all for a NP-Complete feasibility problem allows one to recognize that the problem should have at least two solutions for some set of values that each constraint is set to, even if one does not have a token to prove it.
III An Algebraic Condition for Commuting with Linear Constraints
Consider the problem to find Hamiltonian drivers that have, as their eigenvectors, support over the possible values that satisfy the given linear constraints. In the most general sense, we consider constraints of the form:
(5) |
with a constraint value that corresponds to one of the energy levels of . Often problems of practical interest can be captured in the restricted case where or .
Consider the linear transformation that maps any two by two matrix to a new two by two matrix , by commuting the matrix with . This transformation has two obvious eigenmatrices - and - that span the kernel of the transformation. One can easily verify that () and () are also eigenmatrices of this transformation, with eigenvalue and respectively. Together these four eigenmatrices and their eigenvalues describe the spectrum decomposition of the transformation. We exploit this fact to find a simple algebraic formula for expressing the commutation of a general Hamiltonian with a linear constraint. It is easy to verify that for over qubits, if , then .
Given any complete basis for a single qubit system, we can extend that basis to define a basis over qubits. Doing this with the found eigenmatrices defines a basis . Note as well that for . This suggests a simple representation in which a Hermitian matrix is defined by its nonzero terms over this basis. Then any Hermitian matrix can be written in the form:
(6) |
where with , with , and with are such that the corresponding . Here , where simply takes any indexed element sets and creates the set of the index-wise confederated tuples. A tuple specifies the indices in which we chose , , or for each nonzero term. Once that choice is made, hermiticity demands the corresponding second term seen in Eq. 6 to be part of the Hamiltonian as well. However, there are restrictions on what vectors can be chosen. Specifically, and , since choosing and a would actually mean selecting with a new coefficient instead. Likewise, it should also be the case that – otherwise the term would be equivalent to two terms with the same coefficient halved and one taking the term , the other taking the identity term. As such, this added constraints on so that the representations are unique, which must be enforced before applying the theorem below because the uniqueness of the basis will be actively used. As an example, consider the driver Hamiltonian discussed in the previous section: . For this Hamiltonian, – where refers to the standard basis vectors. While the notation is somewhat awkward, it becomes useful for expressing our first major result:
Theorem III.1 (Algebraic Condition for Commutativity).
A Hermitian Matrix commutes with a linear constraint if and only if for all .
Proof.
Using the form for we introduced earlier, we can see that:
(7) |
Since the set defined by the tuples is a linearly independent set Eq. 7 iff for all .
∎
IV Bounded weight drivers
The algebraic condition of Theorem III.1 can be used as a starting point to understand several features of CQA. One of them is motivated by the fact that actual implementations of quantum annealing will likely impose a bound on the weight of the driver operators available. Hence, given a set of linear constraints, we could restrict our search for commuting drivers to those with bounded weight.
Consider a set of linear constraints on variables, and let be the matrix with coefficients (recall ). Then, Theorem III.1 tells us that there is a non-diagonal driver commuting with all the constraints, if and only if, the linear system , where . Furthermore, we can see that the number of components of that are non-zero is a lower bound for the weight of such a driver (the weight could be higher if we allow operators acting on the variables associated with the vanishing components of ). This leads to a simpler analysis of the case of bounded weight drivers.
Assume that we are only allowed weight drivers, and we further impose the condition that they are constructed from 1-qubit operators that act non trivially in the computational basis (in our case, it means these are chosen from ). Then, the number of such operators is . For fixed , this is polynomial in , and so it is tractable to check all the possible vectors to find which ones satisfy the condition . From those that do, we can construct the corresponding weight driver that will commute with all the constraints, by assigning to qubit if , and if . This is a simple but very useful result in practice: brute force searching for solutions to the condition from Theorem III.1 finds all possible driver Hamiltonians that commute with the embedded constraint operators up to a certain weight in time polynomial on the system size.
The simplest and most relevant case for practical applications is that of 2-local operators, since 2-body interactions are more easily engineered than higher order ones. In this case the condition of Theorem III.1 implies an even simpler characterization of when a set of constraints allow for commuting drivers.
Corollary IV.0.1.
Let be a set of linear constraints and the associated matrix of coefficients. Then a 2-local driver that commutes with all the constraints exists, if and only if, the matrix has a pair of columns that are either equal, or opposite.
2-local means that in the condition has only 2 non zero components, and we can take these to be or , since the other two possibilities would produce the corresponding Hermitian conjugates. Since multiplying a matrix by a column vector results in a linear combination of the columns of the matrix, with the coefficients given by the vector components, the condition will state that has two columns that are the same (if the non zero components of are ), or are opposites (if they are ). To any distinct pair of columns that satisfy one of these conditions we can associate a distinct weight-2 driver that commutes with the constraints, so the maximum number of such possible weight-2 drivers is .
V The Problem ILP-QCOMMUTE
Having found a simple algebraic condition for expressing the commutation relationship of any Hermitian matrix with a linear constraint, we wish to exploit that fact here to find what the general complexity of knowing the existence of such a Hermitian matrix is. We consider the following problem:
Definition (ILP-QCOMMUTE):
Given a set of linear constraints such that , over a space with , is there a Hermitian Matrix , with nonzero coefficients over a basis , such that for all and has at least one off-diagonal term in the spin-z basis?
Solving this problem would be useful for constructing Hamiltonian drivers for quantum annealing. We can also define 0-1-LP-QCOMMUTE as the binary version, where , and also {-1,0,1}-LP-QCOMMUTE, where , the type of coefficients used when representing problems like 1-in-3 3-SAT as an ILP. One of the central results of this paper is that these problems are NP-Completecook1971complexity karp1975computational , which can be shown by reducing them to the EQUAL SUBSET SUM problemkarp1972reducibility . This reduction is simple and straightforward for ILP-QCOMMUTE, and we discuss it in this section to give a sense of the connection between the two problems. However, this proof is not enough to imply that 0-1-LP-QCOMMUTE and {-1,0,1}-LP-QCOMMUTE are also NP-Complete, since they could both very well be easier subclasses of ILP-QCOMMUTE. That is not the case, but the proof for 0-1-LP-QCOMMUTE is more involved (and rather tedious) and thus is presented in the Appendix A.
Definition (EQUAL SUBSET SUM):
Given a set , with , are there two non-empty disjoint subsets, such that ?
The EQUAL SUBSET SUM problem is known to be NP-Completewoeginger1992equal . We map an instance of the EQUAL SUBSET SUM problem to the ILP-QCOMMUTE problem; the former defined over a set , with . Consider the constraint operator defined by , and the vector . Suppose we can find vectors with binary components, such that (the algebraic condition derived in Theorem III.1). Then the indices corresponding to the nonzero components of and can be used to identify the sets and (respectively) in the EQUAL SUBSET SUM problem.
Suppose there is a solution to ILP-QCOMMUTE. From Theorem III.1, it follows that for the vector associated with constraint and any nonzero term in the basis with a term on at least one qubit will be enough to define a new that will be associated with a solution to EQUAL SUBSET SUM. At least one such element exists for because has at least one off-diagonal term in the spin-z basis. We can associate any off-diagonal term of H with such that is a matrix with only that off-diagonal term and its complex conjugate for some and . Then for a specific off-diagonal term, every non-zero entry in between and , call it , picks an integer for the set , and does likewise for the set , providing a solution to the corresponding instance of EQUAL SUBSET SUM since . Suppose there is a solution to EQUAL SUBSET SUM, then define such that () if and only if is in (). Then is a solution to ILP-QCOMMUTE since . Hence, we have the following result.
Theorem V.1.
ILP-QCOMMUTE is NP-Hard.
Given this result, we can show NP-Completeness by noting that we can check for an off-diagonal term in the spin-z basis in polynomial time. Let be a proposed solution to the ILP-QCOMMUTE such that there exists nonequivalent indices such that entry . Checking that commutes with the constraints is polynomial time. For , check if or . has at least one element that is off-diagonal in the spin-z basis if and only if there exists such that at least one of these terms is nonzero. Since the partial trace of tensor products is the trace over a specific tensor component, this can be done quickly.
Corollary V.1.1.
ILP-QCOMMUTE is NP-Complete.
While we have shown that this problem is NP-Hard, we note that for any specific instance of the problem, the practical runtime can still be tractable and therefore a useful avenue for even the hardest instances of optimization problems.Also take note that since every unitary operator is the exponential of a corresponding Hermitian operator, knowing the existence of a unitary operator that commutes with the constraint operators is paramount to knowing a Hermitian matrix exists with the same property. As such, our result immediately translates to the QAOA setting where one wishes to construct unitary operators that will commute with the embedded linear constraint operators.
V.1 Bounded Weight ILP-QCOMMUTE
Despite the NP-hardness of ILP-QCOMMUTE, Section IV discusses a simple polynomial time algorithm to find driver terms up to some weight . Consider this modified version of ILP-QCOMMUTE, which asks about the existence of a Hermitian matrix that commutes with the constraints, but consists of interaction terms up to weight .
Definition (ILP-QCOMMUTE-k-LOCAL):
Given a set of linear constraints such that , over a space with , is there a Hermitian Matrix , with nonzero coefficients over a basis and no term with weight higher than , such that for all and has at least one off-diagonal term in the spin-z basis?
Theorem V.2.
ILP-QCOMMUTE-k-LOCAL is in P for k in .
Proof.
Apply the brute force approach described in Section IV. Since , the algorithm runs in time . ∎
This shows that for a practical application where the Hamiltonian driver should be all local, we can tractably find such a Hamiltonian driver. Moreover, any that is all local and commutes with the constraints can be constructed by placing the right coefficients on the found terms by brute forcing the expression in Theorem III.1 (they form a basis for all Hamiltonians that commute with the constraints up to weight ).
VI Reachability within the Feasible Space
In the previous section, we proved that finding a Hermitian matrix which commutes with a collection of linear spin-z constraints is NP-Complete. The related question becomes finding a Hermitian matrix which commutes with the constraints, but also connects the feasibility space. Note that two states are connected if they are in the same commutation subspace of , that is for some . As such, for any pair of solutions in the feasibility space, their associated vectors in the computational basis should be in the same commutation subspace. In general, when finding a driver Hamiltonian for an anneal that should solve an optimization task, we wish to find a driver that satisfies this condition so that we can ensure that it will be able to reach the entire feasibility space, since commuting with the constraints alone is not enough to ensure this will happen. Consider the graph partitioning example discussed in Section II and Section V, clearly commutes with the constraint, but fails to connect the entire feasible space. For example, the state is disconnected from under this driver Hamiltonian. While it succeeds not to mix solution states to nonsolution states, it does not mix all solution states with each other. We introduce the problem ILP-QCOMMUTE-NONTRIVIAL which asks to find a driver term that not only commutes with the constraints, but acts nontrivially on the feasible space, so that the action of the driver is such that there exists one solution state which the driver maps to another solution state in the feasible space. If we think about the solution states as vertices in a graph, then transitions induced by driver terms are the edges (and a driver term can induce more than one such edge). Then the problem ILP-QCOMMUTE-NONTRIVIAL asks that the driver term found induces at least one edge in the graph of feasible solutions. For the graph partitioning example discussed above, the term we discussed is clearly a solution to the problem ILP-QCOMMUTE-NONTRIVIAL since it connects to , both of which are in the feasible space for this example. Let be the projection operator corresponding to the energy eigenvalue for the constraint operator . Then this formally defines the problem ILP-QCOMMUTE-NONTRIVIAL:
Definition (ILP-QCOMMUTE-NONTRIVIAL):
Given a set of linear constraints and constraint values such that over a space with , is there a Hermitian Matrix H, with nonzero coefficients over a basis , such that for all and has at least one off-diagonal term in the spin-z basis?
The main difference is that while ILP-QCOMMUTE required nontrivial off-diagonal terms in the spin-z basis, ILP-QCOMMUTE-NONTRIVIAL specifically requires these to be nontrivial in the constraint space of interest, which in general is a non-polynomial problem to verify (i.e. knowing a Hamiltonian has or fails to have an eigenvector for a specific energy level would allow one to know if a Hamiltonian has a solution to hard problems). We show that this problem is at least NP-Hard by reducing a problem closely related to EQUAL SUBSET SUM to ILP-QCOMMUTE-NONTRIVIAL. We begin with the famous NP-Complete SUBSET SUM problem:
Definition (SUBSET SUM):
Given a set of integers and an integer target value , is there a subset such that ?
While SUBSET SUM asks about the existence of a single solution, we are interested in at least two solutions, defining the problem:
Definition (2-OR-MORE SUBSET SUM):
Given a set and a target value , are there two subsets such that ?
We show that like SUBSET SUM (over positive integerscormen2009introduction ), 2-OR-MORE SUBSET SUM is also NP-Hard:
Lemma VI.1.
2-OR-MORE SUBSET SUM is NP-Hard.
Proof.
Consider an instance of the SUBSET SUM problem with a set and a target value such that for all . We construct a new instance of the 2-OR-MORE SUBSET SUM problem with set and the same target value .
First we show how to relate a solution to the original SUBSET SUM instance from a solution to the constructed 2-OR-MORE SUBSET SUM problem. Let be solutions to the new 2-OR-MORE SUBSET SUM instance, either one or none of the solutions uses the element . If neither does, either one is a solution to the instance of the original SUBSET SUM problem. Without loss of generality, suppose uses the value , then cannot use any other value since every other value is greater than zero, hence . Since cannot use any value other than if and , it follows that . Then and .
We now show how to relate a solution to the constructed 2-OR-MORE SUBSET SUM instance given a solution to the SUBSET SUM instance. Let be a solution to the SUBSET SUM problem. Then is a solution to the 2-OR-MORE SUBSET SUM instance.
Since SUBSET SUM is NP-Hard over positive integers, 2-OR-MORE SUBSET SUM is NP-Hard as well.
∎
2-OR-MORE SUBSET SUM is closely related to EQUAL SUBSET SUM because both ask about the existence of two subsets with equal sums, but 2-OR-MORE SUBSET SUM adds the further constraint that these two subsets should have a specific sum. We show that ILP-QCOMMUTE-NONTRIVIAL is NP-Hard through a reduction to 2-OR-MORE SUBSET SUM. Note again that ILP-QCOMMUTE-NONTRIVIAL is not verifiable in polynomial time kitaev2002classical kempe20033 kempe2006complexity and so this reduction is only for the decision version of the problem 2-OR-MORE SUBSET SUM.
Theorem VI.2.
ILP-QCOMMUTE-NONTRIVIAL is NP-Hard.
Proof.
Consider an instance of the 2-OR-MORE SUBSET SUM problem with a set and a target value . Define the constraint operator and a target energy value .
Suppose this instance of ILP-QCOMMUTE-NONTRIVIAL has a solution. Then there are at least two eigenvectors of with eigenvalue such that the two eigenvalues can be written in the spin-z basis with . Like with ILP-QCOMMUTE and EQUAL SUBSET SUM, the nonzero elements of and describe two sets such that () if and only if (). Since , it follows that . The same logic works for and so . Then 2-OR-MORE SUBSET SUM must have a solution as well, specifically .
Suppose 2-OR-MORE SUBSET SUM has a solution. Then there are two nonequal subsets of such that . Then let () with () if ().
Then . The same logic works for and so are both eigenvectors of with eigenvalue . Then is a driver term that nontrivially maps solution states of this constraint problem to one another.
∎
In practical applications, we are often able to quickly find some driver terms that commute with the constraints, but then need to know whether they are sufficient to connect the entire feasible space. This raises the following question: given driver terms (individual basis terms) that commute with the constraints, does some linear combination of them with nonzero coefficients connect the entire feasibility space? In other words, given that we have found driver terms that commute with the constraints, can we guarantee that some linear combination of them will have the whole feasible subspace as its smallest invariant subspace? Note that not every driver term that does commute with a subspace is necessary to solve this problem. For example, in the case of the constraint , it suffices to use the driver terms for . Any linear combination with nonzero coefficients, , then is a valid Hamiltonian driver to connect the feasible space. Then an extra term, like is unnecessary, because if is in the constrained subspace, it follows that , , , and are as well. Note that . If a Hermitian matrix can be decomposed into a linear combination of products of operators chosen from the set of driver terms , and is a state in the constrained space, then for any state such that (i.e., any state reachable from through the action of ), is also reachable through the action of the driver terms in for the state .
The set of Hamiltonians that commute with a given set of constraints form an algebra (known as the commutant of the set of constraints). Each one of the driver terms we are considering can be seen as a generator of this commutant algebra. This leads us to define the problem ILP-QIRREDUCIBLECOMMUTE-GIVEN-k formally:
Definition (ILP-QIRREDUCIBLECOMMUTE-GIVEN-k):
Given a set of linear constraints and constraint values such that over a space with , and a set of basis terms such that , does connect the entire nonzero eigenspace of the operator ?
As such, ILP-QIRREDUCIBLECOMMUTE-GIVEN-k asks if a given set of driver terms is able to connect the entire feasible space of a set of constraints with the given constraint values. We show that this problem is also NP-Hard by reducing ILP-QCOMMUTE-NONTRIVIAL to ILP-QIRREDUCIBLECOMMUTE-GIVEN-k. We do so by finding a mapping for any instance of ILP-QCOMMUTE-NONTRIVIAL to an instance of ILP-QIRREDUCIBLECOMMUTE-GIVEN-k. Consider such an instance with constraints and constraint values . Find an integer such that for . Then expand the space by appending . Make the constraints with constraint values . Then we can easily find a driver term (over the basis ) such that for . Since the constraint values are , then the only way to satisfy the constraints is if , since by design.
We have thus altered the constraints such that the feasibility space of the original problem is now doubled in size by the addition of the two variables and , if the original feasibility space was non-empty. The important structure we note here is that the feasibility subspace of the new constraints is the tensor product of the feasibility subspace of the original constraints, with the subspace generated by the states and over qubits . It should also be easy to recognize then that the only nontrivial action induced by the driver terms we choose over is precisely the action of .
We can apply the same procedure recursively, adding ancillas and generating driver terms, such that and , . By this construction, when restricted to the ancilla variables, the feasible subspace is spanned by the vectors . Given any element in this subspace, the action of the driver terms is sufficient to guarantee that any other element of this subspace can also be generated. To proceed with the reduction, we then give the constraints with constraint values respectively and the drivers to our ILP-QIRREDUCIBLECOMMUTE-GIVEN-k solver oracle. Since our driver terms are all over the added qubits to , it should be clear that these driver terms say nothing about the feasibility space of the original problem over qubits to . Suppose we are told that our drivers are sufficient, i.e., they can generate the whole feasible subspace by acting on any one element of that subspace. Then clearly there are no driver terms for the original ILP-QCOMMUTE-NONTRIVIAL decision problem, since none of the driver terms operate over qubits associated with variables to . Likewise if we are told our drivers are not sufficient, then clearly there must be at least one nontrivial driver for the original problem, since the drivers are enough to generate all elements of the feasible subspace when restricted to the ancillas. Note that this solves ILP-QCOMMUTE-NONTRIVIAL without giving us a token to verify it. Because this is the most general unstructured version of the problem, is it possible that a different complexity result can be found for a more structured questioning of the same problem. We note that the problem can also have a stronger complexity result, such as a relationship to a higher class in the polynomial hierarchymeyer1972equivalence ; stockmeyer1976polynomial ; garey1979computers , like #Pvaliant1979complexity , to which it has some natural analogues.
Given this result and the result of Section IV, we can often find drivers that satisfy the condition stated in Theorem III.1, but may not connect the entire feasible space. Still, there remain many avenues for exploiting such terms; for example, alongside the ordinary transverse field such that universality is maintained, but with biasing towards a subspace of the solution space. This gives us a way to adjust the knob of using higher order terms when the ordinary transverse field struggles to find a solution. Such driver terms can also be beneficial for exploring new solutions using reverse annealingventurelli2019reverse ; king2018observation , especially for solutions that are higher hamming distance away since the transverse field generally struggles to find such solutions.
Another way to leverage our result is to brute force the problem for a set of constraints over a small enough subspace that it becomes polynomially tractable. Over the other variables, we apply the usual transverse field and enforce the other constraints as penalty terms in the final Hamiltonian. These approaches can also be adopted to the constraints that are geometrically local (like in a two dimensional grid).
VII Conclusion
In this work, we addressed the computational complexity of finding driver Hamiltonians for quantum annealing processes which aim at solving optimization or feasibility problems with several linear constraints. We develop a simple and intuitive algebraic framework for understanding whether a Hamiltonian commutes with a set of constraints or not. While this result is interesting mathematically in its own right, we mainly focus on the problem posed in Ref.hen2016driver about algorithmically finding driver Hamiltonians for optimization problems with several linear constraints. Most significantly, the condition is useful for finding a reduction of the NP-Hard problem EQUAL SUBSET SUMS to finding such a driver Hamiltonian, thereby allowing us to categorize the complexity of this problem.
We also showed that ILP-QCOMMUTE-NONTRIVIAL and ILP-QIRREDUCIBLECOMMUTE-GIVEN-k are at least NP-Hard. But these problems could well be in a higher complexity class in the polynomial hierarchy - like #P, to which ILP-QIRREDUCIBLECOMMUTE-GIVEN-k has some similarity. However, for most common implementations the Hamiltonians are of bounded weight, and the relevant complexity class ILP-QCOMMUTE-k-LOCAL for a small integer is in P. Hence, there is a simple brute force algorithm, as detailed in Section IV, to find a basis for all possible driver Hamiltonians of this bounded locality. However, the results from ILP-QIRREDUCIBLECOMMUTE-GIVEN-k say that given a set of driver terms, it is intractable to know whether the found basis can sustain a Hamiltonian that connects the entire feasibility space for the linear constraints. As such, we present a polynomial time algorithm that is guaranteed to find a basis for all possible Hamiltonians that commute with a set of embedded constraint operators up to a certain weight, but with no guarantees that the found Hamiltonian is able to connect the entire feasibility space that the constraints specified. However, for some important problems it is actually possible to exploit the constraint structure to guarantee that driver terms with low weight will be sufficient to reach all feasible states. This is the case, for example, for the graph coloring problem discussed in Section II and Ref.hen2016driver .
Our result also applies to finding mixing operators for Quantum Alternating Operator Ansatz (QAOA)farhi2014quantum ; hadfield2019quantum . To implement highly nontrivial driver Hamiltonians for an anneal, it also becomes necessary to find a new initial Hamiltonian that is then evolved slowly with a simple linear interpolation to the driver Hamiltonian since thermal equilibration to the driver Hamiltonian may be difficult. It then becomes relevant how can we construct such a Hamiltonian for a given driver Hamiltonian, such that we can guarantee that we reach the right constrained space. This is a fundamental question for future research. While we have shown these problems to be NP-Hard, we have not shown what the average hardness of this class is or what the typical hardness is for instances of interest for specific applications. Especially pertinent become sets of instances in which the practical runtime for finding driver Hamiltonians remains tractable or the hardness of the problem comes from having to search a large feasible space for an optimum solution rather than pinpointing a very small feasible space. It is also interesting to note that our algebraic formulation is agnostic to the stoquasticity of the terms found. In the presented basis of Section III, the stoquasticity of the individual basis terms, as written in Eq. 6, is determined by the amplitudes and its conjugate pair . Commutation is invariant under altering ( will adjust as we alter to keep the term pair commutative). Once we have found driver terms that are suitable for a problem, it then raises the question of what effect, if any, choosing coefficients that will make them stoquastic or non-stoquastic will have on the annealbravyi2006complexity ; bravyi2010complexity ; marvian2019computational ; crosson2020signing .This is another direction that requires further study.
VIII Acknowledgments
The research is based upon work (partially) supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA) and the Defense Advanced Research Projects Agency (DARPA), via the U.S. Army Research Office contract W911NF-17-C-0050. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the ODNI, IARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon.
References
- (1) I. Hen and F. M. Spedalieri, “Quantum annealing for constrained optimization,” Physical Review Applied, vol. 5, no. 3, p. 034007, 2016.
- (2) I. Hen and M. S. Sarandy, “Driver hamiltonians for constrained optimization in quantum annealing,” Physical Review A, vol. 93, no. 6, p. 062312, 2016.
- (3) T. Kadowaki and H. Nishimori, “Quantum annealing in the transverse ising model,” Physical Review E, vol. 58, no. 5, p. 5355, 1998.
- (4) E. Farhi, J. Goldstone, S. Gutmann, and M. Sipser, “Quantum computation by adiabatic evolution,” arXiv preprint quant-ph/0001106, 2000.
- (5) T. Albash and D. A. Lidar, “Adiabatic quantum computation,” Rev. Mod. Phys., vol. 90, p. 015002, Jan 2018. [Online]. Available: https://link.aps.org/doi/10.1103/RevModPhys.90.015002
- (6) E. Farhi, J. Goldstone, S. Gutmann, J. Lapan, A. Lundgren, and D. Preda, “A quantum adiabatic evolution algorithm applied to random instances of an np-complete problem,” Science, vol. 292, no. 5516, pp. 472–475, 2001.
- (7) G. E. Santoro and E. Tosatti, “Optimization using quantum mechanics: quantum annealing through adiabatic evolution,” Journal of Physics A: Mathematical and General, vol. 39, no. 36, p. R393, 2006.
- (8) Z. Bian, F. Chudak, R. B. Israel, B. Lackey, W. G. Macready, and A. Roy, “Mapping constrained optimization problems to quantum annealing with application to fault diagnosis,” Frontiers in ICT, vol. 3, p. 14, 2016.
- (9) P. Hauke, H. G. Katzgraber, W. Lechner, H. Nishimori, and W. D. Oliver, “Perspectives of quantum annealing: Methods and implementations,” Reports on Progress in Physics, vol. 83, no. 5, p. 054401, 2020.
- (10) S. H. Adachi and M. P. Henderson, “Application of quantum annealing to training of deep neural networks,” arXiv preprint arXiv:1510.06356, 2015.
- (11) A. Mott, J. Job, J.-R. Vlimant, D. Lidar, and M. Spiropulu, “Solving a higgs optimization problem with quantum annealing for machine learning,” Nature, vol. 550, no. 7676, pp. 375–379, 2017.
- (12) M. H. Amin, E. Andriyash, J. Rolfe, B. Kulchytskyy, and R. Melko, “Quantum boltzmann machine,” Physical Review X, vol. 8, no. 2, p. 021050, 2018.
- (13) J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N. Wiebe, and S. Lloyd, “Quantum machine learning,” Nature, vol. 549, no. 7671, pp. 195–202, 2017.
- (14) R. Y. Li, R. Di Felice, R. Rohs, and D. A. Lidar, “Quantum annealing versus classical machine learning applied to a simplified computational biology problem,” NPJ quantum information, vol. 4, no. 1, pp. 1–10, 2018.
- (15) V. Kumar, G. Bass, C. Tomlin, and J. Dulny, “Quantum annealing for combinatorial clustering,” Quantum Information Processing, vol. 17, no. 2, pp. 1–14, 2018.
- (16) S. G. Brush, “History of the lenz-ising model,” Reviews of modern physics, vol. 39, no. 4, p. 883, 1967.
- (17) D. Sherrington and S. Kirkpatrick, “Solvable model of a spin-glass,” Physical review letters, vol. 35, no. 26, p. 1792, 1975.
- (18) T. Castellani and A. Cavagna, “Spin-glass theory for pedestrians,” Journal of Statistical Mechanics: Theory and Experiment, vol. 2005, no. 05, p. P05012, 2005.
- (19) M. Troyer and U.-J. Wiese, “Computational complexity and fundamental limitations to fermionic quantum monte carlo simulations,” Physical review letters, vol. 94, no. 17, p. 170201, 2005.
- (20) A. Lucas, “Ising formulations of many np problems,” Frontiers in Physics, vol. 2, p. 5, 2014.
- (21) S. A. Cook, “The complexity of theorem-proving procedures,” in Proceedings of the third annual ACM symposium on Theory of computing, 1971, pp. 151–158.
- (22) R. M. Karp, “On the computational complexity of combinatorial problems,” Networks, vol. 5, no. 1, pp. 45–68, 1975.
- (23) ——, “Reducibility among combinatorial problems,” in Complexity of computer computations. Springer, 1972, pp. 85–103.
- (24) G. J. Woeginger and Z. Yu, “On the equal-subset-sum problem,” Information Processing Letters, vol. 42, no. 6, pp. 299–302, 1992.
- (25) T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, Introduction to algorithms. MIT press, 2009.
- (26) A. Y. Kitaev, A. Shen, M. N. Vyalyi, and M. N. Vyalyi, Classical and quantum computation. American Mathematical Soc., 2002, no. 47.
- (27) J. Kempe and O. Regev, “3-local hamiltonian is qma-complete,” arXiv preprint quant-ph/0302079, 2003.
- (28) J. Kempe, A. Kitaev, and O. Regev, “The complexity of the local hamiltonian problem,” SIAM Journal on Computing, vol. 35, no. 5, pp. 1070–1097, 2006.
- (29) A. R. Meyer and L. J. Stockmeyer, “The equivalence problem for regular expressions with squaring requires exponential space,” in SWAT (FOCS), 1972, pp. 125–129.
- (30) L. J. Stockmeyer, “The polynomial-time hierarchy,” Theoretical Computer Science, vol. 3, no. 1, pp. 1–22, 1976.
- (31) M. R. Garey and D. S. Johnson, “Computers and intractability,” A Guide to the, 1979.
- (32) L. G. Valiant, “The complexity of enumeration and reliability problems,” SIAM Journal on Computing, vol. 8, no. 3, pp. 410–421, 1979.
- (33) D. Venturelli and A. Kondratyev, “Reverse quantum annealing approach to portfolio optimization problems,” Quantum Machine Intelligence, vol. 1, no. 1, pp. 17–30, 2019.
- (34) A. D. King, J. Carrasquilla, J. Raymond, I. Ozfidan, E. Andriyash, A. Berkley, M. Reis, T. Lanting, R. Harris, F. Altomare et al., “Observation of topological phenomena in a programmable lattice of 1,800 qubits,” Nature, vol. 560, no. 7719, pp. 456–460, 2018.
- (35) E. Farhi, J. Goldstone, and S. Gutmann, “A quantum approximate optimization algorithm,” arXiv preprint arXiv:1411.4028, 2014.
- (36) S. Hadfield, Z. Wang, B. O’Gorman, E. G. Rieffel, D. Venturelli, and R. Biswas, “From the quantum approximate optimization algorithm to a quantum alternating operator ansatz,” Algorithms, vol. 12, no. 2, p. 34, 2019.
- (37) S. Bravyi, D. P. Divincenzo, R. I. Oliveira, and B. M. Terhal, “The complexity of stoquastic local hamiltonian problems,” arXiv preprint quant-ph/0606140, 2006.
- (38) S. Bravyi and B. Terhal, “Complexity of stoquastic frustration-free hamiltonians,” Siam journal on computing, vol. 39, no. 4, pp. 1462–1485, 2010.
- (39) M. Marvian, D. A. Lidar, and I. Hen, “On the computational complexity of curing non-stoquastic hamiltonians,” Nature communications, vol. 10, no. 1, pp. 1–9, 2019.
- (40) E. Crosson, T. Albash, I. Hen, and A. Young, “De-signing hamiltonians for quantum adiabatic optimization,” Quantum, vol. 4, p. 334, 2020.
Appendix A 0-1-LP-QCOMMUTE is NP HARD
We reduce the 0-1-LP-QCOMMUTE problem to the EQUAL SUBSET SUM problem. We define the EQUAL SUBSET SUM problem as before:
Definition:
EQUAL SUBSET SUM Given a set , with , find two non-empty disjoint subsets, such that .
The EQUAL SUBSET SUM problem is known to be NP-Completewoeginger1992equal . We map an instance of the EQUAL SUBSET SUM problem to the 0-1-LP-QCOMMUTE problem; the former of which is defined over a set , with . In order to connect EQUAL SUBSET SUM with solving a linear system over discrete variables (the key of Theorem III.1), we will associate an assignment of integers in to the two subsets and with a function over such that with . We associate the value as the assignment gives to integer . Slightly abusing notation, this defines a function on any subset such that . When discussing a subset of a single element , we also abuse notation to allow for . We can then define an integer valued function . If we associate integers such that with integers in subset , and those with with integers in subset , then we can rewrite it as (note that means that the corresponding integer is not chosen for any of the two subsets). Then, EQUAL SUBSET SUM has a solution if and only if there is an assignment function with a nontrivial image such that .
However, we need a vector representation to exploit the structure of Theorem III.1. Let be the maximum of . We define as the matrix with the binary representations of as its column vectors. Given , we define entry – referring to the -th bit of integer . This defines a matrix with .
The idea is that we wish to give each integer an associated binary vector such that multiplying a binary vector with corresponds to selecting that integer to participate in a sum. We refer to the vectorized form of as such that . Since multiplying a matrix by a vector on the right results in a linear combination of the matrix columns, with the coefficients being the corresponding components of the vector, it would be tempting to assume that , since the columns of are associated with the integers in . Then we would have something like if and only if , providing our desired connection between Theorem III.1 and EQUAL SUBSET SUM.
Unfortunately this does not work, since the columns of contain a binary representations of the integers , while the expression refers to the usual addition of integers, and not bit component wise addition. To illustrate what we mean with this, consider the (improper) set which delineates:
Even though the associated EQUAL SUBSET SUM problem has a simple solution associated with the function (assign the first two integers to subset and the third to subset ), a simple calculation shows that . From the example above we can see that what we are missing is a way of incorporating the “bit carry" that occurs in binary addition into the operations of regular matrix-vector multiplication. The main goal of this appendix is to show how this can be accomplished by embedding these matrix operations into a larger vector space.
In order to resolve this issue, we will introduce a mechanism to do generalized bit addition - bit addition that is generalized to when the bit values can both be positive and negative as well as zero. We add ancillary bits such that is the assignment expanded to this new space as . Slightly abusing notation, for any subset with and , we define . We construct new constraints such that . Moreover, will allow for a vectorized form and a matrix (see A.2) such that . Intuitively, picks coefficients for values over and is subsequently forced to take values on corresponding to doing valid bit addition and only satisfies if the bit entries of the total sum is indeed zero. Fig. 1 gives a visual description of the steps used to create our full reduction. As such, for a given set of integers , we follow the reduction to construct a binary matrix such that the row vectors of define the constraint operators . This serves as the input binary LP to the oracle solver of 0-1-LP-QCOMMUTE to tell us if a Hamiltonian exists such that has an off-diagonal term in the spin-z basis that shows the existence of , which describe two subsets and as the solution to the given Equal Subset Sum problem.
A.1 Generalized Full Adder
Inputs | Output | ||||
Primary | Secondary | ||||
a | b | s | c | s | c |
-1 | -1 | 0 | -1 | - | - |
-1 | 0 | -1 | 0 | 1 | -1 |
-1 | 1 | 0 | 0 | - | - |
0 | -1 | -1 | 0 | 1 | -1 |
0 | 0 | 0 | 0 | - | - |
0 | 1 | 1 | 0 | -1 | 1 |
1 | -1 | 0 | 0 | - | - |
1 | 0 | 1 | 0 | -1 | 1 |
1 | 1 | 0 | 1 | - | - |
In this section we describe how to build the basis for our reduction, which is to find a matrix such that the values takes on the set are added bitwise over the ancillary bits . There will be specific ancillary bits such that the total sum that takes on can be deduced from its value on these bits. Consider again the simple example we introduced in the previous section. We will add ancillary variables such that their values are forced to be what is dictated by the bit addition of values in . This can be summarized in Table 1. If takes a particular value on two inputs and , then the table describes what value will be forced to take on new ancillary values and (representing the sum and carry bits respectively).
Like the ordinary adder, the generalized adder accepts all values such that except now for any and so . Note that then the carry bit and the sum bit are not unique like in the case of the ordinary full adder. For example if and , then it is possible that and like in the ordinary adder, but also that and . Since is the same value for both, they are both technically valid. The operations keen to the ordinary full adder we refer to as primary and those that do not as secondary. When possible, a primary operation will set the carry bit to zero while a secondary operation will set the carry bit to either one or negative one. One may hope that we could force the primary mode of operation, but we could not construct a 0-1 matrix that could force these modes of operations over the secondary modes since our condition for satisfaction is through equivalence statements like , but no equivalence statement can state a preference in representation. While it does not affect the correctness of our result, it does mean that the number of solutions is not preserved in our reduction - there are many valid that reduced to a single . The reduction is therefore not parsimonious.
To enforce the generalized adder between two inputs and two outputs we need to generate the correct submatrix. Given inputs and , we define the matrix on - with being intermediating ancillas - as:
(15) |
As constraints, we can write it as:
(16) | ||||
(17) | ||||
(18) | ||||
(19) | ||||
(20) | ||||
(21) |
A.2 The Simple Reduced Case
Before we move on to give a general protocol for any given problem, we consider the simple case we described earlier with the integer (improper) set . We give a slightly reduced description for this problem to show what the reductions typically look like. We implement a generalized adder for the bits and - introducing the ancillary bits that are the corresponding carry and sum bit. We then implement a generalized adder for the bits and - introducing the ancillary bits that the corresponding carry and sum bit. As such, , since the latter condition is equivalent to saying that the bitwise sum of the two sets is zero. This is represented in Fig. 2A. Each box in the diagram refers to a generalized full adder. In words, we add the assignments of the bits and add the respective carry bit assignment with the assignment on the bit . The resulting integer is given by - the first row sum bit, the second row sum bit, and what can be considered the third row sum bit added with their respective power of two. This must be zero if defines subsets of equal sums and therefore must be zero on each of them.
![]() |
![]() |
A | B |
The resulting matrix - here we use a tilde to signify that we are in the reduced construction case - that this process defines can be represented as:
(38) |
One can check that if , then . The vector defines the assignment - since are the first three entries of the vectorized form. This defines the two sets and as a solution to the EQUAL SUBSET SUM problem posed. One can check that is also a solution, corresponding to the sets and .
In this reduced construction, we only used the generalized full adder for the significant bits of each for a given bit entry . This helps to greatly reduce the size of the resulting embedding, but hopefully still conveys the principal idea behind our reduction. While we could write a general protocol on the same principle, it requires a more involved strategy than the one we take.
A.3 The Simple Unreduced Case
To simplify the construction of the embedding at the cost of increasing their corresponding size, we follow the same logic as before, but do not prune the insignificant bits. In the unreduced construction, we “compute” the sum bit by bit. Like in the reduced case, the resulting sum bit at the end of each layer corresponds to a bit entry that the sum defined by takes - remember, in the end, the value of was described bitwise by the value took on the last sum bit in each layer plus the last layer’s carry bit (e.g. ). This remains the same in the unreduced representation. Note that nonzero sums can have multiple bit representations when the entries can be negative or positive, i.e. , while the sum has only one.
In words, we add the bits of each integer in the corresponding bit entry as well as all carry bits from the previous layer to find the total sum of all the integers if none of them had significant bits beyond this layer. Let be the last sum bit for any row . Then the total sum up to the current layer can be written as for some . Then we identify as the last sum bit of the current layer, and as the net number of carries passed from layer to .
Consider again the simple case we described earlier. We have a (improper) set , such that we can identify each of these three values as . Refer to Fig. 2B to see the resulting diagram that this construction will give. Then are the first bits of each of these three. We use generalized full adders to add - bit by bit - the values and feed the resulting carry bits to the next layer while takes the value of the lowest bit entry for the total sum of the assignment. In the second layer we add - bit by bit - the values and feed the resulting carry bits to the next layer while takes the value of the second lowest bit entry for the total sum. Since the maximum bit entry was given in row two, row three adds only the carry bits , which generates the carry bits that are subsequently fed into layer four while is the third lowest bit entry for the total sum. Layer four adds the carry values and generates the corresponding carry bits as well as the sum bit . Lastly, layer five adds these values and generates the corresponding carry bit as well as the last sum bit . To complete our description, each layer has internal sum variables from each generalized adder. Every line in the diagram corresponds to a variable; variables that are between two boxes are intermediaries, such as all the carry bits except and all the sum bits except the last ones in each layer. For example, layer one has - an intermediate sum bit that is passed from the first generalized adder to the second. This is in contrast to , which is the sum bit of the second generalized adder and is the lowest bit entry for the total sum of the assignment. All carry bits except for the very last one - the one from the single generalized adder in the last row - are intermediaries. Variables that are not between boxes are determined; are set to the -th lowest bit in the -th integer of the set while for layer and are set to one in the corresponding matrix.
A.4 The General Unreduced Case
Before we turn our attention to a full protocol for the general unreduced case, we give a more intuitive and visual description of the reduction. Fig. 3 gives a schematic of what the general case looks like. Note that Fig. 2B fits precisely this description as well.
We call the generalized function with the truth table corresponding to Table 1 as and for the sum and carry bit respectively, and so the constraints we considered earlier enforce: and . We use the common convention of writing as a condensed form of so that . These are not proper functions since and sometimes have two valid modes of operation. We also define to help condense our writing.
To enforce the right bit addition, we use the following protocol:
-
1.
Let , , and .
-
2.
Generate carry bits () and append them to as well as sum bits () and append them to . Add constraints to that will enforce between in order, such that for any assignment , is valid if and only if
(39) (40) (41) (42) Then place constraints to that will enforce between (the carry ins from the previous layer) and such that for any assignment , is valid if and only if:
(43) (44) -
3.
Let . If , then Go to Step 2.
-
4.
At the last run of step 2., we had total carry bits. Now we add layers feeding carries forward like before, but without introducing any new bits from the actual integers. As such, in each layer, we will have one less carry bit generated than the layer before it.
-
5.
Let
-
6.
Generate carry bits and append them to as well as sum bits () and append them to . Add constraints to that will enforce GA on the carry bits of the previous layer. For the first layer:
(45) (46) (47) (48) For all the subsequent layers:
(49) (50) (51) (52) -
7.
Let . If , go to Step 6.
-
8.
Lastly add constraints to force the last sum bit in each row to be zero, those constraints simply are for and for (check Fig. 3). We also add .
Theorem A.1.
Suppose there exists such that , then and only then does there exist such that (where refers to the last sum bit in each row as shown in 3). Then .
Proof.
We first consider the forward direction. First recognize that . It must be that . Then . Note that if inputs and have different signs for the generalized adder, the carry and sum bits are both zero, if and are the same sign then they pass a carry. When one is zero, then the other one is simply passed on using the primary operation of and . In the forward direction of the proof, we only need to consider the primary operations. As such, it is clear that since the number of positive and negative inputs added is zero modulo 2. It should also be straight forward to see that . Now recognize that . Note that where we can identify , with for all . Here has a Heaviside step function to differentiate between the indexing of rows generated by Step 2 of the protocol versus those generated later by Step 6. Again it is clear that since the number of positive inputs and negative inputs of is zero modulo 2. Since , we must only worry at most about rows, but we have rows as zero for .
We now consider the backward direction. The proof will look very similar to the forward direction, but now we also have to give some consideration that could make use of secondary operations, not just primary operations. Consider in a specific row, we used the secondary operations, e.g. and . Here we used the tilde to alert the reader that these are the secondary operations specifically. We know that for any layer as the assumption, and so the number of operations is even. It must be of opposite kinds such that the number of total carries is unchanged (since they are still valid operations such that ) - for every operation that propagrates an extra carry at the expense of reducing its sum bit there must be a secondary operation that reduces its carry bit to surplus its sum bit. If not, then . Then we can replace them with the primary operations. The rest of the arguments follow through as before. We have and since with , we have . Again and we know that . By the same bound, we know that after rows having zero on all the outputs is sufficient to see that and so let for every . ∎
Given an input integer set , this protocol outputs constraint set (the variables with indices such that the entry is nonzero in ) such that an assignment vector has value zero for every constraint in the set if and only if these exists a valid assignment for that defines two disjoint nonempty sets and such that . We can then identify the constraint operators as the row vectors of as coefficients on spin-z operators on each qubit: , such that our solver for 0-1-LP-QCOMMUTE finds a Hermitian matrix that commutes with these constraint operators.
A.5 Proof of Runtime
In the worse case, we construct no more than new variables and constraints for each illustrated in Fig. 3. For row , this leads to no more than new variables and constraints. Then after row , we have no more than variables and constraints. Row has no more than generalized adders, creating no more than new variables and constraints. In total, we have no more than variables and constraints. The constraint matrix therefore has size . The reduction is therefore a polynomial time algorithm.
A.6 Reducing a Solution of ILP-COMMUTE to a Solution of EQUAL SUBSET SUM
We consider the same set up as in Section V. Using the protocol from Section A (check Fig. 1) we can reduce any instance of the EQUAL SUBSET SUM problem with polynomial overhead, and if any solution to 0-1-LP-QCOMMUTE exists, there must be and (and therefore the sets and ) to describe at least one off-diagonal term in the spin-z basis. By our construction, the ancilla bits used for forcing are the bits beyond the n-th bit. Similarly, if a solution to EQUAL SUBSET SUM exists, by selecting the values of and to match the indices of chosen elements for the sets and , we are able to set the values of the first bits and then propagate their value through the general adder to find and over the enlarged space. Then solves 0-1-LP-QCOMMUTE. This leads to the following Theorem:
Theorem A.2.
0-1-LP-QCOMMUTE is NP-Hard.
Through the same proof that ILP-QCOMMUTE is polynomial verifiable, 0-1-LP-QCOMMUTE is likewise polynomial verifiable.
Theorem A.3.
0-1-LP-QCOMMUTE is NP-Complete.
It also leads to an important corollary:
Corollary A.3.1.
-LP-QCOMMUTE is NP-Complete.
As well as another proof to the result in Section V:
Corollary A.3.2.
ILP-QCOMMUTE is NP-Complete.
Appendix B Proof of the Matrix Implementation of the Generalized Adder
Given inputs and , we define the matrix on - with being intermediating ancillas - as:
(60) |
As constraints, we can write it as:
(61) | ||||
(62) | ||||
(63) | ||||
(64) | ||||
(65) | ||||
(66) |
For every generalized adder in Fig. 3 (as described in the protocol we gave in Section A.1), we have a submatrix over the corresponding variables. We give a simple case by case proof that enforces to be valid if and only if its entries satisfy as seen in Fig. 1.
A constraint is satisfied if and only if the assignment over the variables of that constraint sums to zero. Then an assignment satisfies all of them if for all . Although checkable through brute force calculations, we give simple arguments for emulation of bit addition step by step:
If , then and only then do we have and . If and , then two of the auxillary bits must have an assignment of -1 and one must not. If then by , but then by and vice versa. Then , otherwise cannot be satisfied. Then as wanted. Suppose that and , then likewise and force that . Then from , we have that and so from that .
If and or and , then and only then do we have and or and . Suppose that or , but not both. From , we know that either one of the auxillary bits must take value -1 or two take the value -1 and one takes the value 1. If either or take value -1, but not the other then and lead to a contradiction, then if and by it must be that . Otherwise and so by and . forces that . Suppose that and . Then from and from and . Then is only satisfied if or , but not both. Suppose instead that and . Then by it must be that . By and , it must be that and . Then by it must be that or is 1, but not both.
If , then and only then do we have and . Suppose that . From , we know that at most two auxillary bits are non-zero and they have opposite sign. From and if one of the first two auxillary bits is non-zero then so is the other one, but they must have the same sign. As such can only be satisfied with . Then it follows that . Suppose that . From , , and , we have that . Then can only be satisfied if .
The same logic works if we swap the values and everywhere in the above proof.