Nonlinear optimization

using NLPModelsIpopt, ADNLPModels, TimerNLPModels
nlp = TimerNLPModel(ADNLPModel(x -> sum(x.^2), ones(3)))
stats = ipopt(nlp, print_level = 0)
"Execution stats: first-order stationary"
get_timer(nlp)
 ────────────────────────────────────────────────────────────────────────────
                                    Time                    Allocations      
                           ───────────────────────   ────────────────────────
     Tot / % measured:          3.39s /  50.4%            527MiB /  40.3%    

 Section           ncalls     time    %tot     avg     alloc    %tot      avg
 ────────────────────────────────────────────────────────────────────────────
 hess_coord!            1    998ms   58.3%   998ms    109MiB   51.1%   109MiB
 grad!                  3    584ms   34.2%   195ms   94.2MiB   44.3%  31.4MiB
 obj                    2   81.5ms    4.8%  40.8ms   8.33MiB    3.9%  4.17MiB
 hess_structure!        1   46.3ms    2.7%  46.3ms   1.41MiB    0.7%  1.41MiB
 ────────────────────────────────────────────────────────────────────────────

Nonlinear least squares

using NLPModelsIpopt, ADNLPModels, TimerNLPModels
nls = TimerNLPModel(ADNLSModel(x -> x, ones(3), 3))
stats = ipopt(nls, print_level = 0)
"Execution stats: first-order stationary"
get_timer(nls)
 ────────────────────────────────────────────────────────────────────────────
                                    Time                    Allocations      
                           ───────────────────────   ────────────────────────
     Tot / % measured:          2.28s /  74.8%            225MiB /  68.1%    

 Section           ncalls     time    %tot     avg     alloc    %tot      avg
 ────────────────────────────────────────────────────────────────────────────
 hess_coord!            1    1.12s   66.0%   1.12s   86.8MiB   56.7%  86.8MiB
 grad!                  3    543ms   31.9%   181ms   64.9MiB   42.4%  21.6MiB
 hess_structure!        1   35.4ms    2.1%  35.4ms   1.34MiB    0.9%  1.34MiB
 obj                    2   19.5μs    0.0%  9.76μs      224B    0.0%     112B
 ────────────────────────────────────────────────────────────────────────────