#ifndef CONSISTENCYCHECK_H #define CONSISTENCYCHECK_H #include #include /** * @brief AHP层次分析法 */ class HierarchicalAnalysis { public: /** * @brief 构造函数 * @param 输入节点信息 * @param 输入节点列表,必须满足n^2 * @example: * QStringList ll = { "展开时间", "撤收时间", "携行重量", "操作人数", "防护能力", "保密能力" }; * QVector nn = { 1, 1.0 / 3.0, 1.0 / 5.0, 1.0 / 3.0, 1.0 / 5.0, 1.0 / 3.0, 3, 1, * 1.0 / 3.0, 3, 1.0/ 5.0, 1.0 / 3.0, 5, 3, 1, 5, 3, 3, 3, 1.0 / 3.0, * 1.0 / 5.0, 1, 1.0 / 7.0, 1.0 / 3.0, 5, 5, 1.0 / 3.0, 7, 1, 3, 3, * 3,1.0 / 3.0, 3, 1.0 / 3.0, 1 }; * HierarchicalAnalysis cc(ll, nn); * qDebug() << cc.consitst(); */ HierarchicalAnalysis(int columnCount, const QVector &nxnValus); const QVector &getWeights() const { return m_weights; } const QVector &getaverageWeights() const { return m_averageWeights; } qreal CI() const { return m_CI; } qreal CR() const { return m_CR; } /** * @brief 一致性判断 */ bool consitst() const { return true; // return m_CR < thd; } private: 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; void calc(const QVector &nxnValus); int m_columnCount; QVector m_sqartnValues; QVector m_weights; QVector m_averageWeights; qreal m_CI; qreal m_CR; }; #endif // CONSISTENCYCHECK_H