Skip to content

Commit

Permalink
240208.141456.HKT minor
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Feb 8, 2024
1 parent 927b1d0 commit 7b984cf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions fortran/bobyqa/bobyqb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module bobyqb_mod
!
! Started: February 2022
!
! Last Modified: Saturday, January 27, 2024 AM02:34:58
! Last Modified: Wednesday, February 07, 2024 AM10:23:41
!--------------------------------------------------------------------------------------------------!

implicit none
Expand Down Expand Up @@ -299,7 +299,7 @@ subroutine bobyqb(calfun, iprint, maxfun, npt, eta1, eta2, ftarget, gamma1, gamm
shortd = (dnorm < HALF * rho)

! Set QRED to the reduction of the quadratic model when the move D is made from XOPT. QRED
! should be positive If it is nonpositive due to rounding errors, we will not take this step.
! should be positive. If it is nonpositive due to rounding errors, we will not take this step.
qred = -quadinc(d, xpt, gopt, pq, hq) ! QRED = Q(XOPT) - Q(XOPT + D)
trfail = (.not. qred > 1.0E-5_RP * rho**2) ! QRED is tiny/negative or NaN.

Expand Down
4 changes: 2 additions & 2 deletions fortran/common/preproc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module preproc_mod
!
! Started: July 2020
!
! Last Modified: Sunday, January 28, 2024 PM05:21:55
! Last Modified: Tuesday, February 06, 2024 PM03:31:32
!--------------------------------------------------------------------------------------------------!

! N.B.:
Expand Down Expand Up @@ -332,7 +332,7 @@ subroutine preproc(solver, n, iprint, maxfun, maxhist, ftarget, rhobeg, rhoend,
! Revise RHOBEG if needed.
! N.B.: If X0 has been revised above (i.e., HONOUR_X0 is FALSE), then the following revision
! is unnecessary in precise arithmetic. However, it may still be needed due to rounding errors.
rhobeg_old = rhobeg;
rhobeg_old = rhobeg
lbx = (is_finite(xl) .and. x0 - xl <= EPS * max(ONE, abs(xl))) ! X0 essentially equals XL
ubx = (is_finite(xu) .and. x0 - xu >= -EPS * max(ONE, abs(xu))) ! X0 essentially equals XU
x0(trueloc(lbx)) = xl(trueloc(lbx))
Expand Down
4 changes: 2 additions & 2 deletions fortran/lincoa/lincob.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module lincob_mod
!
! Started: February 2022
!
! Last Modified: Friday, January 26, 2024 PM07:20:59
! Last Modified: Wednesday, February 07, 2024 AM10:23:18
!--------------------------------------------------------------------------------------------------!

implicit none
Expand Down Expand Up @@ -396,7 +396,7 @@ subroutine lincob(calfun, iprint, maxfilt, maxfun, npt, Aeq, Aineq, amat, beq, b
end if

! Set QRED to the reduction of the quadratic model when the move D is made from XOPT. QRED
! should be positive If it is nonpositive due to rounding errors, we will not take this step.
! should be positive. If it is nonpositive due to rounding errors, we will not take this step.
qred = -quadinc(d, xpt, gopt, pq, hq) ! QRED = Q(XOPT) - Q(XOPT + D)
trfail = (.not. qred > 1.0E-5 * rho**2) ! QRED is tiny/negative or NaN.

Expand Down
19 changes: 19 additions & 0 deletions todo/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,22 @@ In addition, we may use statehist and radhist to improve fmsg, invoking it unifo
```
To this end, we will need to modify fmsg so that it can translate the state index (0, 1, 2, 3) to
the state name as mentioned above.

13. Try scaling the matrices H and PQ to avoid huge or tiny values.

14. Instead of requiring that each component of X0 is either on the boundary or is away from the
boundary by at least RHOBEG, we require that each component is away from one boundary by at least
RHOBEG or away from the other boundary by at least 2*RHOBEG. In other words,

(XU - X0 >= RHOBEG .OR. X0 - XL >= 2*RHOBEG) .AND. (X0 - XL >= RHOBEG .OR. XU - X0 >= 2*RHOBEG) .AND.

X0 - XL >= 2*RHOBEG .OR. XU - X0 >= 2*RHOBEG .OR. X0 - XL >= 2*RHOBEG .AND. XU - X0 >= 2*RHOBEG


When HONOUR_X0 is TRUE, instead of setting

RHOBEG = MINVAL([X-XL, XU-X]),

use

RHOBEG = MINVAL([MAX(X-XL, (XU-X) / 2), MAX(XU-X, (X-XL) / 2)]).

0 comments on commit 7b984cf

Please sign in to comment.