ADMB Documentation  11.1.1960
 All Classes Files Functions Variables Typedefs Friends Defines
fmmq.hpp
Go to the documentation of this file.
00001 /*
00002  * $Id: fmmq.hpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  *
00007  * ADModelbuilder and associated libraries and documentations are
00008  * provided under the general terms of the "New BSD" license
00009  *
00010  * License:
00011  *
00012  * Redistribution and use in source and binary forms, with or without
00013  * modification, are permitted provided that the following conditions are
00014  * met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright
00017  * notice, this list of conditions and the following disclaimer.
00018  *
00019  * 2.  Redistributions in binary form must reproduce the above copyright
00020  * notice, this list of conditions and the following disclaimer in the
00021  * documentation and/or other materials provided with the distribution.
00022  *
00023  * 3.  Neither the name of the  University of California, Otter Research,
00024  * nor the ADMB Foundation nor the names of its contributors may be used
00025  * to endorse or promote products derived from this software without
00026  * specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00029  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00030  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00031  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00032  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00033  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00034  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00035  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00036  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00038  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  *
00040  */
00045 //#pragma hdrstop
00046 /*
00047 class fmmq : public fmm_control
00048 {
00049 private:
00050   dvector h;
00051   dvector w;
00052   dvector funval;
00053 
00054   double dmin,fbest,df;
00055   long int llog,n1,ic,iconv,i1,link;
00056   double z,zz,gys,gs,sig,gso,alpha,tot,fy,dgs;
00057   long int itn,icc,np,nn,is,iu,iv,ib,ifn;
00058   int i, j;
00059   double gmax;
00060   double fsave;
00061   dvector gbest;
00062   dvector xbest;
00063   dvector xsave;
00064   dvector gsave;
00065   dvector scale;
00066   dvector xa;
00067   dvector xb;
00068   dvector d;
00069   dvector ga;
00070   dvector gb;
00071   int mode;
00072   int igwindow;
00073 int  ir;
00074 int isfv;
00075 int istart;
00076 int istop;
00077 double c;
00078 double cc;
00079 double dff;
00080 double fa;
00081 double fb;
00082 double dga;
00083 double dgb;
00084 double stmin;
00085 double stepbd;
00086 double tfmin;
00087 double gmin;
00088 double step;
00089 double gl1;
00090 double gl2;
00091 unsigned int k;
00092 int ititle;
00093 int print;
00094 int ipra;
00095 int ip;
00096 int n;
00097 public:
00098   fmmq(int nvar);
00099   fmmq(int nvar, const lvector& ipar);
00100   double minimize(const dvector& x,double (*pf)(const dvar_vector&));
00101   double minimize(const independent_variables & x, const dvector& c,
00102                   double (*pf)(const dvar_vector&, const dvector&));
00103   void fmin(const double& f, const dvector& x, const dvector& g);
00104   void va13c(const dvector& x, const double& f, const dvector& g);
00105 };
00106 */
00107 
00108 void fgcomp(const double& f, const dvector& x, const dvector& g);
00109 
00110 void mc11b(const dvector& h, const int& n, const int& k);
00111 void mc11e(const dvector& h, const int& n, const dvector& d, const dvector& w,
00112   const int& nn);
00113 
00114 // if you pass ir by referenc it stops after the third func eval
00115 // if you pass ir by value it runs but is wrong
00116 
00117 void mc11a(const dvector& h, const int& n, const dvector& xb, const double& sig,
00118   const dvector& w, int& ir, const int& mk, const double& eps);
00119 
00120 void mc11adp(const dvector& h, const int& n, const dvector& d, const double&,
00121   const dvector& , const int& ir, int& mk, const double&);
00122 
00123 double fmax(const double& x, const double& y);
00124 double ffmin(const double& x, const double& y);
00125 double ffmin(const int& x, const int& y);
00126 double mypow(double x, double p);
00127 double dafsqrt(double x);
00128 
00129 void fmmq_disp(int nfun, int itn, double f, double gmax, const dvector& x,
00130   const dvector& g);
00131 void here(const char* place);
00132 
00133 //  dvector xa(1,nvar);
00134 //  dvector xb(1,nvar);
00135 //  dvector d(1,nvar);
00136 //  dvector ga(1,nvar);
00137 //  dvector gb(1,nvar);
00138 //  const int mode = 1;
00139 //  const int igwindow = 2;