?? fcmadlg.h
字號:
// FCMADlg.h : header file
//*********2005/09/09 YJ**********//
#if !defined(AFX_FCMADLG_H__9F194469_482F_4ED3_A080_EDF635FE02C8__INCLUDED_)
#define AFX_FCMADLG_H__9F194469_482F_4ED3_A080_EDF635FE02C8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//****************************確定值定義
//#define m 2 //指數(shù)加權(quán)
//#define threshold 500.0 //閥值
#define MAXCoreNum 90 //最大聚類中心數(shù)目 **
#define MAXNodeNum 1000 //最大測試數(shù)據(jù)點(diǎn)數(shù)
//#define repeatNum 1000 //迭代次數(shù)
//****************************
struct Node{ //數(shù)據(jù)點(diǎn)
/* ***** 數(shù)據(jù)為int型 ********
int x; //I路數(shù)據(jù)
int y; //Q路數(shù)據(jù)
int id; //隸屬中心ID
//bool usedflag; */
// ****** 數(shù)據(jù)為float型*******//
float x;
float y;
int id;
float density; //密度指標(biāo)
};
struct Core{ //聚類中心點(diǎn)
float x;
float y;
//int id;
};
struct Kmax{ //聚類有效性指標(biāo)
float maxK; //最小值
float preJ; //每次中心數(shù)為C是的最小目標(biāo)函數(shù)值
int c; //當(dāng)達(dá)到最小值時(shí),最佳聚類數(shù)
};
/////////////////////////////////////////////////////////////////////////////
// CFCMADlg dialog
class CFCMADlg : public CDialog
{
// Construction
public:
CFCMADlg(CWnd* pParent = NULL); // standard constructor
//================函數(shù)及變量定義====================//
void CutPeak(int c,bool firstcut);
float Caldistance(int dccordcn,int coreid,
int dataindex,int coreid2,
int data1,int data2);//計(jì)算2點(diǎn)之間距離,參數(shù)dccordcn:
//0->計(jì)算中心與數(shù)據(jù)點(diǎn)之間距離;1-> 計(jì)算中心與中心之間距離
void SaveCoreAndUmatrix(int coreNum,int nodeNum);//保存最優(yōu)聚類時(shí)的U陣
bool CalCorepos(); //計(jì)算中興坐標(biāo)
float CalDmin(); //計(jì)算各中心間最短距離 **
float CalVariance(); //int coreindex 計(jì)算各個(gè)類的方差 **
void CoreBelonged(); //計(jì)算數(shù)據(jù)點(diǎn)屬于哪個(gè)類
float CalVik(int i,int k);
float CalSep(int c);
float CalComp(int c,int nodenum);
int CalMaxDensitydata(int c,Node *nodedata);
Kmax Km;
int C; //初始聚類中心數(shù)目C=2 **
int prec; //減法聚類中,先前選出的中心index;
float K; //有效性指標(biāo) S=-1.0 **
float preJ; //迭代時(shí)前一次的目標(biāo)函數(shù)
float savemax;
float firstJ;
float e; //J的差值
bool read; //數(shù)據(jù)是否已經(jīng)讀取過
bool firstcutpeak;
float coreXsave[500];
float coreYsave[500];
//---------------------分配內(nèi)存塊
Node *nodedata; //-------結(jié)構(gòu)指針
Core *coredata;
Core *CorematrixSave;
float *Idata;
float *Qdata;
float *Umatrix;
//float *UmatrixSave1;
//-------------------------------|
//-------------------------->沒有使用分配前的程序變量
//float Idata[MAXNodeNum];
//float Qdata[MAXNodeNum];
//Node nodedata[MAXNodeNum]; //-------結(jié)構(gòu)數(shù)組
//Core coredata[MAXCoreNum];
//Core CorematrixSave[MAXCoreNum];
//float Umatrix[MAXCoreNum][MAXNodeNum];//U矩陣
//float UmatrixSave[MAXCoreNum][MAXNodeNum];//備份U矩陣
//float CorematrixSave[MaxCoreNum];
// Dialog Data
//{{AFX_DATA(CFCMADlg)
enum { IDD = IDD_FCMA_DIALOG };
CString m_IFilepath;
CString m_QFilepath;
CString m_Umatrix;
CString m_corematrix;
CString m_process;
float m;
float threshold;
int NodeNum;
int repeatNum;
CString m_result;
int m_MaxNodeNum;
int m_MaxCoreNum;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFCMADlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CFCMADlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnGetIdata();
afx_msg void OnGetQdata();
afx_msg void OnStart();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FCMADLG_H__9F194469_482F_4ED3_A080_EDF635FE02C8__INCLUDED_)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -