Learn R Programming

gpHist (version 0.1)

downhillsimplex: downhillsimplex function

Description

Impementation of the downhillsimplex function for optimisation

Usage

downhillsimplex(fc,nParams,bp=NULL,lower=0,upper=1,it=1000,tol=1e-10,
control= list(alpha=1,gamma=2, beta=0.5,sigma = 0.5) )

Arguments

fc

Function to be minimized

nParams

Number of parameters that the function to be optimized requires

bp

Matrix used to start the optimisation. If no parameters is given, this matrix will be randamly initialized.

lower

Vector for the lower bound of the parameters

upper

Vector for the upper bound of the parameters

it

Maximium number of iterations done by the downhillsimplex algortihm

tol

tolearnce that is used to test for convergence

control

list of variables that control the behavior of the downhillsimpley algorithm. alpha = Reflexion gamma = Expansion beta = Contraktion sigma = Compression

Value

Returns estimated parameters

Details

Implemented in C, will call you R function

References

Implementation according to describtion on wiki: https://en.wikipedia.org/wiki/Nelder

See Also

Package Overview: gpHist-Package

Function for hyperparameter estimation: estimateHyperParameters

Examples

Run this code
# NOT RUN {
#simple function to be optimized
fn = function(x){
 x^2 
}


#call downhillsimplex
res = downhillsimplex(fn,1,lower=-10,upper=10,it=1000,tol=1e-10)

#plot results
x = seq(-10,10,0.01)
plot(x,fn(x),type='l')
points(res[1],fn(res[1]),col='red')


legend('topleft',legend=c('Function', 'Estimated minimum'), col=c('black','red'),
lty=c(1,NA),pch=c(NA,1))


# }

Run the code above in your browser using DataLab