@@ -4,15 +4,15 @@ tags: ["solvers", "krylov", "benchmark", "least squares"]
44author: "Tangi Migot"
55---
66
7- # Comparing subsolvers for nonlinear least squares in JSOSolvers
7+ # Comparing subsolvers for nonlinear least squares JSOSolvers solvers
88
99This tutorial showcases some advanced features of solvers in JSOSolvers.
1010
1111```julia
1212using JSOSolvers
1313```
1414
15- We benchmark different subsolvers used in the solver TRUNK for unconstrained nonlinear least squares problems.
15+ We benchmark different subsolvers used in the solvers TRUNK for unconstrained nonlinear least squares problems.
1616The first step is to select a set of problems that are nonlinear least squares.
1717
1818```julia
@@ -38,7 +38,7 @@ For this task, several solvers are available.
3838JSOSolvers.trunkls_allowed_subsolvers
3939```
4040
41- This benchmark could also be followed for the solver TRON where the following subsolvers are available.
41+ This benchmark could also be followed for the solver TRON where the following subsolver are available.
4242
4343```julia
4444JSOSolvers.tronls_allowed_subsolvers
@@ -50,35 +50,15 @@ These linear least squares solvers are implemented in the package [Krylov.jl](ht
5050using Krylov
5151```
5252
53- For example, to call TRUNK with an explicit subsolver and tolerances:
54-
55- ```julia
56- stats = trunk(nls; subsolver = :cgls)
57- ```
58-
5953We define a dictionary of the different solvers that will be benchmarked.
6054We consider here four variants of TRUNK using the different subsolvers.
6155
62- The same subsolver selection pattern applies to TRON’s least-squares specialization:
63-
64- ```julia
65- stats_tron = tron(nls; subsolver = :lsmr, rtol = RTOL, atol = ATOL, max_time = max_time)
66- ```
67-
68- ```julia
69- solvers = Dict(
70- :trunk_cgls => nlp -> trunk(nlp; subsolver = :cgls),
71- :trunk_crls => nlp -> trunk(nlp; subsolver = :crls),
72- :trunk_lsqr => nlp -> trunk(nlp; subsolver = :lsqr),
73- :trunk_lsmr => nlp -> trunk(nlp; subsolver = :lsmr)
74- )
75- ```
76-
7756```julia
78- RTOL = 1e-6; ATOL = 1e-8; max_time = 60.0
7957solvers = Dict(
80- :trunkls_lsmr => nlp -> trunk(nlp; rtol = RTOL, atol = ATOL, subsolver = :lsmr, max_time = max_time),
81- :trunkls_cg => nlp -> trunk(nlp; rtol = RTOL, atol = ATOL, subsolver = :cg, max_time = max_time),
58+ :trunk_cgls => model -> trunk(model, subsolver_type = CglsSolver),
59+ :trunk_crls => model -> trunk(model, subsolver_type = CrlsSolver),
60+ :trunk_lsqr => model -> trunk(model, subsolver_type = LsqrSolver),
61+ :trunk_lsmr => model -> trunk(model, subsolver_type = LsmrSolver)
8262)
8363```
8464
@@ -111,5 +91,5 @@ profile_solvers(stats, costs, costnames)
11191```
11292
11393The CRLS and CGLS variants are the ones solving more problems, and even though the difference is rather small the CGLS variant is consistently faster which seems to indicate that it is the most appropriate subsolver for TRUNK.
114- The size of the problems was rather small here, so this should be confirmed on larger instances .
94+ The size of the problems were rather small here, so this should be confirmed on larger instance .
11595Moreover, the results may vary depending on the origin of the test problems.
0 commit comments