00001 /******************************************************************************/ 00002 /* */ 00003 /* O P T I M I Z A T I O N A L G O R I T H M 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 00014 #ifndef __OPTIMIZATIONALGORITHM_H__ 00015 #define __OPTIMIZATIONALGORITHM_H__ 00016 00017 #include "../ObjectiveFunction/ObjectiveFunction.h" 00018 00019 namespace Purple 00020 { 00021 00022 /// This abstract class represents the concept of optimization algorithm. 00023 /// Any derived class must implement the getMinimalArgument(void) method 00024 /// 00025 /// @see ObjectiveFunction. 00026 00027 class OptimizationAlgorithm 00028 { 00029 00030 protected: 00031 00032 // FIELDS 00033 00034 /// Pointer to an objective function object. 00035 00036 ObjectiveFunction* objectiveFunction; 00037 00038 /// Objective function evaluation goal value. 00039 /// It is used as a stopping criterion. 00040 00041 double evaluationGoal; 00042 00043 /// Maximum optimization time. It is used as a stopping criterion. 00044 00045 double maximumTime; 00046 00047 public: 00048 00049 00050 // GENERAL CONSTRUCTOR 00051 00052 OptimizationAlgorithm(ObjectiveFunction*); 00053 00054 00055 // DEFAULT CONSTRUCTOR 00056 00057 OptimizationAlgorithm(void); 00058 00059 00060 // DESTRUCTOR 00061 00062 virtual ~OptimizationAlgorithm(void); 00063 00064 00065 // METHODS 00066 00067 // Get methods 00068 00069 ObjectiveFunction* getObjectiveFunction(void); 00070 00071 double getEvaluationGoal(void); 00072 double getMaximumTime(void); 00073 00074 // Set methods 00075 00076 void setObjectiveFunction(ObjectiveFunction*); 00077 00078 void setEvaluationGoal(double); 00079 void setMaximumTime(double); 00080 00081 // Optimization methods 00082 00083 virtual Vector<double> getMinimalArgument(void) = 0; 00084 }; 00085 00086 } 00087 00088 #endif 00089 00090 00091 // Purple: An Open Source Numerical Optimization C++ Library. 00092 // Copyright (C) 2005 Roberto Lopez 00093 // 00094 // This library is free software; you can redistribute it and/or 00095 // modify it under the terms of the GNU Lesser General Public 00096 // License as published by the Free Software Foundation; either 00097 // version 2.1 of the License, or any later version. 00098 // 00099 // This library is distributed in the hope that it will be useful, 00100 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00101 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00102 // Lesser General Public License for more details. 00103 00104 // You should have received a copy of the GNU Lesser General Public 00105 // License along with this library; if not, write to the Free Software 00106 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA