Question about calling amoeba routine


Homer500
12-13-2005, 02:41 PM
Hi everyone,

I have a simple question about calling the downhill simplex routine amoeba. If my objective function is called obj, how do I pass this to amoeba? I see in the amoeba declaration, the format is

float (*funk)(float[])

Do I need to declare a pointer to obj and use this pointer when I call amoeba? What is the format?

Thanks for any help,
Daryl

wies
12-15-2005, 07:12 AM
Hi Daryl,

you can just define your function, e.g. in the file functionfile.c (with associated header file functionfile.h), as

float obj(float *x)

Then in the beginning of main.c say

#include <amoeba.h>
#include <functionfile.h>

and in the body of main() you call

amoeba (p, y, ndim, ftols, &obj, &fevals);

where p is a starting configuration of ndim+1 points.

Wies.