nils
11-06-2007, 05:24 PM
Two problems with the convergence criteria in dfpmin
1. The denominator for the convergence on the gradient is currently computed as
den=MAX(fret,1.0);
but for negative fret values, this is alway 1.0 !
I think this line should be
den=MAX(abs(fret), 1.0);
because the function to minimize does not need to be positive and the minimum can be a negative value.
2. The components of the gradient (partial derivatives) are multiplied with the absolute value of the components of the current point:
temp = abs(g[i])*MAX(abs(p[i]),1.0)/den
however, this should use the *change* of the component rather than its absolute value (the criteria should be invariant to translations of the minimization problem). In addition, the MAX(...,1.0) magic is useless, if not harmful here (guess it is a copy+paste bug from the denominator calculation of the Delta(x) convergence criteria a few lines above in the same routine. In a denominator, MAX(...,1.0) prevents dividing by zero and switches from relative to absolute differences - but here it is a multiplier, not a denominator).
So I think this line should read
temp = abs(g[i])*abs(xi[i])/den
(The vector xi is already computed as the difference of the current point minus the previous point before).
Both problems might have been unnoticed for a longer time, since problem 1. simply means that absolute instead relative differences are used and 2. does not have much impact if all the components of the solution are in order of magnitude one, as is stated in the last paragraph of section 9.7.2
1. The denominator for the convergence on the gradient is currently computed as
den=MAX(fret,1.0);
but for negative fret values, this is alway 1.0 !
I think this line should be
den=MAX(abs(fret), 1.0);
because the function to minimize does not need to be positive and the minimum can be a negative value.
2. The components of the gradient (partial derivatives) are multiplied with the absolute value of the components of the current point:
temp = abs(g[i])*MAX(abs(p[i]),1.0)/den
however, this should use the *change* of the component rather than its absolute value (the criteria should be invariant to translations of the minimization problem). In addition, the MAX(...,1.0) magic is useless, if not harmful here (guess it is a copy+paste bug from the denominator calculation of the Delta(x) convergence criteria a few lines above in the same routine. In a denominator, MAX(...,1.0) prevents dividing by zero and switches from relative to absolute differences - but here it is a multiplier, not a denominator).
So I think this line should read
temp = abs(g[i])*abs(xi[i])/den
(The vector xi is already computed as the difference of the current point minus the previous point before).
Both problems might have been unnoticed for a longer time, since problem 1. simply means that absolute instead relative differences are used and 2. does not have much impact if all the components of the solution are in order of magnitude one, as is stated in the last paragraph of section 9.7.2