private void Test() { AHPMatrix m0 = new AHPMatrix(new double[,] { {1,3,7,9}, {0,1,3,7}, {0,0,1,3}, {0,0,0,1} }); AHPMatrix m1 = new AHPMatrix(new double[,] { {1,1,7}, {0,1,3}, {0,0,1} }); AHPMatrix m2 = new AHPMatrix(new double[,] { {1,0.2,1}, {0,1,3}, {0,0,1} }); AHPMatrix m3 = new AHPMatrix(new double[,] { {1,1,7}, {0,1,3}, {0,0,1} }); AHPMatrix m4 = new AHPMatrix(new double[,] { {1,7,9}, {0,1,1}, {0,0,1} }); List<AHPMatrix> list = new List<AHPMatrix>(); list.Add(m0); list.Add(m1); list.Add(m2); list.Add(m3); list.Add(m4); PreferenceVectorCalculator pvc = new PreferenceVectorCalculator(list); pvc.CalculateRankingVector(); }
private void nextButton_Click(object sender, RoutedEventArgs e) { bool error = false; currentPageIndex++; if (contentFrame.Content is UniverstyChoicePage) { selectedUniversities = (contentFrame.Content as UniverstyChoicePage).SelectedUniversitiesList; if (selectedUniversities.Count < 2) { error = true; Xceed.Wpf.Toolkit.MessageBox.Show("test błędu"); } } else if (contentFrame.Content is CryteriaChoicePage) { selectedCryteria = (contentFrame.Content as CryteriaChoicePage).SelectedCryteriaList; Cryteria cryt = selectedCryteria.Find(c => c.ID == Cryteria.FREE_UNIVERSITY_CRYTERIA); skipWrongUniversities = cryt == null; if (!skipWrongUniversities) { wrongUniversities = new List<University>(); foreach (University u in selectedUniversities) { string value = DBConnection.GetCryteriaValueForUniversity(u.ID, cryt.ID); double val = Convert.ToDouble(value); if (val == 1) wrongUniversities.Add(u); } skipWrongUniversities = wrongUniversities.Count == 0; if (skipWrongUniversities) currentPageIndex++; } else currentPageIndex++; if (skipWrongUniversities) { cryt = selectedCryteria.Find(c => c.ID == Cryteria.CITY_DISTANCE_CRYTERIA); skipDistances = cryt == null; if (skipDistances) currentPageIndex++; } } else if (contentFrame.Content is NotFreeUniversitiesPage) { if ((contentFrame.Content as NotFreeUniversitiesPage).GetNoWrong()) selectedUniversities.RemoveAll(u => wrongUniversities.Contains(u)); else lowerRatingForWrong = true; Cryteria cryt = selectedCryteria.Find(c => c.ID == Cryteria.CITY_DISTANCE_CRYTERIA); skipDistances = cryt == null; if (skipDistances) currentPageIndex++; } else if (contentFrame.Content is GeoLocalizationPage) { (contentFrame.Content as GeoLocalizationPage).SetDistanceFromAddressInUniversities(); reverseDistance = (contentFrame.Content as GeoLocalizationPage).GetReverseDistance(); } else if (contentFrame.Content is CryteriaEvaluationPage) { cryteriaEvaluationMatrix = (contentFrame.Content as CryteriaEvaluationPage).GetCryteriaEvaluationMatrix(); Xceed.Wpf.Toolkit.MessageBox.Show(cryteriaEvaluationMatrix.CheckConsistency().ToString()); } if (currentPageIndex < pageList.Count && !error) { Page page = pageList.ElementAt(currentPageIndex); if (page is CryteriaEvaluationPage) (page as CryteriaEvaluationPage).Init(selectedCryteria); else if (page is NotFreeUniversitiesPage && wrongUniversities.Count > 0) (page as NotFreeUniversitiesPage).Init(selectedUniversities, wrongUniversities); else if (page is GeoLocalizationPage) (page as GeoLocalizationPage).Init(selectedUniversities); contentFrame.Content = page; Title = (pageList.ElementAt(currentPageIndex) as Page).Title; } else if (error) { currentPageIndex--; } backButton.IsEnabled = currentPageIndex > 0; nextButton.IsEnabled = currentPageIndex < pageList.Count; }