Added batch interface.
Return the error associated with the optimum.

This helps clients evaluate the quality of the optimizer's output.