MatterElementAnalysis.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // Created by Austin on 2023/10/11.
  3. //
  4. #ifndef ALGORITHM__MATTERELEMENTANALYSIS_H_
  5. #define ALGORITHM__MATTERELEMENTANALYSIS_H_
  6. #include <QVector>
  7. struct MEARange
  8. {
  9. int index; //指标号
  10. bool left_close; //左闭合
  11. bool right_close; //右闭合
  12. double min_value;
  13. double max_value;
  14. };
  15. typedef QVector<QVector<double>> MEAMat;
  16. typedef QVector<QVector<MEARange>> MEARangeMat;
  17. /**
  18. * @brief 物元法
  19. */
  20. class MatterElementAnalysis
  21. {
  22. public:
  23. /**
  24. *
  25. * @param mat : 输入矩阵,一行代表一个样本, 每列对应一个指标
  26. * @param ranges : 各项指标的评价等级
  27. */
  28. MatterElementAnalysis(const MEAMat &mat, const MEARangeMat &ranges);
  29. void evaluate(const QVector<double> &weights);
  30. const MEAMat &getRangeWeights() const;
  31. const QVector<MEAMat> &getRangeCVT() const;
  32. QVector<int> getBestIndex() const;
  33. int sample_num_; // 样本数
  34. int index_num_; // 指标数
  35. private:
  36. void associatedValue(int sam, int index, double value);
  37. void evaluationlevel(const QVector<double> &weights);
  38. MEAMat mat_;
  39. MEARangeMat ranges_;
  40. QVector<MEAMat> range_cvt_;
  41. MEAMat range_weights_;
  42. };
  43. #endif // ALGORITHM__MATTERELEMENTANALYSIS_H_