Add end-to-end tests of energy minimization