Skip to content

Commit d594bc2

Browse files
committed
2 parents 11346c4 + 0ec91db commit d594bc2

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

tutorials/linear-api/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ NLPModelsTest = "7998695d-6960-4d3a-85c4-e1bceb8cd856"
44
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
55

66
[compat]
7+
julia = "1"
78
NLPModels = "0.20"
89
NLPModelsTest = "0.9"
910
LinearOperators = "2.2"

tutorials/linear-api/index.jmd

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ We demonstrate how to:
1717

1818
## Example using a test problem
1919

20-
We use a problem from `NLPModelsTest` which may contain both linear and nonlinear constraints. The `NLPModelsTest` package exposes a collection of example problems useful for experimenting with the APIs.
20+
We use the `HS21` problem from `NLPModelsTest`, a standard constrained Hock--Schittkowski test problem. Choosing it by name keeps this tutorial stable across package versions and ensures the example exercises the constraint/Jacobian APIs that the linear API is designed to inspect.
2121

2222
```julia
2323
using NLPModelsTest, NLPModels, LinearOperators, LinearAlgebra
2424

25-
# Load a test problem (choose one that has constraints)
26-
list = NLPModelsTest.nlp_problems
27-
nlp = eval(Symbol(list[7]))()
25+
# Load a specific constrained test problem by name instead of relying on
26+
# the ordering of `nlp_problems`, which can change across package versions.
27+
problem_name = "HS21"
28+
@assert problem_name in NLPModelsTest.nlp_problems "$(problem_name) is not available in NLPModelsTest.nlp_problems"
29+
nlp = getfield(NLPModelsTest, Symbol(problem_name))()
2830

2931
# Point at which to evaluate
3032
x = nlp.meta.x0

0 commit comments

Comments
 (0)