Skip to content

Commit dec190a

Browse files
authored
[documentation] Update the performance tips (#328)
* [documentation] Update the performance tips * Apply suggestions from code review
1 parent 1fc3b9c commit dec190a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

docs/src/performance.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Performance tips
22

3-
The package `ADNLPModels.jl` is designed to easily model optimization problems andto allow an efficient access to the [`NLPModel API`](https://github.com/JuliaSmoothOptimizers/NLPModels.jl).
3+
The package `ADNLPModels.jl` is designed to easily model optimization problems and to allow an efficient access to the [`NLPModel API`](https://github.com/JuliaSmoothOptimizers/NLPModels.jl).
44
In this tutorial, we will see some tips to ensure the maximum performance of the model.
55

66
## Use in-place constructor
@@ -79,7 +79,7 @@ v = ones(2)
7979
@btime jprod_residual!(nls_in, x, v, Fx)
8080
```
8181

82-
## Use only the needed operations
82+
## Use only the needed backends
8383

8484
It is tempting to define the most generic and efficient `ADNLPModel` from the start.
8585

@@ -120,6 +120,15 @@ or, equivalently, using the `matrix_free` keyword argument
120120
nlp = ADNLPModel!(f, x0, c_in, lcon, ucon, show_time = true, matrix_free = true)
121121
```
122122

123+
More classic nonlinear optimization solvers like [Ipopt.jl](https://github.com/jump-dev/Ipopt.jl), [KNITRO.jl](https://github.com/jump-dev/KNITRO.jl), or [MadNLP.jl](https://github.com/MadNLP/MadNLP.jl) only require the gradient and sparse Jacobians and Hessians.
124+
This means that we can set all other backends to `ADNLPModels.EmptyADbackend`.
125+
126+
```@example ex2
127+
nlp = ADNLPModel!(f, x0, c_in, lcon, ucon, jprod_backend = ADNLPModels.EmptyADbackend,
128+
jtprod_backend = ADNLPModels.EmptyADbackend, hprod_backend = ADNLPModels.EmptyADbackend,
129+
ghjvprod_backend = ADNLPModels.EmptyADbackend, show_time = true)
130+
```
131+
123132
## Benchmarks
124133

125134
This package implements several backends for each method and it is possible to design your own backend as well.

0 commit comments

Comments
 (0)