00001 #if !defined(AFX_DISTRIBUTION_H__EE052C75_E901_4AB0_85F4_6FA67C4F40C5__INCLUDED_) 00002 #define AFX_DISTRIBUTION_H__EE052C75_E901_4AB0_85F4_6FA67C4F40C5__INCLUDED_ 00003 00004 #if _MSC_VER > 1000 00005 #pragma once 00006 #endif // _MSC_VER > 1000 00007 // Distribution.h : header file 00008 // 00009 00011 // CDistribution 00012 00013 #include "stdafx.h" 00014 #include "MersenneTwister.h" 00015 00018 class CDistribution : public CObject 00019 { 00020 public: 00021 CDistribution(); 00022 CDistribution(double loc, double sc, double sh); 00023 virtual ~CDistribution(); 00024 CDistribution(const CDistribution& dist); 00025 00026 DECLARE_SERIAL(CDistribution) 00027 00028 // Attributes 00029 public: 00030 00031 // Operations 00032 public: 00033 void Serialize(CArchive& ar); 00034 00035 // Implementation 00036 public: 00037 double GenKeepingCoV(double newLocation); 00038 double Generate(); 00039 void setShape(double sh); 00040 void setScale(double sc); 00041 void setLocation(double loc); 00042 void setDistributionID(WORD id) ; 00043 00044 WORD getDistributionID() const; 00045 double getShape() const; 00046 double getScale() const; 00047 double getLocation() const; 00048 00049 CDistribution& operator=(const CDistribution &dist); 00050 00051 #ifdef _DEBUG 00052 virtual void AssertValid() const; 00053 virtual void Dump(CDumpContext& dc) const; 00054 #endif 00055 00056 private: 00057 double GenerateExponential(); 00058 double GenerateLogNormal(); 00059 double GenerateGamma(); 00060 double GenerateGumbel(); 00061 double GeneratePoisson(); 00062 double GenerateGEV(); 00063 double GenerateNormal(); 00064 double BoxMuller(); 00065 00066 static MTRand m_RNG; 00067 const double PI; 00068 00069 WORD m_DistributionID; 00070 double m_Location; 00071 double m_Scale; 00072 double m_Shape; 00073 }; 00074 00075 //{{AFX_INSERT_LOCATION}} 00076 // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 00077 00078 #endif // !defined(AFX_DISTRIBUTION_H__EE052C75_E901_4AB0_85F4_6FA67C4F40C5__INCLUDED_)