ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
minim.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include <fvar.hpp>
12 #ifndef OPT_LIB
13  #include <cassert>
14 #endif
15 
24  double (*pf)(const dvar_vector&))
25 {
26  double f = 0.0;
27 
28  int nvar = static_cast<int>(x.size());
29 #ifndef OPT_LIB
30  assert(nvar > 0);
31 #endif
32  dvector g(1,nvar);
33 #ifndef SAFE_INITIALIZE
34  g.initialize();
35 #endif
36  {
38  while (ireturn >= 0)
39  {
40  fmin(f,x,g);
41  if(ireturn > 0)
42  {
43  {
44  f=(*pf)(x);
45  }
46  gradcalc(nvar,g);
47  }
48  }
49  }
50  return f;
51 }
#define x
Vector of double precision numbers.
Definition: dvector.h:50
void fmin(const double &f, const dvector &x, const dvector &g)
Function fmin contains Quasi-Newton function minimizer with inexact line search using Wolfe condition...
Definition: newfmin.cpp:254
ADMB variable vector.
Definition: fvar.hpp:2172
void gradcalc(int nvar, const dvector &g)
Definition: sgradclc.cpp:77
Description not yet available.
Definition: fvar.hpp:1937
double gs
Definition: fvar.hpp:3300
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
double minimize(const independent_variables &x, double(*pf)(const dvar_vector &))
Minimize artibrary user-supplied function.
Definition: minim.cpp:23
void initialize(void)
Initialze all elements of dvector to zero.
Definition: dvect5.cpp:10
unsigned int size() const
Get number of elements in array.
Definition: dvector.h:209
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
int ireturn
Definition: fvar.hpp:3197