terminateRelativeError function

Terminates, if the relative deviation from the global optimum is small.