00001 // Minimizable.h: interface for the Minimizable class. 00002 // 00004 00005 #ifndef MINIMIZABLE_H 00006 #define MINIMIZABLE_H 00007 00008 #ifndef SWIG 00009 #if _MSC_VER > 1000 00010 #pragma once 00011 #endif // _MSC_VER > 1000 00012 #endif // SWIG 00013 00014 #include <stdexcept> 00015 00016 class Minimizable 00017 { 00018 public: 00019 virtual double ObjectiveFunction(double *parameters)=0; 00020 virtual double *Gradient(double *parameters) {throw std::runtime_error("Gradient is not defined for this Minimizable");} 00021 virtual double **Hessian(double *parameters) {throw std::runtime_error("Hessian is not defined for this Minimizable");} 00022 virtual int GetNParameters()=0; 00023 // computes energy and entropy at temp T for a single set of parameters 00024 virtual double ComputeES(double *parameters, double T) = 0; 00025 // computes entropy shift (largely irrelevant constant) at temperature T 00026 virtual double EntropyShift(double T) = 0; 00027 // gives the free energy less the entropy shift 00028 virtual double F(double *parameters, double T) = 0; 00029 // gives the total free energy 00030 virtual double F0(double *parameters, double T) = 0; 00031 // returns last computed energy 00032 virtual double GetEnergyLastComputed() {return m_dEnergyLastComputed;} 00033 // returns last computed entropy 00034 virtual double GetEntropyLastComputed() {return m_dEntropyLastComputed;} 00035 protected: 00036 double m_dEnergyLastComputed; 00037 double m_dEntropyLastComputed; 00038 }; 00039 00040 00041 00042 #endif // MINIMIZABLE_H