12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #include "MinMaxAnalysis.h"
- #include "MathUtil.h"
- MinMaxAnalysis::MinMaxAnalysis(const QVector<MinMaxAnalysis::EvaluateIndex> &rMat, MinMaxAnalysis::AnalysisType type,
- qreal _k, qreal _q)
- : analysisType(type), originMat(rMat), k(_k), q(_q)
- {
- calcNormalMat();
- }
- const QVector<MinMaxAnalysis::EvaluateIndex> &MinMaxAnalysis::normalization()
- {
- return normalMat;
- }
- MinMaxAnalysis::Relations MinMaxAnalysis::getRelations() const
- {
- return Relations();
- }
- void MinMaxAnalysis::calcNormalMat()
- {
- switch (analysisType) {
- case Min_Analysis: {
- for (auto index : originMat) {
- double minVal = Helper::minvec(index);
- EvaluateIndex ei;
- for (auto v : index) {
- ei << v / minVal;
- }
- normalMat << ei;
- }
- } break;
- case Max_Analysis: {
- for (auto index : originMat) {
- double maxVal = Helper::maxvec(index);
- EvaluateIndex ei;
- for (auto v : index) {
- ei << v / maxVal;
- }
- normalMat << ei;
- }
- } break;
- case Analysis_THD1: {
- for (auto index : originMat) {
- double minVal = Helper::minvec(index);
- double maxVal = Helper::maxvec(index);
- EvaluateIndex ei;
- for (auto v : index) {
- ei << (minVal + maxVal - v) / maxVal;
- }
- normalMat << ei;
- }
- } break;
- case Analysis_THD2: {
- for (auto index : originMat) {
- double minVal = Helper::minvec(index);
- double maxVal = Helper::maxvec(index);
- EvaluateIndex ei;
- for (auto v : index) {
- ei << (maxVal - v) / (maxVal - minVal);
- }
- normalMat << ei;
- }
- } break;
- case Analysis_THD3: {
- for (auto index : originMat) {
- double minVal = Helper::minvec(index);
- double maxVal = Helper::maxvec(index);
- EvaluateIndex ei;
- for (auto v : index) {
- ei << (v - minVal) / (maxVal - minVal);
- }
- normalMat << ei;
- }
- } break;
- case Analysis_THD4: {
- for (auto index : originMat) {
- double minVal = Helper::minvec(index);
- double maxVal = Helper::maxvec(index);
- EvaluateIndex ei;
- for (auto v : index) {
- ei << (v - minVal) * k / (maxVal - minVal) + q;
- }
- normalMat << ei;
- }
- } break;
- }
- }
|