Displaying 7 results from an estimated 7 matches for "optimfn".
Did you mean:
optimft
2007 Oct 23
0
API for optimization with Simulated annealing
Dear list,
I was trying to use the R API for optimization method "Simulated annealing"
void samin(int n, double *x, double *Fmin, optimfn fn, int maxit,
int tmax, double temp, int trace, void *ex);
but I encountered the following problem:
The implementation of the function samin (as seen in src/main/optim.c)
passes its void * argument "ex" into the function genptry (implemented
in the same source file) and t...
2012 Jun 08
0
Working with optim in C
I've searched to find examples of how to work with the C versions of
optim.
I've separated out the function just to test on it alone, and currently I'm
attempting to use fmmin as follows:
!~~CODE ~~!
double optimfn(int n, double *par, void *ex) {
double * lambda = (double*)malloc(sizeof(double)*n);
double sum = 0;
for(int i =0; i < n; i++) { lambda[i] = (1+tanh(par[i]/2.0))/2.0; }
for(int i = 0; i < n; i++) { sum += (par[i]*log(lambda[i]) +
(1-par[i]*log(1-lambda[i])));...
2008 Mar 07
1
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,...
2007 Mar 08
1
Calling Optim() from C
Hello:
I am sure this question was dealt with several years ago. Is the function
vmmin() available from Rmath Standalone? If not is it possible to call
optim() or nlm() from Rmath in C. Thank you.
Mervyn
2006 Mar 24
0
using R's optimization routines from C
...l,
I have been trying to use R's optimization routines from C and I have some
questions. Specifically, I am testing the usage of nmmin which performs
Nelder-Mead optimization in order to learn how to do the above exercise.
I understand from the notes in Chapter 5 that the declaration for both optimfn
as well as nmmin are included in the header file R_ext/Applic.h so I have
included that. Is there anything else (definitions, etc) that needs to be
provided in the preprocessor directive?
While linking, it appears that nmmin is in libR.so, so I guess I should include
that library when I compile t...
2012 Oct 28
0
lbfgsb from C
...ol = 0;
int fncount;
int grcount;
int maxit = 10;
char msg[1000];
int trace = 0;
int nREPORT = 10;
/* from http://cran.r-project.org/doc/manuals/R-exts.html#Optimization
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); */
lbfgsb(n, m, init, lower, upper, nbd, &Fmin, &eval, &grad, &fail, ex,
fac...
2024 Jul 29
1
Minor inconsistencies in tools:::funAPI()
Hi Ivan
Can you please clarify what input files should be used with your
proposed function? I tried a few files in r-svn/src/include and one of
them gave me an error.
> getdecl("~/R/r-svn/src/include/R.h")
[1] "R_FlushConsole" "R_ProcessEvents" "R_WaitEvent"
> getdecl("~/R/r-svn/src/include/Rdefines.h")
Error in regmatches(lines,