我试图理解以下RelTol和AbsTol参数的Matlab定义:
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.
我不明白为什么AbsTol在解接近零时确定精度(事实上,如果我的问题的解是半径为7000公里的圆形轨道,则这不满足它)以及为什么 RelTol 控制所有解分量中正确数字的数量(除了那些小于阈值 AbsTol(i) 的分量)。确定每个容差的实际表达式是什么?我想要获得更简单且易于理解的定义。
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.
发布评论
评论(1)
当您执行优化时,您需要决定何时停止。检查您的解决方案是否足够好的一种方法是检查该解决方案是否仍在发生显着变化。有两种方法可以衡量解决方案的变化程度:相对变化(即变化百分比)或绝对变化。
检查相对变化非常有意义,因为当解在 1 左右时,5 的变化意味着与解在 100000 左右时非常不同。因此,优化例程在每次迭代时都会检查
i 是否
abs(1-x(i)/x(i-1)),即自上次迭代以来新解发生了多少变化。请注意,如果您同时优化多个参数,则 x 可以是解决方案数组(因此该解决方案具有“多个组件”)。当然,您希望在停止进一步优化之前所有“解决方案组件”都满足条件。
然而,当解接近零时,相对容差就会出现问题,因为 x/0 未定义。因此,查看值的绝对变化并在
abs(x(i)-x(i-1)) 时退出优化是有意义的。如果您选择的
absTol
足够小,则只有relTol
对大型解决方案有意义,而absTol
仅在解决方案不成立时才变得相关0 左右。由于当满足两个标准中的任何一个时求解器就会停止,因此您与(局部)最佳解决方案的接近程度由
absTol
或relTol
决定。例如,如果relTol
为 10%,那么您与最佳解决方案的距离永远不会比 10% 更接近,除非您的解决方案大约为零,在这种情况下,absTol
标准(例如,0.0001)在relTol
标准之前得到满足。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
whetherabs(1-x(i)/x(i-1))<relTol
, i.e. by what fraction the new solution has changed since the last iteration. Note thatx
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 whenabs(x(i)-x(i-1))<absTol
. If you chooseabsTol
small enough, it will only berelTol
that counts for large solutions, whileabsTol
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
orrelTol
. For example, ifrelTol
is 10%, you will never get much closer than 10% to the optimal solution, unless your solution is around zero, in which case theabsTol
criterion (of, say, 0.0001) is satisfied before therelTol
criterion.