-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix convergence check in Newton method (#1663)
Fixes a bug where the Newton solver and potentially simulation would run longer than necessary (introduced in #446 / edf7d5b). Also saves some memory (2 * nx_solver^2). > It seems that the value of `x_newton_` in `SteadystateProblem::applyNewtonsMethod`([applyNewtonsMethod](https://github.com/AMICI-dev/AMICI/blob/82d2cbb9d00ac9c3746b4e85c0fb1d6ebbff2863/src/steadystateproblem.cpp#L490)) doesn't change, but it's used to compute weighted root mean square of `xdot` and, therefore, is used to check convergence. As a result, convergence of Newton's method is achieved only due to `xdot_` becoming sufficiently small. For two models that require postequilibration I've observed simulations that finished with `posteq_status = [-4 1 0]`and `posteq_numstep = [0 0 0]`, i.e. Newton's method didn't converge, but the check here https://github.com/AMICI-dev/AMICI/blob/82d2cbb9d00ac9c3746b4e85c0fb1d6ebbff2863/src/steadystateproblem.cpp#L614 returned True and the simulation was considered successful with zero steps. Changing `x_newton_` to `x_` fixes the issue. * use x_ instead of x_newton_ for residuals computation * fix typos * Remove unused `SteadystateProblem::x_newton_` and `SteadystateProblem::rel_x_newton_`
- Loading branch information
1 parent
58f9a14
commit e6ab2bc
Showing
4 changed files
with
6 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters