GreyClusterEvaluation.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // Created by lenovo on 2023/10/16.
  3. //
  4. #ifndef ALGORITHM_GREYCLUSTEREVALUATION_H
  5. #define ALGORITHM_GREYCLUSTEREVALUATION_H
  6. #include <QVector>
  7. struct GCERange
  8. {
  9. int level; // 等级
  10. double left_left;
  11. double left_val;
  12. double right_val;
  13. double right_right;
  14. };
  15. struct GCEmat
  16. {
  17. double front_val;
  18. double back_val;
  19. };
  20. struct BestIndex
  21. {
  22. int front_index;
  23. int back_index;
  24. };
  25. typedef QVector<GCEmat> GCEMat;
  26. typedef QVector<QVector<GCERange>> GCERangeMat;
  27. /**
  28. * @brief 灰色聚类
  29. */
  30. class GreyClusterEvaluation
  31. {
  32. public:
  33. /**
  34. *
  35. * @param mat : 输入矩阵,一行代表一个指标, 指标中front_val,back_val表示前后样本
  36. * @param ranges : 各项指标的评价等级
  37. */
  38. GreyClusterEvaluation(const GCEMat &mat, const GCERangeMat &ranges);
  39. void evaluate(const QVector<double> &weights);
  40. BestIndex getBestIndex() const;
  41. const QVector<GCEmat> &getRangeWeights() const;
  42. const QVector<GCEMat> &getRangeCVT() const;
  43. int sample_num_; // 样本数
  44. int level_num_; // 等级数
  45. private:
  46. void triangularwhiteningweight(int sam, double front_val, double back_val);
  47. void evaluationlevel(const QVector<double> &weights);
  48. GCEMat mat_;
  49. GCERangeMat ranges_;
  50. QVector<GCEMat> ranges_cv_;
  51. QVector<GCEmat> ranges_weight_;
  52. };
  53. #endif // ALGORITHM_GREYCLUSTEREVALUATION_H