Download Latest Version optlib-1.1.3.tar.gz (37.3 kB)
Email in envelope

Get an email when there's a new version of OptLib

Home
Name Modified Size InfoDownloads / Week
optlib-1.1.3.tar.gz 2012-04-20 37.3 kB
OPTLIB Manual 1.1.3.docx 2012-04-20 22.9 kB
README 2012-04-10 1.9 kB
optlib-1.1.2.tar.gz 2012-04-05 36.1 kB
optlib-1.1.1.tar.gz 2012-04-05 232.6 kB
optlib.1.1.tgz 2012-04-04 32.8 kB
optlib-1.0.tgz 2012-03-14 57.0 kB
Totals: 7 Items   420.7 kB 0
version 1.1.3

OPTLIB is an optimization library. The standard usage is to
minimize a function that returns a double variable based
on some array of inputs that are also stored as doubles.

OPTLIB currently supports minimization by Powell's method,
Monte Carlo trials of Powell's method, a Genetic Algorithm,
and ensemble-based Simulated Annealing.

OPTLIB requires the user to specify a function of the form
double func(double * x, void * func_data). func_data is
a user specified structure which can be NULL that is passed
directly to func, allowing the user to pass parameters to func
without specifying them as global variables.

A typical use of optlib is as follows:

double func(double *x, void * func_data) {
    int * fcount = (int *)func_data;
    fcount++;
    return x[0]*x[0]+x[1]*x[1];   // x^2+y^2;
}

int main(int argc, char ** argv) {
    OptLibOpts * theOpts;
    int fcount=0;
 
    seed_by_time(0);

    theOpts = OPTLIB_CreateOpts(); //set up default options
    theOpts->ga_npools=1;          // override defaults (see optlib.c optlib.h)
    theOpts->method = OPTLIB_METHOD_GA; //set method, default is GA

    guess[0]=...; //initialize guess
    guess[1]=...;
    OPTLIB_Minimize(n,guess,&func,(void *)&fcount,theOpts); // minimize
    printf("SOLUTION %g %g\n",guess[0], guess[1]);  
    printf("TOTAL FUNCTION CALLS %d\n",fcount);

    OPTLIB_DestroyOpts(theOpts); //free memory
}


MPI OPTLIB

Driver routines exist in the source directory showing the use of 
OptLib with MPI options turned on.

To compile libopt_mpi.a, set USE_MPI to ON in cmake. This will create
libopt_mpi.a instead of libopt.a. When implementing, include <libopt_mpi.h>
instead of <libopt.h> (which will define the preprocessor variable USE_OPTMPI),
and link using the -lopt_mpi flag instead of the -lopt flag.

libopt_mpi uses the MPI_COMM_WORLD communicator at this time, the option
to set your own communicator will be added in the future.

Source: README, updated 2012-04-10