Modified cost function. Refs #7789.