plotConvergence: plotConvergence

Description Usage Arguments Examples

View source: R/optim_helper_functions.R

Description

Plot the path to convergence of an optimization algorithm (such as optim_DFP_APA).

Usage

1
2
3
4
5
6
7
plotConvergence(
  optimOutput,
  variable = NULL,
  digits = 5,
  labels = T,
  flip_axes = F
)

Arguments

optimOutput

The result of running an optimization algorithm with keepValues=TRUE

variable

Default is NULL, will print convergence plot for all variables, otherwise an integer vector (such as c(1,3)) indicating which variables to print convergence plot for.

digits

Default is 5. Number of digits to print on convergence plot.

labels

If TRUE, print function values as labels on the plot.

flip_axes

If TRUE, will plot the convergence horizontally rather than vertically.

Examples

1
2
3
4
5
6
7
# N dimensional quadratic
funcND <- function(par, center, precBits=64) {
  par <- Rmpfr::mpfr(par, precBits)
  log(sum(exp((par-center)^2)))
} 
opt <- optimizeAPA::optim_DFP_APA(starts = c(0,0,0), func = funcND, center=c(1,2,3), keepValues=TRUE)
plotConvergence(opt, variable=c(1,3), labels=F)

mrparker909/optimizeAPA documentation built on June 28, 2020, 3:57 p.m.