Matlab求解器中的相对公差和绝对公差定义 [英] Relative and absolute tolerance definitions in Matlab solver

查看:822
本文介绍了Matlab求解器中的相对公差和绝对公差定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解以下有关RelTol和AbsTol参数的Matlab定义:

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.

我不明白为什么AbsTol会在解决方案接近零时确定精度(实际上,如果我的问题的解决方案是半径为7000 km的圆形轨道,那么它将不满足),而RelTol为何会控制其中的正确数字所有解决方案组件,但小于阈值AbsTol(i)的组件.确定每种公差的实际表达式是什么?我想获得更简单易懂的定义.

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.

检查相对变化很有意义,因为变化5意味着解决方案在大约1时与在大约100000时有很大的不同.因此,优化例程在每次迭代时进行检查i abs(1-x(i)/x(i-1))<relTol,即自上次迭代以来新解决方案已更改的比例.请注意,如果同时优化多个参数,则x可以是解决方案的数组(因此,解决方案具有多个组件").当然,您希望所有解决方案组件"都满足条件,然后再停止进一步优化.

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.

但是,由于x/0是不确定的,所以当解决方案约为零时,相对公差会成为问题.因此,在abs(x(i)-x(i-1))<absTol时也要查看值的绝对变化并退出优化是有意义的.如果选择的absTol足够小,则只有relTol才可计入大型解决方案,而absTol仅在解决方案位于0附近时才有意义.

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.

由于当两个条件中的任何一个满足时求解器都会停止,因此您通过(c5>或relTol)确定与(局部)最优解的接近程度.例如,如果relTol为10%,除非您的解决方案约为零,否则您将永远不会比最佳解决方案接近10%,在这种情况下,在满足absTol标准(例如0.0001)之前relTol标准.

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.

这篇关于Matlab求解器中的相对公差和绝对公差定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆