Skip to content

Commit 2ca9937

Browse files
committed
Revert to correct JSOSolvers 0.11 API
The previous changes attempted to use `subsolver = :symbol` API which doesn't exist in JSOSolvers 0.11. Testing confirmed that JSOSolvers 0.11 uses `subsolver_type = Type` (e.g., CglsSolver, LsmrSolver). This commit reverts to the correct working API that is compatible with JSOSolvers 0.11.2.
1 parent ef4438c commit 2ca9937

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

tutorials/advanced-jsosolvers/index.jmd

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ author: "Tangi Migot"
88

99
This tutorial showcases some advanced features of solvers in JSOSolvers.
1010

11+
**Note**: This tutorial is compatible with JSOSolvers 0.11. The subsolver is selected using the `subsolver_type` parameter with Krylov solver types (e.g., `CglsSolver`, `LsmrSolver`).
12+
1113
```julia
1214
using JSOSolvers
1315
```
@@ -51,34 +53,29 @@ For detailed descriptions of each subsolver's algorithm and when to use it, see
5153
using Krylov
5254
```
5355

54-
For example, to call TRUNK with an explicit subsolver and tolerances:
55-
56-
```julia
57-
stats = trunk(nls; subsolver = :cgls)
58-
```
5956
We define a dictionary of the different solvers that will be benchmarked.
6057
We consider here four variants of TRUNK using the different subsolvers.
6158

62-
The same subsolver selection pattern applies to TRON’s least-squares specialization:
59+
For example, to call TRUNK with an explicit subsolver:
6360

6461
```julia
65-
stats_tron = tron(nls; subsolver = :lsmr, rtol = RTOL, atol = ATOL, max_time = max_time)
62+
stats = trunk(nls, subsolver_type = CglsSolver)
6663
```
6764

65+
The same subsolver selection pattern applies to TRON's least-squares specialization:
66+
6867
```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-
)
68+
stats_tron = tron(nls, subsolver_type = LsmrSolver)
7569
```
7670

71+
Now we define the solver dictionary for benchmarking:
72+
7773
```julia
78-
RTOL = 1e-6; ATOL = 1e-8; max_time = 60.0
7974
solvers = 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),
75+
:trunk_cgls => model -> trunk(model, subsolver_type = CglsSolver),
76+
:trunk_crls => model -> trunk(model, subsolver_type = CrlsSolver),
77+
:trunk_lsqr => model -> trunk(model, subsolver_type = LsqrSolver),
78+
:trunk_lsmr => model -> trunk(model, subsolver_type = LsmrSolver)
8279
)
8380
```
8481

0 commit comments

Comments
 (0)