Heaving airfoils can provide invaluable physical insight regarding the flapping flight of birds and insects. We examine the thrust-generation mechanism of oscillating foils, by coupling two-dimensional simulations with multi-objective optimization algorithms. We show that the majority of the thrust originates from the creation of low pressure regions near the leading edge of the airfoil. We optimize the motion of symmetric airfoils exploiting the Knoller-Betz-Katzmayr effect, to attain high speed and lower energy expenditure. The results of the optimization indicate an inverse correlation between energy-efficiency and the heaving-frequency and amplitude for a purely-heaving airfoil.