Skip to content

Commit 49a89ba

Browse files
committed
250907.225118.CST revise bobyqa/geometry regarding the definition of the alternative d
1 parent 8380b19 commit 49a89ba

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

fortran/bobyqa/geometry.f90

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1414
implicit none
@@ -477,6 +477,8 @@ function geostep(knew, kopt, bmat, delbar, sl, su, xpt, zmat) result(d)
477477
end 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?
480482
d = xline - xopt
481483
den_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
587589
end 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.
591593
if (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.
595596
end if
596597

597598
!====================!

0 commit comments

Comments
 (0)