  Current state-of-the-art quantum optimization algorithms require representing
the original problem as a binary optimization problem, which is then converted
into an equivalent Ising model suitable for the quantum device. Implementing
each term of the Ising model separately often results in high redundancy,
significantly increasing the resources required. Instead, we propose to design
classical programs for computing the objective function and certifying the
constraints, and later compile them to quantum circuits, eliminating the
reliance on the binary optimization problem representation. This results in a
new variant of the Quantum Approximate Optimization Algorithm (QAOA), which we
name the Prog-QAOA. We exploit this idea for optimization tasks like the
Travelling Salesman Problem and Max-$K$-Cut and obtain circuits that are
near-optimal with respect to all relevant cost measures, e.g., number of
qubits, gates, and circuit depth. While we demonstrate the power of Prog-QAOA
only for a particular set of paradigmatic problems, our approach is
conveniently applicable to generic optimization problems.
