algoObj | R Documentation |
minAlgo
classesThis function creates an object that defines minimization solvers. The
purpose is to homogenize the call of optimization solvers. These objects
can be used by the method minFit
to call the associated
solvers using the same arguments, and to return the solution using
a list with the same names.
algoObj(algo, start, fct, grad, solution, value, message, convergence)
algo |
The name of the solver function to be called in character
format. All arguments for the solver |
start |
The name of the argument representing the starting value in character format. |
fct |
The name of the argument representing the function to minimize in character format. |
grad |
The name of the argument representing the gradient in character format. |
solution |
The name of the element of the list returned by the solver that represents the solution, in character format. |
value |
The name of the element of the list returned by the solver that represents the value of the function at the solution, in character format. |
message |
The name of the element of the list returned by the solver that represents the convergence message, in character format. |
convergence |
The name of the element of the list returned by the solver that represents the convergence code, in character format. |
An object of class minAlgo
.
minFit
for examples on how to use this class object.
## The optim algorithm:
algo1 <- algoObj("optim")
## The nlminb algorithm:
algo2 <- algoObj("nlminb")
## Defining the algorithm lbfgs from the nloptr package
## Not run:
algo3 <- algoObj(algo="lbfgs", start="x0", fct="fn",
grad="gr", solution="par", value="value",
message="message", convergence="convergence")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.