Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

powell.h

Go to the documentation of this file.
00001 // SuperMix version 1.0  C++ source file
00002 //
00003 // Copyright (c) 1999 California Institute of Technology.
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms for noncommercial
00007 // purposes are permitted provided that the above copyright notice and
00008 // this paragraph are duplicated in all such forms and that any
00009 // documentation and other materials related to such distribution and
00010 // use acknowledge that the software was developed by California
00011 // Institute of Technology. Redistribution and/or use in source or
00012 // binary forms is not permitted for any commercial purpose. Use of
00013 // this software does not include a permitted use of the Institute's
00014 // name or trademark for any purpose.
00015 //
00016 // DISCLAIMER:
00017 // THIS SOFTWARE AND/OR RELATED MATERIALS ARE PROVIDED "AS-IS" WITHOUT
00018 // WARRANTY OF ANY KIND INCLUDING ANY WARRANTIES OF PERFORMANCE OR
00019 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR PURPOSE (AS SET
00020 // FORTH IN UCC 23212-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
00021 // LICENSED PRODUCT, HOWEVER USED.  IN NO EVENT SHALL CALTECH/JPL BE
00022 // LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING BUT NOT LIMITED TO
00023 // INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING ECONOMIC
00024 // DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF
00025 // WHETHER CALTECH/JPL SHALL BE ADVISED, HAVE REASON TO KNOW, OR IN
00026 // FACT SHALL KNOW OF THE POSSIBILITY.  THE USER BEARS ALL RISK
00027 // RELATING TO QUALITY AND PERFORMANCE OF THE SOFTWARE AND/OR RELATED
00028 // MATERIALS.
00029 //
00030 
00031 // ************************************************************************
00032 //
00033 // powell.h
00034 //
00035 // defines class powell: a multidimensional minimization routine which
00036 // provides a concrete implementation of the abstract class "minimizer"
00037 // found in optimizer.h. The algorithm used is a modified version of that
00038 // of Powell, as implemented in Press, et. al., Numerical Recipes in C,
00039 // 2nd ed.
00040 //
00041 // 8/6/99   Modified to use minimize() in minimize1.h
00042 // 4/21/99  Modified to match new optimizer interface. JSW
00043 // 7/27/98  J.Z.
00044 //
00045 // ************************************************************************
00046 
00047 #ifndef POWELL_H
00048 #define POWELL_H
00049 
00050 // supermix's real_vector class used here
00051 #include "vector.h"
00052 
00053 // Defines general multivariate function class abstract_error_func
00054 // as well as the generic optimizer interface class.
00055 #include "optimizer.h"
00056 
00057 class powell : public minimizer
00058 {
00059 public:
00060   // Constructor needs the error function to be minimized:
00061   powell(abstract_error_func & aef);
00062 
00063   // Call this function to do minimization.
00064   double minimize();
00065 
00066   // How many iterations it took
00067   unsigned num_iter() { return iter ;}
00068 
00069   // Some variables to control the minimizer:
00070   // when the value of the error function changes by a relative amount less
00071   // than FTOL, the algorithm assumes the minimum has been found.
00072 
00073   double   FTOL ;       // error function relative change target         (default 1.0e-4)
00074   unsigned ITMAX ;      // max allowable iterations                      (default 100)
00075 
00076 
00077   // These variables can have a significant impact on the speed of optimizations; the
00078   // default values should be ok for most situations.
00079 
00080   unsigned CLOSENESS;   // the larger this number, the more likely it is that powell
00081                         // will find a local minimum close to the initial value.
00082                         // Very large values will slow the optimization. (default 10)
00083   double   FOCUS;       // Set between 0 and 1; set to 1 if the topology of the
00084                         // error function surface is simple; 0 if it is very complex.
00085                         // (default 1.0)
00086 private:
00087 
00088   // some internal routines:
00089   double f(double) const;  // convert error function to a function of a path variable
00090   double fmin(double);     // find the minimum of f(x)
00091   double lambda();         // find an appropriate scale for parameter variation
00092 
00093   // some internal variables:
00094   unsigned LN_ITMAX ;         // max iterations for line minimizations
00095   double   LN_TOL ;           // targer rel error tol for line mins
00096   unsigned iter ;             // iteration counter
00097   real_vector P, N ;          // keep track of where we are in parameter space
00098   real_vector Pmax, Pmin, D;  // hold the parameter space limits
00099   mutable real_vector xf;     // used by f();
00100   double lambda_ ;            // will save value returned by lambda()
00101 
00102 } ;
00103 
00104 #endif /* POWELL_H */
00105 

Please direct comments and corrections to supermix@submm.caltech.edu
Go to the supermix home page
Generated by doxygen1.2.7