The computational complexity of optical quantum annealers and Ising machines