I am trying to understand the following Matlab definitions for RelTol and AbsTol parameters:
RelTol — This tolerance is a measure of the error relative to the size of each solution component. Roughly, it controls the number of correct digits in all solution components, except those smaller than thresholds AbsTol(i).The default, 1e-3, corresponds to 0.1% accuracy. AbsTol — AbsTol(i) is a threshold below which the value of the ith solution component is unimportant. The absolute error tolerances determine the accuracy when the solution approaches zero.
I do not understand why AbsTol determines the accuracy when the solution approaches zero (indeed, if the solution of my problem is a circular orbit of 7000 km radius this does not meet it) and why RelTol controls the number of correct digits in all solution components, except those smaller than thresholds AbsTol(i). What are the actual expressions for determining each tolerance? I would like to get simpler and understandable definitions.
When you perform an optimization, you need to decide when to stop. One way to check for whether your solution is good enough is to check whether the solution is still changing significantly. There are two ways to measure how much a solution changes: relative change (i.e. % change), or absolute change.
It makes a lot of sense to check for relative change, since a change of 5 means something very different when the solution is around 1 than when it is around 100000. Thus, the optimization routine checks, at every iteration i
whether abs(1-x(i)/x(i-1))<relTol
, i.e. by what fraction the new solution has changed since the last iteration. Note that x
can be an array of solutions if you're optimizing multiple parameters at the same time (the solution thus has "multiple components"). Of course, you want the condition to be fulfilled for all "solution components" before you stop optimizing further.
The relative tolerance, however, becomes problematic when the solution is around zero, since x/0
is undefined. Thus, it makes sense to also look at the absolute change in value, and quit optimizing when abs(x(i)-x(i-1))<absTol
. If you choose absTol
small enough, it will only be relTol
that counts for large solutions, while absTol
only becomes relevant if the solution comes to lie around 0.
Since the solver stops when either of the two criterion is fulfilled, how close you get to a (locally) optimal solution is determined by absTol
or relTol
. For example, if relTol
is 10%, you will never get much closer than 10% to the optimal solution, unless your solution is around zero, in which case the absTol
criterion (of, say, 0.0001) is satisfied before the relTol
criterion.
来源:https://stackoverflow.com/questions/8961844/relative-and-absolute-tolerance-definitions-in-matlab-solver