Skip to content

Commit

Permalink
240403.004137.HKT modify the definition of ddmove, using the update…
Browse files Browse the repository at this point in the history
… `kopt`, according to step 6 of the uobyqa algorithm in the uobyqa paper
  • Loading branch information
zaikunzhang committed Apr 2, 2024
1 parent ed92be2 commit d1a5557
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .development
6 changes: 4 additions & 2 deletions fortran/uobyqa/uobyqb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module uobyqb_mod
!
! Started: February 2022
!
! Last Modified: Sunday, March 31, 2024 PM08:14:18
! Last Modified: Wednesday, April 03, 2024 AM12:02:22
!--------------------------------------------------------------------------------------------------!

implicit none
Expand Down Expand Up @@ -135,6 +135,7 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r
real(RP) :: ratio
real(RP) :: rho
real(RP) :: xbase(size(x))
real(RP) :: xdrop(size(x))
real(RP) :: xpt(size(x), size(distsq))
real(RP), allocatable :: pl(:, :)
real(RP), parameter :: trtol = 1.0E-2_RP ! Convergence tolerance of trust-region subproblem solver
Expand Down Expand Up @@ -343,13 +344,14 @@ subroutine uobyqb(calfun, iprint, maxfun, eta1, eta2, ftarget, gamma1, gamma2, r
! DDMOVE is norm square of DMOVE in the UOBYQA paper. See Steps 6--7 in Sec. 5 of the paper.
ddmove = ZERO
if (knew_tr > 0) then
ddmove = sum((xpt(:, knew_tr) - xpt(:, kopt))**2) ! KOPT is unupdated.
xdrop = xpt(:, knew_tr)
! Update PL, PQ, XPT, FVAL, and KOPT so that XPT(:, KNEW_TR) becomes XOPT + D.
call update(knew_tr, d, f, moderr, kopt, fval, pl, pq, xpt)
if (.not. (all(is_finite(pq)))) then
info = NAN_INF_MODEL
exit
end if
ddmove = sum((xdrop - xpt(:, kopt))**2) ! KOPT is updated.
end if
end if ! End of IF (SHORTD .OR. TRFAIL). The normal trust-region calculation ends.

Expand Down

0 comments on commit d1a5557

Please sign in to comment.