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

linesearch.h

00001 // Emacs will be in -*- Mode: c++ -*-
00002 //
00003 // ************ DO NOT REMOVE THIS BANNER ****************
00004 //
00005 //  Nicolas Di Cesare <Nicolas.Dicesare@free.fr>
00006 //  http://acm.emath.fr/~dicesare
00007 //
00008 //********************************************************
00009 //
00010 //  Line search abstract class
00011 //
00012 //********************************************************
00013 #ifndef _line_search_h_
00014 #define _line_search_h_
00015 
00016 #include <iostream>
00017 
00018 #include <optimizer.h>
00019 
00023 template <class V>
00024 class LineSearch {
00025 public:
00026   typedef double value_type;
00027 protected:
00029   double too_small_, too_big_;
00031   int maxLoop_;
00033   V xtd_, gradient_;
00035   double qt_, qpt_;
00037   bool succeed_;
00038 public:
00040   LineSearch(double eps = 1e-8) 
00041     : too_small_(eps), too_big_(1./eps),
00042       maxLoop_(100), qt_(0.), qpt_(0.),
00043       succeed_(true) {}
00045   virtual ~LineSearch() {}
00046 
00048   double lastFunctionValue() { return qt_; }
00050   double lastGradientNorm2() { return qpt_; }
00051 
00053   V&  lastX() { return xtd_;}
00055   V&  lastGradient() { return gradient_;}
00056 
00058   void setMaxLoop(int maxLoop) { maxLoop_ = maxLoop;}
00059 
00061   void setTooSmall(double too_small) { too_small_ = too_small;}
00063   void setTooBig(double too_big) { too_big_ = too_big;}
00064 
00065   bool succeed() { return succeed_;}
00066 
00068   virtual value_type operator() (OptimizationProblem<V>& P, value_type t_ini, value_type q0, value_type qp0) = 0; 
00069 };
00070 
00071 #endif

Generated at Wed Nov 7 16:25:59 2001 for Optimization by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001