If the potential solution is indeed a local optimum of the objective function, and if it is used to initialize a second optimization, then original and "refined" solutions ought to be close.
optim_refit(xsol, fun, maximize = TRUE, maxit = 5000, reltol = 1e-08, xopt)Potential solution vector of length nx.
Objective function to be maximized (or minimized), with first argument the length-nx parameter vector over which optimization is to take place. Should return a scalar result.
Logical, whether a maximum or a minimum of the objective function is sought.
Maximum number of iterations for stats::optim() refit (see Details).
Relative tolerance for convergence of stats::optim() refit (see Details).
Optional refit solution calculated externally from an optimization algorithm of choice (see Details).
An object of class optrefit inheriting from optcheck, with elements:
xsolThe potential solution.
ysolThe value of fun(xsol).
maximizeLogical indicating whether the potential solution should maximize or minimize the objective function.
xoptThe solution found by the general-purpose optimizer.
yoptThe function value at the optimal solution, i.e., fun(xopt).
By default, a so-called refined op(t)imization (or refit) test is performed by running the default Nelder-Mead simplex method provided by stats::optim(), initialized by the potential solution xsol. Only a simplified interface to stats::optim()'s control parameters are provided here.
Alternatively, the refit test can be performed with any optimization algorithm of choice. This is done externally, with the refined solution passed to optim_refit() via the argument xopt.
summary, print, and diff for optrefit objects are available; see summary.optrefit(), print.optrefit(), and diff.optrefit().