Skip to content

Commit

Permalink
240319.204704.HKT remove unused factor_delta from cobyla
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Mar 19, 2024
1 parent f8d92fd commit 3fbbca4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions fortran/cobyla/cobylb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

!====================!
Expand Down
4 changes: 2 additions & 2 deletions fortran/cobyla/geometry.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 3fbbca4

Please sign in to comment.