Ensure constraints are satisfied
Open
@jonmaddock is already working on this.
Since Mar 21, 2024.
Triaged
- Dominant language
- Python
- Stars
- 71
- Forks
- 27
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 33
Description
In the past we found that VMCON was reporting that it had converged but the constraints were not accurately satisfied, although we never understood why. To fix this we added code to ensure that the constraints were satisfied before VMCON exited.
! Check convergence of constraint residuals
summ = 0.0D0
!do i = 1,m
! This only includes the equality constraints Issue #505
do i = 1,meq
summ = summ + conf(i)*conf(i)
end do
sqsumsq = sqrt(summ)
etc
if (verbose == 1) then
write(*,'(a,es13.5,a,es13.5)') &
'Constraint residuals (sqsumsq) = ',sqsumsq, &
' Convergence parameter = ',sum
end if
! Writting the step results in OPT.DAT file
do i = 1, n
delta_var(i) = delta(i)
end do
! Comment in to write optional optimisation information output file
! write(opt_file, '(I5,E28.10,*(E18.10))') niter+1, abs(objf), sum, sqsumsq, conf, x, delta_var
! Exit if both convergence criteria are satisfied
! (the original criterion, plus constraint residuals below the tolerance level)
! Temporarily set the two tolerances equal (should perhaps be an input parameter)
sqsumsq_tol = tol
! Store the lowest valid FoM (ie where constraints are satisfied)
if (sqsumsq < sqsumsq_tol) lowest_valid_fom = min(lowest_valid_fom, objf)
The line that actually checks for convergence:
if ((sum <= tol).and.(sqsumsq < sqsumsq_tol)) then
if (verbose == 1) then
write(*,*) 'Convergence parameter < convergence criterion (epsvmc)'
write(*,*) 'Root of sum of squares of residuals < tolerance (sqsumsq_tol)'
end if
exit_code = 1
return
end if
Proposed solution
It might help to add this additional convergence test to pyvmcon. One could also add a new line to the input code to allow sqsumsq_tol and tol to be input separately.
@jonmaddock @timothy-nunn
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.