-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle polyalgorithm aliasing correctly
- Loading branch information
Showing
5 changed files
with
137 additions
and
29 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@testitem "PolyAlgorithm Aliasing" begin | ||
using NonlinearProblemLibrary | ||
|
||
# Use a problem that the initial solvers cannot solve and cause the initial value to | ||
# diverge. If we don't alias correctly, all the subsequent algorithms will also fail. | ||
prob = NonlinearProblemLibrary.nlprob_23_testcases["Generalized Rosenbrock function"].prob | ||
u0 = copy(prob.u0) | ||
prob = remake(prob; u0 = copy(u0)) | ||
|
||
# If aliasing is not handled properly this will diverge | ||
sol = solve(prob; abstol = 1e-6, alias_u0 = true, | ||
termination_condition = AbsNormTerminationMode()) | ||
|
||
@test sol.u === prob.u0 | ||
@test SciMLBase.successful_retcode(sol.retcode) | ||
|
||
prob = remake(prob; u0 = copy(u0)) | ||
|
||
cache = init(prob; abstol = 1e-6, alias_u0 = true, | ||
termination_condition = AbsNormTerminationMode()) | ||
sol = solve!(cache) | ||
|
||
@test sol.u === prob.u0 | ||
@test SciMLBase.successful_retcode(sol.retcode) | ||
end |