[R] parameters for lbfgsb (function for optimization)

Katie C katie.cheon at gmail.com
Sat Mar 8 03:46:44 CET 2008


I think I did not make myself clear when I asked about lbfgsb (function for
optimization) yesterday. I'm writing my functions in C but actual
calculation will be done in R by using .Call.
To be able to use lbfgsb (using the interfaces defined in header
'R_ext/Applic.h') , I need to supply my function and gradient function. And
the instruction in R-ext.pdf (p97) says that my function should have three
parameters(int n, double *par, void *ex) and gradient function should have
four parameters(int n, double *par, double *gr, void *ex).
My question is :  what is *ex (the last parameter) for? and what values
should I put for it? How about fncount and rcount (14 and 15th parameter of
lbfgsb)? Thank you in advance.
Kyeongmi





Bill.Venables wrote:
> 
> Whoa!  If you want to optimise in R, you need to write an R function to
> define your objective.  If that function is already written in C, as
> appears to be the case, you need to write an interfact to make it
> available to R.  This is not exactly something novices would take on
> lightly.
> 
> If you wish to optimise directly in C, then you should look for software
> support to do it that was intended for the purpose.  The R source code
> is not like that.  You can use it if you want, but you must expect it to
> be difficult and very puzzling, since it is not intended to be
> free-standing, but part of a large, complex system.
> 
> Best of luck. 
> 
> 
> Bill Venables
> CSIRO Laboratories
> PO Box 120, Cleveland, 4163
> AUSTRALIA
> Office Phone (email preferred): +61 7 3826 7251
> Fax (if absolutely necessary):  +61 7 3826 7304
> Mobile:                         +61 4 8819 4402
> Home Phone:                     +61 7 3286 7700
> mailto:Bill.Venables at csiro.au
> http://www.cmis.csiro.au/bill.venables/ 
> 
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Kyeongmi Cheon
> Sent: Friday, 7 March 2008 3:06 PM
> To: r-help at r-project.org
> Subject: [R] parameters for lbfgsb (function for optimization)
> 
> Can anyone help me with lbfgsb (function for optimization)?
> 
> It takes the following parameters:
> 
> void lbfgsb (int n, int lmm, double *x, double *lower,
> double *upper, int *nbd, double *Fmin, optimfn fn,
> optimgr gr, int *fail, void *ex, double factr,
> double pgtol, int *fncount, int *grcount,
> int maxit, char *msg, int trace, int nREPORT);
> 
> What do I put for parameter ex (11th parameter)? I looked at optim.c
> codes
> at R sites and it's a structure that has bunch of objects such as SEXP
> R_fcall,  SEXP R_gcall, SEXP R_env, double* ndeps, etc. I cannot figure
> out
> what it is about.
> How about fncount, rcount? R-ext.pdf or R help does not explain it in
> detail. Any comments would help. Thank you.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/parameters-for-lbfgsb-%28function-for-optimization%29-tp15890864p15910581.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list