📄 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 //指数加权
//#define threshold 500.0 //阀值
#define MAXCoreNum 90 //最大聚类中心数目 **
#define MAXNodeNum 1000 //最大测试数据点数
//#define repeatNum 1000 //迭代次数
//****************************
struct Node{ //数据点
/* ***** 数据为int型 ********
int x; //I路数据
int y; //Q路数据
int id; //隶属中心ID
//bool usedflag; */
// ****** 数据为float型*******//
float x;
float y;
int id;
float density; //密度指标
};
struct Core{ //聚类中心点
float x;
float y;
//int id;
};
struct Kmax{ //聚类有效性指标
float maxK; //最小值
float preJ; //每次中心数为C是的最小目标函数值
int c; //当达到最小值时,最佳聚类数
};
/////////////////////////////////////////////////////////////////////////////
// CFCMADlg dialog
class CFCMADlg : public CDialog
{
// Construction
public:
CFCMADlg(CWnd* pParent = NULL); // standard constructor
//================函数及变量定义====================//
void CutPeak(int c,bool firstcut);
float Caldistance(int dccordcn,int coreid,
int dataindex,int coreid2,
int data1,int data2);//计算2点之间距离,参数dccordcn:
//0->计算中心与数据点之间距离;1-> 计算中心与中心之间距离
void SaveCoreAndUmatrix(int coreNum,int nodeNum);//保存最优聚类时的U阵
bool CalCorepos(); //计算中兴坐标
float CalDmin(); //计算各中心间最短距离 **
float CalVariance(); //int coreindex 计算各个类的方差 **
void CoreBelonged(); //计算数据点属于哪个类
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; //初始聚类中心数目C=2 **
int prec; //减法聚类中,先前选出的中心index;
float K; //有效性指标 S=-1.0 **
float preJ; //迭代时前一次的目标函数
float savemax;
float firstJ;
float e; //J的差值
bool read; //数据是否已经读取过
bool firstcutpeak;
float coreXsave[500];
float coreYsave[500];
//---------------------分配内存块
Node *nodedata; //-------结构指针
Core *coredata;
Core *CorematrixSave;
float *Idata;
float *Qdata;
float *Umatrix;
//float *UmatrixSave1;
//-------------------------------|
//-------------------------->没有使用分配前的程序变量
//float Idata[MAXNodeNum];
//float Qdata[MAXNodeNum];
//Node nodedata[MAXNodeNum]; //-------结构数组
//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_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -