LibCudaOptimize
1.0
|
00001 //*************************************************************************// 00002 // // 00003 // LibCudaOptimize // 00004 // Copyright (C) 2012 Ibislab, University of Parma // 00005 // Authors: Youssef S.G. Nashed, Roberto Ugolotti // 00006 // // 00007 // You should have received a copy of the GNU General Public License // 00008 // along with this program. If not, see <http://www.gnu.org/licenses/> // 00009 // // 00010 //*************************************************************************// 00011 00012 #ifndef SW_Optimizer_H 00013 #define SW_Optimizer_H 00014 00016 #include "IOptimizer.h" 00017 00018 /*open the namespace 00019 this code should be after all the #include lines and before the first line of the code in each file. 00020 by Hamid. 23/07/2012*/ 00021 #ifdef LIBCUDAOPTIMIZE_NAMESPACE 00022 OPEN_NAMESPACE 00023 #endif 00024 00025 class SW_Optimizer : 00026 public virtual IOptimizer 00027 { 00028 protected: 00029 SolutionSet m_posSet; 00030 SolutionSet m_negSet; 00031 00032 #ifndef PRIVATE_DOXYGEN 00033 float* m_dDifferences; 00034 float* m_dStandardDeviations; 00035 float* m_dBiases; 00036 short* m_dSuccesses; 00037 short* m_dFails; 00038 00039 short m_maxFails; 00040 short m_maxSuccesses; 00041 #endif 00042 virtual void initSolutions(dim3,dim3); 00043 virtual void fitnessEvaluation(dim3,dim3,bool first=false); 00044 virtual void step(dim3,dim3); 00045 virtual void update(dim3,dim3,bool first=false); 00046 public: 00047 SW_Optimizer(EvalFuncPtr fPtr=NULL, unsigned int dn=PROBLEM_DIMENSIONS, unsigned int sn=NUM_SETS, unsigned int pn=NUM_SOLUTIONS); 00048 virtual ~SW_Optimizer(); 00049 00050 virtual bool init(); 00051 virtual void free(); 00052 00053 void setMaxFails(short m) {m_maxFails = m;} 00054 void setMaxSuccesses(short m) {m_maxSuccesses = m;} 00055 }; 00056 00057 /*close the namespace 00058 this code should be at the end of the file 00059 by Hamid. 23/07/2012*/ 00060 #ifdef LIBCUDAOPTIMIZE_NAMESPACE 00061 CLOSE_NAMESPACE 00062 #endif 00063 00064 #endif