📄 pr_hcm.h
字号:
#include<vector>
#include<iostream>
#include<string>
#include<fstream>
#include"PR_unit.h"
class PR_HCM
{
public:
enum DisType{SHORTEST,LONGEST,MIDDLE,AVERAGE,CENTERGRAVITY}; //the type of distacne calulation methods.
int num_iterations;
DisType distype;
std::vector< PR_unit > samples;
PR_HCM(int m,int n=0);
PR_HCM(std::ifstream &fin); //get the samples data from the file
void Set_iternum(int num);
void SetDistype(DisType distype);
void PrintSamples();
void CalcDis(); //calculate the distance matrix
void Rend(); //start the algorithm
void PrintCluster();
private:
int num_cluster; //the number of the remain cluster
std::vector<std::string> cluster;
std::vector<int> K_num; //the number of the samples in K cluster
int min1,min2;
void Choosetwo();
void Mergingcluster(); //merge the two cluster with the shortest distance
int serial(int,int);
double ChooseDis(int h,int i,int j);
void UpdateDis(); //update the distance matrix
std::vector< double > dis; //the distance matrix
void PrintDis();
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -