  Developing quantum algorithms adaptive to specific constraints of near-term
devices is an essential step towards practical quantum advantage. In a recent
work [Phys. Rev. Lett. 131, 103601(2023)], we show cold atoms in an optical
cavity can be built as a universal quantum optimizer with programmable
all-to-all interactions, and the effective Hamiltonian for atoms directly
encodes number partitioning problems (NPPs). Here, we numerically investigate
the performance of quantum annealing (QA) and quantum approximate optimization
algorithm (QAOA) to find the solution of NPP that is encoded in the ground
state of atomic qubits. We find the success probability of the standard QA
decays rapidly with the problem size. The optimized annealing path or
inhomogeneous driving fields only lead to mild improvement on the success
probability. Similarly, the standard QAOA always gets trapped in a false local
minimum, and there is no significant performance improvement as we increase the
depth of the quantum circuit. Inspired by the counterdiabatic driving, we
propose an adaptive ansatz of QAOA which releases the parameter freedom of the
NPP Hamiltonian to match higher-order counterdiabatic terms. Through numerical
simulations, we find that our adaptive QAOA can achieve the optimal solution
within very small circuit depth. It is thus worth paying the extra optimization
cost of additional parameters for improving QAOA performance. Therefore, our
adaptive QAOA provides a promising choice for programmable atom-cavity systems
to demonstrate competitive computational power within its quantum coherence
time.
