Optimizing a Polynomial Function on a Quantum Simulator.