public static AHPIndexHierarchy ReadIndexHierarchyXml() { AHPIndexHierarchy TunnelHealIndex = new AHPIndexHierarchy(); Serialization<AHPIndexHierarchy> Xml2AHPIndex = new Serialization<AHPIndexHierarchy>(); TunnelHealIndex = Xml2AHPIndex.XMLDeserialization(_hierarchyFilePath); SetAhpParent(TunnelHealIndex); return TunnelHealIndex; }
public Calculation(AHPIndexHierarchy ahp, GroupedMonitorDataByTime groupedMonDataByTime, DateTime evaluationDate) { _ahpIndexHierarchy = ahp; _judgementMatrixInfosSet = BinaryIO.ReadMatrixInfosSet();///读取判断矩阵 _ahpIndexUtil = new AHPIndexHierarchyUtil(ahp); InitialBaseData(groupedMonDataByTime, evaluationDate); if (!IsMatrixExist()) { MessageBox.Show("需要定义判断矩阵!"); return; } CalculateWeightVctor(); CalculateFuzzyMatrix(); ShowResult(); }
AllExpertJudgementMatrixs _judgementMatrixInfosSet; //所有有关信息 #endregion Fields #region Constructors public LookUpJudgementMatrixWnd(AHPIndexHierarchy ahpIndexHierarchy) { MatrixGrade = new List<string> { "1/2", "1", "2"}; InitializeComponent(); _judgementMatrixInfosSet = BinaryIO.ReadMatrixInfosSet();//读取已有的,这个地方需要细化 if(_judgementMatrixInfosSet==null) { _judgementMatrixInfosSet = new AllExpertJudgementMatrixs(); } this.DataContext = _judgementMatrixInfosSet.JudgementMatrixInfosList; judgeMatrixDic = _judgementMatrixInfosSet.JudgementMatrixInfosList[0].JudgeMatrixDic; matrixNo = 0; matrixTotalNo = judgeMatrixDic.Count; SingleBasicJudgementMatrixInfo judgemtInfo = judgeMatrixDic.ElementAt(matrixNo).Value; RefreshData(judgemtInfo.IndexsSequence, judgemtInfo.JudgementMatrix); dgWeight.CellEditEnding += dgWeight_CellEditEnding; }
private void InitialData(AHPIndexHierarchy ahpIndexHierarchy) { if (ahpIndexHierarchy.Children == null || ahpIndexHierarchy.Children.Count < 1) { return; } SingleBasicJudgementMatrixInfo judgeMatrixInfo = new SingleBasicJudgementMatrixInfo(); judgeMatrixInfo.IndexsSequence = ahpIndexHierarchy.ChildrenNames; JudgeMatrixDic.Add(ahpIndexHierarchy.Name, judgeMatrixInfo); if (ahpIndexHierarchy.Children != null && ahpIndexHierarchy.Children.Count > 0) { foreach (AHPIndexHierarchy item in ahpIndexHierarchy.Children) { InitialData(item); } } }
public NewJudgementMatrixWnd(AHPIndexHierarchy ahpIndexHierarchy) { MatrixGrade = new List<string> { "1/2", "1", "2"}; InitializeComponent(); _judgementMatrixInfosSet = BinaryIO.ReadMatrixInfosSet();//读取已有的,这个地方需要细化 if (_judgementMatrixInfosSet==null)//没有现成的就新建 { _judgementMatrixInfosSet = new AllExpertJudgementMatrixs(); } judgemetnMatrixInfos = new JudgementMatrixsGroup(ahpIndexHierarchy); //新建空的判断矩阵集 judgeMatrixDic = judgemetnMatrixInfos.JudgeMatrixDic; //judgeMatrixDic = _judgementMatrixInfosSet.JudgementMatrixInfosList[0].JudgeMatrixDic; matrixNo = 0; matrixTotalNo = judgeMatrixDic.Count; SingleBasicJudgementMatrixInfo judgemtInfo = judgeMatrixDic.ElementAt(matrixNo).Value; RefreshData(judgemtInfo.IndexsSequence, judgemtInfo.JudgementMatrix); dgWeight.CellEditEnding += dgWeight_CellEditEnding; }
private static void SetAhpParent(AHPIndexHierarchy ahpIndexHierarchy) { if(ahpIndexHierarchy.Children!=null) { foreach(AHPIndexHierarchy ahpIndexChild in ahpIndexHierarchy.Children) { ahpIndexChild.Parent = ahpIndexHierarchy; SetAhpParent(ahpIndexChild); } } }
//TunnelHealIndex = new AHPIndexHierarchy() //{ // Name = "TunnelHealth", // IndexType = AHPIndexValueType.SingleValue //}; //AHPIndexHierarchy testLevel1 = new AHPIndexHierarchy() //{ // Name = "Level1", // IndexType = AHPIndexValueType.SingleValue //}; //TunnelHealIndex.Children.Add(testLevel1); //testLevel1.Parent = TunnelHealIndex; //AHPIndexHierarchy testLevel2Node1 = new AHPIndexHierarchy() //{ // Name = "level2Node1", // IndexType = AHPIndexValueType.Text //}; //AHPIndexHierarchy testLevel2Node2 = new AHPIndexHierarchy() //{ // Name = "level2Node2", // IndexType = AHPIndexValueType.SeriesValue //}; //testLevel1.Children.Add(testLevel2Node1); //testLevel1.Children.Add(testLevel2Node2); //testLevel2Node1.Parent = testLevel1; //testLevel2Node1.Parent = testLevel1; public static void OutputIndexHierarchyXml(AHPIndexHierarchy TunnelHealIndex) { Serialization<AHPIndexHierarchy> AHPIndex2Xml = new Serialization<AHPIndexHierarchy>(); AHPIndex2Xml.XMLSerialization(_hierarchyFilePath, TunnelHealIndex); }
/// <summary> /// 将树状的指标体系转为list结构 /// </summary> /// <param name="_ahpIndexHierarchy"></param> private void Convert2List( AHPIndexHierarchy _ahpIndexHierarchy) { ahpIndexList.Add(_ahpIndexHierarchy); if(_ahpIndexHierarchy.Children!=null&&_ahpIndexHierarchy.Children.Count>0) { foreach(AHPIndexHierarchy ahpIndex in _ahpIndexHierarchy.Children) { Convert2List(ahpIndex); } } }
/// <summary> /// 迭代计算指标所在的层号 /// </summary> /// <param name="_ahpIndexHierarchy"></param> private void CalculateLevelIteration(AHPIndexHierarchy _ahpIndexHierarchy) { levelId++; if(_ahpIndexHierarchy.Parent==null) { return; } else { CalculateLevelIteration(_ahpIndexHierarchy.Parent); } }
public AHPIndexHierarchyUtil(AHPIndexHierarchy _ahpIndexHierarchy) { ahpIndexList=new List<AHPIndexHierarchy>(); Convert2List(_ahpIndexHierarchy); CalculateLevel(); }
public JudgementMatrixsGroup(AHPIndexHierarchy ahpIndexHierarchy) { JudgeMatrixDic = new Dictionary<string, SingleBasicJudgementMatrixInfo>(); InitialData(ahpIndexHierarchy); }