Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- eval_f<-function(x){
- return(100*(x[2]-x[1]*x[1])^2+(1-x[1])^2)
- }
- eval_grad_f<-function(x){
- return(c(400*x[1]*x[2]-x[1]*x[1]-2*(1-x[1]),
- 200*(x[2]-x[1]*x[1])))
- }
- library(nloptr)
- x0<-c(-1,2,1)
- opts<-list("algorithm"="NLOPT_LD_LBFGS",
- "xtol_res"=1.0e-8)
- res<-nloptr(x0=x0,
- eval_f=eval_f,
- eval_g=eval_g,
- opts=opts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement