Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add norm of update vector as error measure in Newton algorithm #956

Merged
merged 18 commits into from Jun 19, 2020

Conversation

sdrave
Copy link
Member

@sdrave sdrave commented Jun 16, 2020

This PR improves/extends pymor.algorithms.newton.newton in the following ways:

  • The new error_measure parameter allows choosing between the norm of the 'residual' and the norm of the 'update' vector as a measure for the error. In the case of the update vector, the realtive tolerance is to be understood in relation to the norm of the current solution.
  • The defaults were changed to use the norm of the update vector with a relative tolerance of 1e-7 (about half machine precision).
  • Armijo line search is enabled by default.
  • error_product has been replaced with range_product and source_product as different inner products may be needed for computing the norm of the residual and the norm of the solution/update vector.
  • The atol and rtol arguments have switched places in agreement with other functions in pyMOR.
  • Logging has been improved and now also reports the norms of the solution and of the update vector.
  • The implementation has been cleaned up a bit.

Arguments for the new defaults:

  • The desired absolute value for the residual norm is impossible to know without knowing the application. A relative tolerance does not really improve the situation, as the initial norm of the residual is highly dependent on the intial guess. Both are useless in the context of residual minimization, where the residual never goes to zero. The stagnation criterion is too lax and produces solutions without the algorithm converging to anything.
  • On the other hand, it can be expected for a converging newton algorithms, that the updates are by a significant factor smaller than the norm of the current approximation. What can happen is that the algorithm converges to a local optimum, in which case a criterion based on the norm of the update will fail. However, this is less dangerous than the stagnation criterion, which will also report convergence when the solution oscillates. Overalls specifying a relatively low rtol for the update vector seems to be a good compromise to me for a default. It also works for resdiual minimization.
  • Armijo line search may be unnecessarily expensive in some cases, but I would prefer a more robust algorithm by default.

Fixes #896.

@sdrave sdrave requested a review from pmli Jun 16, 2020
@sdrave sdrave added this to the 2020.1 milestone Jun 16, 2020
@sdrave sdrave added algorithms pr:new-feature labels Jun 16, 2020
@sdrave
Copy link
Member Author

@sdrave sdrave commented Jun 16, 2020

@HenKlei, what do you think?

src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
@sdrave
Copy link
Member Author

@sdrave sdrave commented Jun 18, 2020

I resolved the error_product issue by replacing the parameter by range_product/source_product.

@sdrave sdrave marked this pull request as ready for review Jun 18, 2020
Copy link
Member

@pmli pmli left a comment

I just have some comments about the documentation. Otherwise, it looks good to me (except for the failure in testing).

src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
src/pymor/algorithms/newton.py Outdated Show resolved Hide resolved
Co-authored-by: Petar Mlinarić <mlinaric@mpi-magdeburg.mpg.de>
@codecov
Copy link

@codecov codecov bot commented Jun 18, 2020

Codecov Report

Merging #956 into master will increase coverage by 0.11%.
The diff coverage is 92.00%.

Impacted Files Coverage Δ
src/pymor/operators/interface.py 86.20% <71.42%> (+0.09%) ⬆️
src/pymor/algorithms/newton.py 92.94% <95.34%> (+2.03%) ⬆️
src/pymor/bindings/fenics.py 82.36% <0.00%> (+0.78%) ⬆️
src/pymor/operators/list.py 73.26% <0.00%> (+8.91%) ⬆️

@sdrave sdrave merged commit 2d08418 into master Jun 19, 2020
8 checks passed
@sdrave sdrave deleted the newton_update_criterion branch Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants