Skip to content

Commit b2b1a04

Browse files
committed
docs(advanced-jsosolvers): update TRUNK subsolver usage to new keyword API and add note on allowed subsolvers and tolerances (fixes #145)
1 parent 71339a3 commit b2b1a04

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

tutorials/advanced-jsosolvers/index.jmd

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,24 @@ using Krylov
5353
We define a dictionary of the different solvers that will be benchmarked.
5454
We consider here four variants of TRUNK using the different subsolvers.
5555

56+
Note on API updates: since JSOSolvers v0.11, subsolvers are selected using the keyword argument `subsolver` with a Symbol, for example `subsolver = :lsmr`. The previous form using `subsolver_type = CglsSolver` (and similar types) has been removed. The lists returned by `JSOSolvers.trunkls_allowed_subsolvers` and `JSOSolvers.tronls_allowed_subsolvers` enumerate the valid symbols you can pass.
57+
58+
```julia
59+
solvers = Dict(
60+
:trunk_cgls => nlp -> trunk(nlp; subsolver = :cgls),
61+
:trunk_crls => nlp -> trunk(nlp; subsolver = :crls),
62+
:trunk_lsqr => nlp -> trunk(nlp; subsolver = :lsqr),
63+
:trunk_lsmr => nlp -> trunk(nlp; subsolver = :lsmr)
64+
)
65+
```
66+
67+
If needed, you can also pass tolerances and runtime limits directly to `trunk` while selecting the subsolver:
68+
5669
```julia
70+
RTOL = 1e-6; ATOL = 1e-8; max_time = 60.0
5771
solvers = Dict(
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)
72+
:trunkls_lsmr => nlp -> trunk(nlp; rtol = RTOL, atol = ATOL, subsolver = :lsmr, max_time = max_time),
73+
:trunkls_cg => nlp -> trunk(nlp; rtol = RTOL, atol = ATOL, subsolver = :cg, max_time = max_time),
6274
)
6375
```
6476

0 commit comments

Comments
 (0)