From d1a5557bfd845da06943c39e2c83ff4b41f82adf Mon Sep 17 00:00:00 2001 From: zaikunzhang Date: Wed, 3 Apr 2024 00:41:36 +0800 Subject: [PATCH] 240403.004137.HKT modify the definition of `ddmove`, using the update `kopt`, according to step 6 of the uobyqa algorithm in the uobyqa paper --- .development | 2 +- fortran/uobyqa/uobyqb.f90 | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.development b/.development index 6a63d30d29..52018974d3 160000 --- a/.development +++ b/.development @@ -1 +1 @@ -Subproject commit 6a63d30d29a41028aa5fb9bfd05ac23757e881dd +Subproject commit 52018974d355beaad1d8c51cf18211499a852c02 diff --git a/fortran/uobyqa/uobyqb.f90 b/fortran/uobyqa/uobyqb.f90 index 8d6b4dd8a8..2ac2483e18 100644 --- a/fortran/uobyqa/uobyqb.f90 +++ b/fortran/uobyqa/uobyqb.f90 @@ -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 @@ -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 @@ -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.