RandomSearch.h

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /*                                                                            */
00003 /*   R A N D O M   S E A R C H   C L A S S   H E A D E R                      */
00004 /*                                                                            */ 
00005 /*   Roberto Lopez                                                            */ 
00006 /*   International Center for Numerical Methods in Engineering (CIMNE)        */
00007 /*   Technical University of Catalonia (UPC)                                  */
00008 /*   Barcelona, Spain                                                         */
00009 /*   E-mail: rlopez@cimne.upc.edu                                             */ 
00010 /*                                                                            */
00011 /******************************************************************************/
00012 
00013 #ifndef __RANDOMSEARCH_H__
00014 #define __RANDOMSEARCH_H__
00015 
00016 #include "OptimizationAlgorithm.h"
00017 #include "../ObjectiveFunction/ObjectiveFunction.h"
00018  
00019 namespace Purple
00020 {
00021 
00022 /// This concrete class represents the random search optimization algorithm.
00023 ///
00024 /// @see ObjectiveFunction.
00025 /// @see OptimizationAlgorithm.
00026 
00027 class RandomSearch : public OptimizationAlgorithm
00028 {
00029 
00030 private: 
00031 
00032    // FIELDS
00033 
00034    /// Objective function evaluation history
00035 
00036    Vector<double> evaluationHistory;
00037 
00038    /// Maximum number of iterations.
00039    /// It is used as a train stopping criterion.
00040 
00041    int maximumNumberOfIterations;
00042 
00043    /// Number of iterations between the training showing progress.
00044 
00045    int showPeriod;
00046 
00047 public:
00048 
00049    // GENERAL CONSTRUCTOR
00050 
00051    RandomSearch(ObjectiveFunction*); 
00052 
00053 
00054    // DEFAULT CONSTRUCTOR
00055 
00056    RandomSearch(void); 
00057 
00058 
00059    // DESTRUCTOR
00060 
00061    virtual ~RandomSearch(void);
00062 
00063 
00064    // METHODS
00065 
00066    // Get methods
00067 
00068    int getMaximumNumberOfIterations(void);
00069    int getShowPeriod(void);
00070 
00071    // Set methods
00072 
00073    void setMaximumNumberOfIterations(int);
00074    void setShowPeriod(int);
00075 
00076    // Optimization methods
00077 
00078    Vector<double> getMinimalArgument(void);
00079 
00080    // Utiltity methods
00081 
00082    void print(void);
00083 
00084    void load(char*);
00085    void save(char*);
00086 
00087    void saveOptimizationHistory(char*);
00088 };
00089 
00090 }
00091 
00092 #endif
00093 
00094 
00095 // Purple: An Open Source Numerical Optimization C++ Library.
00096 // Copyright (C) 2006 Roberto Lopez 
00097 //
00098 // This library is free software; you can redistribute it and/or
00099 // modify it under the terms of the GNU Lesser General Public
00100 // License as published by the Free Software Foundation; either
00101 // version 2.1 of the License, or any later version.
00102 //
00103 // This library is distributed in the hope that it will be useful,
00104 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00105 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00106 // Lesser General Public License for more details.
00107 
00108 // You should have received a copy of the GNU Lesser General Public
00109 // License along with this library; if not, write to the Free Software
00110 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Generated on Wed Jun 21 13:10:38 2006 for Purple by  doxygen 1.4.7