From 3fbbca4debe6bb1fe1bde2814176eb590dffd837 Mon Sep 17 00:00:00 2001 From: zaikunzhang Date: Tue, 19 Mar 2024 20:47:04 +0800 Subject: [PATCH] 240319.204704.HKT remove unused `factor_delta` from cobyla --- fortran/cobyla/cobylb.f90 | 17 +++++++++-------- fortran/cobyla/geometry.f90 | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fortran/cobyla/cobylb.f90 b/fortran/cobyla/cobylb.f90 index eb1dd971ba..18e24edace 100644 --- a/fortran/cobyla/cobylb.f90 +++ b/fortran/cobyla/cobylb.f90 @@ -17,7 +17,7 @@ module cobylb_mod ! ! Started: July 2021 ! -! Last Modified: Tuesday, March 19, 2024 PM06:46:06 +! Last Modified: Tuesday, March 19, 2024 PM08:44:31 !--------------------------------------------------------------------------------------------------! implicit none @@ -158,15 +158,16 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et ! 312--314 of Powell's cobylb.f code. Powell's code revises ACTREM to CVAL(N + 1) - CSTRV and PREREM ! to PREREC in this case, which is crucial for feasibility problems. real(RP), parameter :: cpenmin = EPS -! FACTOR_ALPHA, FACTOR_BETA, FACTOR_GAMMA, and FACTOR_DELTA are four factors that COBYLB uses -! when managing the simplex. Note the following. -! 1. FACTOR_ALPHA < FACTOR_GAMMA < 1 < FACTOR_DELTA <= FACTOR_BETA. -! 2. FACTOR_DELTA has nothing to do with DELTA, which is the trust-region radius. -! 3. FACTOR_GAMMA has nothing to do with GAMMA1 and GAMMA2, which are the contracting/expanding +! FACTOR_ALPHA, FACTOR_BETA, and FACTOR_GAMMA are factors that COBYLB uses when managing the +! simplex. Note the following. +! 1. FACTOR_ALPHA < FACTOR_GAMMA < 1 < FACTOR_BETA. +! 2. FACTOR_GAMMA has nothing to do with GAMMA1 and GAMMA2, which are the contracting/expanding ! factors for updating the trust-region radius DELTA. +! 3. Powell's used one more factor FACTOR_DELTA = 1.1 (in general, 1 < FACTOR_DELTA <= FACTOR_BETA). +! It has nothing to do with DELTA, which is the trust-region radius. It was used when defining +! JDROP_TR. We use a completely different scheme (see SETDROP_TR), which does not need FACTOR_DELTA. real(RP), parameter :: factor_alpha = QUART ! The factor alpha in the COBYLA paper real(RP), parameter :: factor_beta = 2.1_RP ! The factor beta in the COBYLA paper -real(RP), parameter :: factor_delta = 1.1_RP ! The factor delta in the COBYLA paper real(RP), parameter :: factor_gamma = HALF ! The factor gamma in the COBYLA paper ! Sizes @@ -203,7 +204,7 @@ subroutine cobylb(calcfc, iprint, maxfilt, maxfun, amat, bvec, ctol, cweight, et call assert(maxchist * (maxchist - maxhist) == 0, 'SIZE(CHIST) == 0 or MAXHIST', srname) call assert(factor_alpha > 0 .and. factor_alpha < factor_gamma .and. factor_gamma < 1, & & '0 < FACTOR_ALPHA < FACTOR_GAMMA < 1', srname) - call assert(factor_beta >= factor_delta .and. factor_delta > 1, 'FACTOR_BETA >= FACTOR_DELTA > 1', srname) + call assert(factor_beta > 1, 'FACTOR_BETA > 1', srname) end if !====================! diff --git a/fortran/cobyla/geometry.f90 b/fortran/cobyla/geometry.f90 index fe8433b295..cb3292549d 100644 --- a/fortran/cobyla/geometry.f90 +++ b/fortran/cobyla/geometry.f90 @@ -8,7 +8,7 @@ module geometry_cobyla_mod ! ! Started: July 2021 ! -! Last Modified: Thursday, March 14, 2024 PM07:23:41 +! Last Modified: Tuesday, March 19, 2024 PM08:45:03 !--------------------------------------------------------------------------------------------------! implicit none @@ -183,7 +183,7 @@ function setdrop_tr(ximproved, d, delta, rho, sim, simi) result(jdrop) !vsig = ONE / sqrt(sum(simi**2, dim=2)) !sigbar = abs(simid) * vsig ! -!! The following JDROP will overwrite the previous one if its premise holds. +!! The following JDROP will overwrite the previous one if its premise holds. FACTOR_DELTA = 1.1. !mask = (veta > factor_delta * delta .and. (sigbar >= factor_alpha * delta .or. sigbar >= vsig)) !if (any(mask)) then ! jdrop = int(maxloc(veta, mask=mask, dim=1), kind(jdrop))