@@ -8,7 +8,7 @@ module geometry_bobyqa_mod
88!
99! Started: February 2022
1010!
11- ! Last Modified: Sunday, April 21, 2024 PM03:19:27
11+ ! Last Modified: Sun 07 Sep 2025 10:44:12 PM CST
1212!- -------------------------------------------------------------------------------------------------!
1313
1414implicit none
@@ -477,6 +477,8 @@ function geostep(knew, kopt, bmat, delbar, sl, su, xpt, zmat) result(d)
477477end if
478478
479479! Calculate DENOM for the current choice of D. Indeed, only DEN_LINE(KNEW) is needed.
480+ ! Zaikun 20250907: It was observed numerically that D could be ZERO here (i.e., XLINE = XOPT).
481+ ! Should this be impossible in theory?
480482d = xline - xopt
481483den_line = calden(kopt, bmat, d, xpt, zmat)
482484
@@ -586,12 +588,11 @@ function geostep(knew, kopt, bmat, delbar, sl, su, xpt, zmat) result(d)
586588 d = s
587589end if
588590
589- ! In case D is zero or contains Inf/NaN, replace it with a displacement from XPT(:, KNEW) to
590- ! XOPT. Powell's code does not have this.
591+ ! In case D is zero or contains Inf/NaN, replace it with a displacement from XPT(:, KNEW) to XOPT.
592+ ! Powell's code does not have this. Note that it is crucial to ensure that a geometry step is nonzero .
591593if (sum (abs (d)) <= 0 .or. .not. is_finite(sum (abs (d)))) then
592594 d = xpt(:, knew) - xopt
593- scaling = delbar / norm(d)
594- d = max (0.6_RP * scaling, min (HALF, scaling)) * d
595+ d = min (HALF, delbar / norm(d)) * d ! Since XPT respects the bounds, so does XOPT + D.
595596end if
596597
597598! ====================!
0 commit comments