ConsistencyCheck.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef CONSISTENCYCHECK_H
  2. #define CONSISTENCYCHECK_H
  3. #include <QString>
  4. #include <QVector>
  5. /**
  6. * @brief 专家输入数据校验, AHP,废弃
  7. */
  8. class ConsistencyCheck
  9. {
  10. public:
  11. /**
  12. * @brief 构造函数
  13. * @param 输入节点信息
  14. * @param 输入节点列表,必须满足n^2
  15. * @example:
  16. * QStringList ll = { "展开时间", "撤收时间", "携行重量", "操作人数", "防护能力", "保密能力" };
  17. * QVector<qreal> nn = { 1, 1.0 / 3.0, 1.0 / 5.0, 1.0 / 3.0, 1.0 / 5.0, 1.0 / 3.0, 3, 1,
  18. * 1.0 / 3.0, 3, 1.0/ 5.0, 1.0 / 3.0, 5, 3, 1, 5, 3, 3, 3, 1.0 / 3.0,
  19. * 1.0 / 5.0, 1, 1.0 / 7.0, 1.0 / 3.0, 5, 5, 1.0 / 3.0, 7, 1, 3, 3,
  20. * 3,1.0 / 3.0, 3, 1.0 / 3.0, 1 };
  21. * ConsistencyCheck cc(ll, nn);
  22. * qDebug() << cc.consitst();
  23. */
  24. ConsistencyCheck(const QStringList &nodes, const QVector<qreal> &nxnValus);
  25. const QVector<qreal> &getSqartnValues() const { return m_sqartnValues; }
  26. const QVector<qreal> &getWeights() const { return m_weights; }
  27. const QVector<qreal> &getAverageWeights() const { return m_averageWeights; }
  28. const QStringList &getNodes() const { return m_nodes; }
  29. qreal CI() const { return m_CI; }
  30. qreal CR() const { return m_CR; }
  31. /**
  32. * @brief 一致性判断
  33. */
  34. bool consitst() const
  35. {
  36. return true; // return m_CR < thd;
  37. }
  38. private:
  39. const qreal RI[10] = { 0, 0, 0.58, 0.90, 1.12, 1.24, 1.32, 1.41, 1.45, 1.49 };
  40. const qreal thd = 0.1;
  41. void calc(const QVector<qreal> &nxnValus);
  42. QStringList m_nodes;
  43. QVector<qreal> m_sqartnValues;
  44. QVector<qreal> m_weights;
  45. QVector<qreal> m_averageWeights;
  46. qreal m_CI;
  47. qreal m_CR;
  48. };
  49. #endif // CONSISTENCYCHECK_H