Engineering the Cost Function of a Variational Quantum Algorithm for Implementation on Near-Term Devices