Traditional methods for handling (inequality) constraints in the quantum approximate optimization (QAOA) typically rely on penalty terms and slack variables, which increase problem complexity and expand the search space. More sophisticated mixer-based QAOA variants restrict the search within the feasible assignments but often suffer from prohibitive circuit complexity. This paper presents a penalty-free formalism for incorporating inequality constraints into the cost function of QAOA using an oracle-based subroutine that evaluates constraint satisfaction in an additional register, subsequently called indicator function QAOA (IF-QAOA). Applied to the knapsack problem, we demonstrate in numerical simulations the superior performance of IF-QAOA over conventional penalty-based approaches. Using advanced QAOA simulation techniques, we find that IF-QAOA achieves significantly higher solution quality and a faster time to solution in 82% of our benchmark cases, even though circuit depth is approximately three times larger. Analysis of the scaling behavior shows favorable scaling of IF-QAOA compared to penalty-based methods. Also, benchmarks against the recently developed quantum tree generator QAOA for knapsack problems (P. Christiansen , ) demonstrated higher solution quality for circuits of similar depth. Additionally, this paper introduces a method for approximating the indicator function when the number of ancillary qubits is limited or the constraint function is noninteger. With a specialized simulation algorithm based on projective measurements, we empirically demonstrate that this formalism can encode general inequality constraints using a fixed number of ancillary qubits.
Traditional methods for handling (inequality) constraints in the quantum approximate optimization (QAOA) typically rely on penalty terms and slack variables, which increase problem complexity and expand the search space. More sophisticated mixer-based QAOA variants restrict the search within the feasible assignments but often suffer from prohibitive circuit complexity. This paper presents a penalty-free formalism for incorporating inequality constraints into the cost function of QAOA using an oracle-based subroutine that evaluates constraint satisfaction in an additional register, subsequently called indicator function QAOA (IF-QAOA). Applied to the knapsack problem, we demonstrate in numerical simulations the superior performance of IF-QAOA over conventional penalty-based approaches. Using advanced QAOA simulation techniques, we find that IF-QAOA achieves significantly higher solution quality and a faster time to solution in 82% of our benchmark cases, even though circuit depth is approximately three times larger. Analysis of the scaling behavior shows favorable scaling of IF-QAOA compared to penalty-based methods. Also, benchmarks against the recently developed quantum tree generator QAOA for knapsack problems (P. Christiansen , ) demonstrated higher solution quality for circuits of similar depth. Additionally, this paper introduces a method for approximating the indicator function when the number of ancillary qubits is limited or the constraint function is noninteger. With a specialized simulation algorithm based on projective measurements, we empirically demonstrate that this formalism can encode general inequality constraints using a fixed number of ancillary qubits.
This paper proposes a novel combination of constraint encoding methods for the Quantum Approximate Optimization Ansatz (QAOA). Real-world optimization problems typically consist of multiple types of constraints. To solve these optimization problems with quantum methods, normally, all constraints are added as quadratic penalty terms to the objective, which expands the search space and increases problem complexity. This work proposes a general workflow that extracts and encodes specific constraints directly into the circuit of QAOA: One-hot constraints are enforced throughXY-mixers that restrict the search space to the feasible sub-space naturally. Inequality constraints are implemented through oracle-based Indicator Functions (IF). This paper focuses on the numerical benchmarks of the combined approach for solving the Multi-Knapsack (MKS) and the Prosumer Problem (PP), a modification of the MKS in the domain of electricity optimization. To this end, we introduce computational techniques that efficiently simulate the two presented constraint architectures. SinceXY-mixers restrict the search space, specific state vector entries are always zero and can be omitted from the simulation, saving valuable memory and computing resources. We benchmark the combined method against the established QUBO formulation, yielding a better solution quality and probability of sampling the optimal solution. Despite more complex circuits, the time-to-solution is more than an order of magnitude faster compared to the baseline methods and exhibits more favorable scaling properties.
Inequality constraints in combinatorial optimization are conventionally handled by introducing slack variables and quadratic penalties, which increase the qubit count and distort the optimization landscape. Slack-free formulations instead apply a nonlinear custom penalty function directly to the constraint, which are difficult to be implemented in quantum approximate optimization algorithm (QAOA). We show that the Walsh--Hadamard transform (WHT) removes this obstruction for any penalty function: a penalty applied to a linear constraint is exactly a weighted sum of Pauli-Z strings. We propose this framework as the Walsh custom penalty QAOA (WCP-QAOA). Truncating the expansion at Walsh degree k costs O(nk) Pauli terms and leaves the qubit count untouched. The truncation is the optimal degree-k approximation of the penalty in L2, and we give a condition on the discarded Walsh coefficients under which the truncated Hamiltonian still ranks every feasible solution below every infeasible one. Since evaluating a Walsh coefficient from its definition requires all 2n penalty values, we give an algorithm that returns any coefficient in sub-exponential time, so that the degree-k Hamiltonian is obtained in time polynomial in n for fixed k. We show that for the exponential penalty, there exists a closed product form of WHT, and hence a closed form expression to calculate the Walsh coefficients. We identify structural shortcuts that shorten the exact spectrum. We also tested WCP-QAOA in solving a 6-qubit knapsack problem.
Quantum computing approaches, such as Quantum Annealing (QA) and the Quantum Approximate Optimization Algorithm (QAOA), have emerged as promising candidates for solving combinatorial optimization problems. Since these approaches typically work with Quadratic Unconstrained Binary Optimization (QUBO) problems, constraints, when present, are commonly encoded as penalty terms. Conventional approaches to incorporate inequality constraints into QUBO formulations additionally require the introduction of slack variables, increasing the required number of qubits. The Knapsack and Bin Packing problems are optimization problems with such inequality constraints. We show that the number of slack variables required to formulate the Knapsack problem as a QUBO problem can be reduced using certain properties specific to this problem. Moreover, we present two separate strategies for the Knapsack and Bin Packing problems that avoid using the costly slack variables altogether. Instead, both strategies solve several QUBO problems, with varying penalty constants, such that at least one of them is a good representation of the given optimization problem. Numerical simulations of QAOA, as well as experiments on a D-Wave quantum annealer, show that these slack-less approaches can improve performance compared to the conventional slack variable method (in terms of success probability), even when the latter is allowed to vary penalty constants too.
Quantum optimization is emerging as a prominent candidate for exploiting the capabilities of near-term quantum devices. Many application-relevant optimization tasks require the inclusion of inequality constraints, usually handled by enlarging the Hilbert space through the addition of slack variables. This approach, however, requires significant additional resources especially when considering multiple constraints. Here, we study an alternative direct implementation of these constraints within the quantum approximate optimization algorithm, achieved using qudit-sum gates, and compare it to the slack variable method generalized to qudits. We benchmark these approaches on three paradigmatic optimization problems. We find that the direct implementation of the inequality penalties vastly outperforms the slack variables method, especially when studying real-world inspired problems with many constraints. Within the direct penalty implementation, a linear energy penalty for unfeasible states outperforms other investigated functional forms, such as the canonical quadratic penalty. The proposed approach may thus be an enabling step for approaching realistic industry-scale and fundamental science problems with large numbers of inequality constraints.
In variational quantum algorithms, constraints are usually added to the problem objective via penalty terms. Already for linear inequality constraints, this procedure requires additional slack qubits. These extra qubits tend to blow up the search space and complicate the parameter landscapes to be navigated by the classical optimizers. In this work, we explore approaches to model linear inequalities for quantum algorithms without these drawbacks. More concretely, our main suggestion is to omit the slack qubits completely and evaluate the inequality classically during parameter tuning. We test our methods on QAOA as well as on Trotterized adiabatic evolution, and present empirical results. As a benchmark problem, we consider different instances of the multi-knapsack problem. Our results show that removing the slack bits from the circuit Hamiltonian and considering them only for the expectation value yields better solution quality than the standard approach. The tests have been carried out using problem sizes up to 26 qubits. Our methods can in principle be applied to any problem with linear inequality constraints, and are suitable for variational as well as digitized versions of adiabatic quantum computing.
This paper introduces a novel approach to the Quantum Approximate Optimization Algorithm (QAOA), specifically tailored to the knapsack problem. We combine the recently proposed quantum tree generator as an efficient state preparation circuit for all feasible solutions to the knapsack problem with the framework of Grover-mixer QAOA to form the first representative of Amplitude Amplification-mixer QAOA (AAMQAOA). On hard benchmark sets with up to 20 knapsack items, we demonstrate our method's improved performance over the current state-of-the-art Copula-QAOA. However, for larger instance sizes, both approaches fail to deliver better outcomes than greedily packing items in descending value-to-weight ratio, at least for the considered circuit depths. For sufficiently high circuit depths, however, we can prove that AAM-QAOA will eventually be able to sample the optimal solution.