| Type: | Package | 
| Title: | Track Numerical Optimization | 
| Version: | 0.1.0 | 
| Description: | Tracks parameter value, gradient, and Hessian at each iteration of numerical optimizers. Useful for analyzing optimization progress, diagnosing issues, and studying convergence behavior. | 
| License: | GPL (≥ 3) | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.2 | 
| Imports: | checkmate, cli, ggplot2, oeli (≥ 0.7.2), optimizeR (≥ 1.2.0), stats, tibble, utils | 
| Suggests: | testthat (≥ 3.0.0) | 
| Depends: | R (≥ 4.1.0) | 
| Config/testthat/edition: | 3 | 
| URL: | https://github.com/loelschlaeger/trackopt | 
| BugReports: | https://github.com/loelschlaeger/trackopt/issues | 
| NeedsCompilation: | no | 
| Packaged: | 2025-05-08 16:57:59 UTC; Lennart Oelschläger | 
| Author: | Lennart Oelschläger [aut, cre] | 
| Maintainer: | Lennart Oelschläger <oelschlaeger.lennart@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-05-12 08:20:02 UTC | 
trackopt: Track Numerical Optimization
Description
 
Tracks parameter value, gradient, and Hessian at each iteration of numerical optimizers. Useful for analyzing optimization progress, diagnosing issues, and studying convergence behavior.
Author(s)
Maintainer: Lennart Oelschläger oelschlaeger.lennart@gmail.com
See Also
Useful links:
- Report bugs at https://github.com/loelschlaeger/trackopt/issues 
Track numerical optimization
Description
-  nlm_track(): tracknlmiterations
-  optim_track(): trackoptimiterations
-  summary(): summary of optimization track
-  autoplot(): visualization of optimization for one or two parameters
Usage
nlm_track(
  f,
  p,
  target = NULL,
  npar = NULL,
  gradient = NULL,
  hessian = NULL,
  ...,
  iterations_max = 100,
  tolerance = 1e-06,
  typsize = rep(1, length(p)),
  fscale = 1,
  ndigit = 12,
  stepmax = max(1000 * sqrt(sum((p/typsize)^2)), 1000),
  steptol = 1e-06,
  minimize = TRUE,
  verbose = FALSE
)
optim_track(
  f,
  p,
  target = NULL,
  npar = NULL,
  gradient = NULL,
  ...,
  iterations_max = 100,
  tolerance = 1e-06,
  lower = NULL,
  upper = NULL,
  method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"),
  control = list(),
  minimize = TRUE,
  verbose = FALSE
)
## S3 method for class 'trackopt'
summary(object, ...)
## S3 method for class 'trackopt'
autoplot(object, iteration = NULL, xlim = NULL, xlim2 = NULL, ...)
Arguments
| f | [ The first argument of  If  | 
| p | [ | 
| target | [ This can only be  Can be  | 
| npar | [ Must be specified if more than two target arguments are specified via
the  Can be  | 
| gradient | [ The function call of  | 
| hessian | [ The function call of  | 
| ... | Additional arguments to be passed to  | 
| iterations_max | [ | 
| tolerance | [ | 
| typsize,fscale,ndigit,stepmax,steptol | Arguments passed on to  | 
| minimize | [ | 
| verbose | [ | 
| lower,upper | [ | 
| method,control | Arguments passed on to  Elements  | 
| object | [ | 
| iteration | [ If  This option is useful for creating animations, see https://bookdown.org/yihui/rmarkdown-cookbook/animation.html#ref-R-animation. | 
| xlim,xlim2 | [ If  | 
Value
A tibble with iterations in rows.
Examples
himmelblau <- function(x) (x[1]^2 + x[2] - 11)^2 + (x[1] + x[2]^2 - 7)^2
track <- nlm_track(f = himmelblau, p = c(0, 0))
summary(track)
ggplot2::autoplot(track)