00001 /*************************************************************************** 00002 * @file gnn_line_search.h 00003 * @brief Line Search Procedures Header File. 00004 * 00005 * @date : 15-09-03 21:55, 01-10-03 09:50 00006 * @author : Pedro Ortega C. <peortega@dcc.uchile.cl> 00007 * Copyright 2003 Pedro Ortega C. 00008 ****************************************************************************/ 00009 /* 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 #ifndef _GNN_LINE_SEARCH_H_ 00026 #define _GNN_LINE_SEARCH_H_ 00027 00028 00029 00030 /******************************************/ 00031 /* Include Files */ 00032 /******************************************/ 00033 00034 #include "gnn_evaluation.h" 00035 00036 00037 00038 /******************************************/ 00039 /* Typedefs and Definitions */ 00040 /******************************************/ 00041 00042 /** 00043 * @brief Golden Section maximum magnification for parabolic fit. 00044 * @ingroup gnn_line_search_doc 00045 */ 00046 #define GNN_GOLDEN_LIMIT 100.0 00047 00048 /** 00049 * @brief Golden Section tiny value. 00050 * @ingroup gnn_line_search_doc 00051 */ 00052 #define GNN_GOLDEN_TINY 1.0e-20 00053 00054 /** 00055 * @brief Ratio for Golden Section interval magnification. 00056 * @ingroup gnn_line_search_doc 00057 */ 00058 #define GNN_GOLDEN_OLD 1.61803399 00059 00060 /** 00061 * @brief Golden Ratios. 00062 * @ingroup gnn_line_search_doc 00063 */ 00064 #define GNN_GOLDEN_R 0.61803399 00065 00066 /** 00067 * @brief Golden Ratios. 00068 * @ingroup gnn_line_search_doc 00069 */ 00070 #define GNN_GOLDEN_C (1.0 - GNN_GOLDEN_R) 00071 00072 /** 00073 * @brief Maximum number of iterations for Brent's line search. 00074 * @ingroup gnn_line_search_doc 00075 */ 00076 #define GNN_BRENT_ITMAX 100 00077 00078 /** 00079 * @brief Golden Ratio. 00080 * @ingroup gnn_line_search_doc 00081 */ 00082 #define GNN_BRENT_CGOLD 0.3819660 00083 00084 /** 00085 * @brief Small number that protects against too much fractional accuracy. 00086 * @ingroup gnn_line_search_doc 00087 */ 00088 #define GNN_BRENT_ZEPS 1.0e-10 00089 00090 00091 00092 00093 /** 00094 * @brief The type of line search routines. 00095 * @ingroup gnn_line_search_doc 00096 * 00097 * This is the type of line search routines in \ref libgnn. The first, 00098 * \a grad contains the node's information with all the needed buffers. 00099 * The triple \a ax, \a bx and \a cx bracket an appropiate interval which 00100 * contains a minimum. \a tol is the precision tolerance. The returned 00101 * values are: the minimum abscissa \f$x_{min}\f$, returned in \a xmin; 00102 * and the value of the node's function \f$f(x_{min})\f$. 00103 */ 00104 typedef double (*gnn_line_search_type) (gnn_line *line, size_t s, size_t n, 00105 double ax, double bx, double cx, 00106 double *xmin, double tol); 00107 00108 00109 00110 /******************************************/ 00111 /* Public Interface */ 00112 /******************************************/ 00113 00114 int 00115 gnn_line_search_bracket (gnn_line *line, size_t s, size_t n, 00116 double *ax, double *bx, double *cx, 00117 double *fa, double *fb, double *fc); 00118 00119 double 00120 gnn_line_search_golden (gnn_line *line, size_t s, size_t n, 00121 double ax, double bx, double cx, 00122 double *xmin, double tol); 00123 00124 double 00125 gnn_line_search_brent (gnn_line *line, size_t s, size_t n, 00126 double ax, double bx, double cx, 00127 double *xmin, double tol); 00128 00129 double 00130 gnn_line_search_charalambous (gnn_line *line, size_t s, size_t n, 00131 double ax, double bx, double cx, 00132 double *xmin, double tol); 00133 00134 double 00135 gnn_line_search_simple (gnn_line *line, size_t s, size_t n, 00136 double ax, double bx, double cx, 00137 double *xmin, double tol); 00138 00139 00140 #endif /* _GNN_LINE_SEARCH_H_ */ 00141 00142 00143
1.2.18