// // Created by lenovo on 2023/10/18. // #ifndef ALGORITHM_HIERARCHYWEIGHTING_H #define ALGORITHM_HIERARCHYWEIGHTING_H #include #include #include #include typedef QVector > HWMat; typedef QVector > SMat; struct HWWeight { QString node; QString name; QVector weights; QVector node_number; }; struct HWNode { QString node; // 1.1 , 1.1.1 QString name; HWMat mat; QVector node_number; // [1, 1] , [1, 1, 1] }; class HierarchyWeighting { public: HierarchyWeighting(const SMat& smat); // void evaluate(); void push(const QString& node, const QString& name, const HWMat& value); bool isFull() const; const QVector& getsampleweight() const { return smat_cv_; } int getBestIndex() const { return best_index_; } private: void EvaluateNodeWeight(const HWNode& hwnode); void LastLevelWeight(); void BestSample(); const qreal RI[10] = {0, 0, 0.58, 0.90, 1.12, 1.24, 1.32, 1.41, 1.45, 1.49}; const qreal thd = 0.1; qreal m_CI; qreal m_CR; QVector mat_; //各节点 QVector weights_node_; //各节点计算出的权重 SMat smat_; //样本 int sam_num_; //样本数量 int best_index_; //最好的样本索引 QVector smat_cv_; QVector weights_; //最后一层综合权重 }; #endif //ALGORITHM_HIERARCHYWEIGHTING_H