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

SimulatedAnnealingStrategy.h

Go to the documentation of this file.
00001 // SimulatedAnnealingStrategy.h: interface for the CSimulatedAnnealingStrategy class.
00002 //
00004 
00005 #if !defined(AFX_SIMULATEDANNEALINGSTRATEGY_H__0BA0E00A_3509_4CB6_9DCD_0915EBE298B4__INCLUDED_)
00006 #define AFX_SIMULATEDANNEALINGSTRATEGY_H__0BA0E00A_3509_4CB6_9DCD_0915EBE298B4__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 //#ifndef _WIN32
00013 //using namespace std;
00014 //#endif
00015 
00016 #include "Minimizer.h"
00017 #include "Rand.h"
00018 #include "MatrixOperations.h"
00019 #include "ParameterFilter.h"
00020 #include <math.h>
00021 #include <iostream>
00022 #include <fstream>
00023 #include <vector>
00024 using namespace std;
00025 
00026 class CSimulatedAnnealingStrategy : public Minimizer  
00027 {
00028 public:
00029         CSimulatedAnnealingStrategy(int RNGSeed, CParameterFilter *pFilter);
00030         virtual ~CSimulatedAnnealingStrategy();
00031         double Minimize(double *parameters, Minimizable *minimizable);
00032         virtual bool AcceptMove(double Eold, double Enew) = 0;
00033         virtual bool Terminate() = 0;
00034         virtual bool Equilibrated() = 0;
00035         virtual void Cool() = 0;
00036         virtual void InitializeTemperature(Minimizable *minimizable) = 0;
00037         virtual void GenerateMove() = 0;
00038         // returns the average energy 
00039         double GetEBar() const {return m_dEBar;}
00040         // returns the average squared energy 
00041         double GetE2Bar() const {return m_dE2Bar;}
00042         // returns the current minimum energy
00043         double GetEMin() const {return m_dEBest;}
00044         // returns the acceptance ratio at the current temperature
00045         double GetAcceptanceRatio() const {return m_dAcceptanceRatio;}
00046         // returns current temperature T
00047         double GetTemperature() const {return m_dTemperature;}
00048 protected:
00049         // filter for parameters, available to derived classes for move generation
00050         CParameterFilter *m_pFilter;
00051         // current state
00052         double *m_pdCurrentParameters;
00053         // trial state
00054         double *m_pdTrialParameters;
00055         // thermodynamic temperature
00056         double m_dTemperature;
00057         // energy of best state
00058         double m_dEBest;
00059         // self-explanatory
00060         double m_dAcceptanceRatio;
00061         // seed
00062         double m_iRNGSeed;
00063         // RNG
00064         Rand *m_pRNG;
00065         // avg. E as a function of T
00066         double m_dEBar;
00067         // avg. E^2 as a function of T
00068         double m_dE2Bar;
00069         // number of trials at the current temperature
00070         int m_iTrialCount;
00071         // used to do vector copies and such
00072         CMatrixOperations *m_pMO;
00073 };
00074 
00075 #endif // !defined(AFX_SIMULATEDANNEALINGSTRATEGY_H__0BA0E00A_3509_4CB6_9DCD_0915EBE298B4__INCLUDED_)

Generated on Mon Nov 3 09:38:15 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002