public static string SearchBestForConc(int number) { string NameOfAlg = null; ClassValueRmseAlg[] Results = new ClassValueRmseAlg[5]; for (int i = 0; i < 5; i++) { Results[i] = new ClassValueRmseAlg(); } Results[0].NameAlg = "Алгоритм 1"; Results[1].NameAlg = "Алгоритм 2"; Results[2].NameAlg = "Алгоритм 3"; Results[3].NameAlg = "Алгоритм 4"; Results[4].NameAlg = "Алгоритм 5"; Results[0].Val = rmseClass.ValuesRMSE1[number]; Results[1].Val = rmseClass.ValuesRMSE2[number]; Results[2].Val = rmseClass.ValuesRMSE3[number]; Results[3].Val = rmseClass.ValuesRMSE4[number]; Results[4].Val = rmseClass.ValuesRMSE5[number]; Array.Sort(Results, new SortByValue()); NameOfAlg = Results[0].NameAlg; return(NameOfAlg); }
public static string[] SearchBestMethod() { string[] NamesOfAlgs = new string[7]; ClassValueRmseAlg[] AlgOneSumms = new ClassValueRmseAlg[7]; ClassValueRmseAlg[] AlgTwoSumms = new ClassValueRmseAlg[7]; ClassValueRmseAlg[] AlgThreeSumms = new ClassValueRmseAlg[7]; ClassValueRmseAlg[] AlgFourSumms = new ClassValueRmseAlg[7]; ClassValueRmseAlg[] AlgFiveSumms = new ClassValueRmseAlg[7]; string[] names = new string[7] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; for (int i = 0; i < 7; i++) { AlgOneSumms[i] = new ClassValueRmseAlg(); AlgTwoSumms[i] = new ClassValueRmseAlg(); AlgThreeSumms[i] = new ClassValueRmseAlg(); AlgFourSumms[i] = new ClassValueRmseAlg(); AlgFiveSumms[i] = new ClassValueRmseAlg(); } #region 1 алгоритм for (int i = 0; i < 7; i++) { AlgOneSumms[i].NameAlg = names[i]; } for (int i = 0; i < dataClass.countOfDays; i++) { if (SearchDayOfWeek(i) == "Monday") { AlgOneSumms[0].Val += rmseClass.ValuesRMSE1[i]; } else if (SearchDayOfWeek(i) == "Tuesday") { AlgOneSumms[1].Val += rmseClass.ValuesRMSE1[i]; } else if (SearchDayOfWeek(i) == "Wednesday") { AlgOneSumms[2].Val += rmseClass.ValuesRMSE1[i]; } else if (SearchDayOfWeek(i) == "Thursday") { AlgOneSumms[3].Val += rmseClass.ValuesRMSE1[i]; } else if (SearchDayOfWeek(i) == "Friday") { AlgOneSumms[4].Val += rmseClass.ValuesRMSE1[i]; } else if (SearchDayOfWeek(i) == "Saturday") { AlgOneSumms[5].Val += rmseClass.ValuesRMSE1[i]; } else if (SearchDayOfWeek(i) == "Sunday") { AlgOneSumms[6].Val += rmseClass.ValuesRMSE1[i]; } } #endregion #region 2 алгоритм for (int i = 0; i < 7; i++) { AlgTwoSumms[i].NameAlg = names[i]; } for (int i = 0; i < dataClass.countOfDays; i++) { if (SearchDayOfWeek(i) == "Monday") { AlgTwoSumms[0].Val += rmseClass.ValuesRMSE2[i]; } else if (SearchDayOfWeek(i) == "Tuesday") { AlgTwoSumms[1].Val += rmseClass.ValuesRMSE2[i]; } else if (SearchDayOfWeek(i) == "Wednesday") { AlgTwoSumms[2].Val += rmseClass.ValuesRMSE2[i]; } else if (SearchDayOfWeek(i) == "Thursday") { AlgTwoSumms[3].Val += rmseClass.ValuesRMSE2[i]; } else if (SearchDayOfWeek(i) == "Friday") { AlgTwoSumms[4].Val += rmseClass.ValuesRMSE2[i]; } else if (SearchDayOfWeek(i) == "Saturday") { AlgTwoSumms[5].Val += rmseClass.ValuesRMSE2[i]; } else if (SearchDayOfWeek(i) == "Sunday") { AlgTwoSumms[6].Val += rmseClass.ValuesRMSE2[i]; } } #endregion #region 3 алгоритм for (int i = 0; i < 7; i++) { AlgThreeSumms[i].NameAlg = names[i]; } for (int i = 0; i < dataClass.countOfDays; i++) { if (SearchDayOfWeek(i) == "Monday") { AlgThreeSumms[0].Val += rmseClass.ValuesRMSE3[i]; } else if (SearchDayOfWeek(i) == "Tuesday") { AlgThreeSumms[1].Val += rmseClass.ValuesRMSE3[i]; } else if (SearchDayOfWeek(i) == "Wednesday") { AlgThreeSumms[2].Val += rmseClass.ValuesRMSE3[i]; } else if (SearchDayOfWeek(i) == "Thursday") { AlgThreeSumms[3].Val += rmseClass.ValuesRMSE3[i]; } else if (SearchDayOfWeek(i) == "Friday") { AlgThreeSumms[4].Val += rmseClass.ValuesRMSE3[i]; } else if (SearchDayOfWeek(i) == "Saturday") { AlgThreeSumms[5].Val += rmseClass.ValuesRMSE3[i]; } else if (SearchDayOfWeek(i) == "Sunday") { AlgThreeSumms[6].Val += rmseClass.ValuesRMSE3[i]; } } #endregion #region 4 алгоритм for (int i = 0; i < 7; i++) { AlgFourSumms[i].NameAlg = names[i]; } for (int i = 0; i < dataClass.countOfDays; i++) { if (SearchDayOfWeek(i) == "Monday") { AlgFourSumms[0].Val += rmseClass.ValuesRMSE4[i]; } else if (SearchDayOfWeek(i) == "Tuesday") { AlgFourSumms[1].Val += rmseClass.ValuesRMSE4[i]; } else if (SearchDayOfWeek(i) == "Wednesday") { AlgFourSumms[2].Val += rmseClass.ValuesRMSE4[i]; } else if (SearchDayOfWeek(i) == "Thursday") { AlgFourSumms[3].Val += rmseClass.ValuesRMSE4[i]; } else if (SearchDayOfWeek(i) == "Friday") { AlgFourSumms[4].Val += rmseClass.ValuesRMSE4[i]; } else if (SearchDayOfWeek(i) == "Saturday") { AlgFourSumms[5].Val += rmseClass.ValuesRMSE4[i]; } else if (SearchDayOfWeek(i) == "Sunday") { AlgFourSumms[6].Val += rmseClass.ValuesRMSE4[i]; } } #endregion #region 5 алгоритм for (int i = 0; i < 7; i++) { AlgFiveSumms[i].NameAlg = names[i]; } for (int i = 0; i < dataClass.countOfDays; i++) { if (SearchDayOfWeek(i) == "Monday") { AlgFiveSumms[0].Val += rmseClass.ValuesRMSE5[i]; } else if (SearchDayOfWeek(i) == "Tuesday") { AlgFiveSumms[1].Val += rmseClass.ValuesRMSE5[i]; } else if (SearchDayOfWeek(i) == "Wednesday") { AlgFiveSumms[2].Val += rmseClass.ValuesRMSE5[i]; } else if (SearchDayOfWeek(i) == "Thursday") { AlgFiveSumms[3].Val += rmseClass.ValuesRMSE5[i]; } else if (SearchDayOfWeek(i) == "Friday") { AlgFiveSumms[4].Val += rmseClass.ValuesRMSE5[i]; } else if (SearchDayOfWeek(i) == "Saturday") { AlgFiveSumms[5].Val += rmseClass.ValuesRMSE5[i]; } else if (SearchDayOfWeek(i) == "Sunday") { AlgFiveSumms[6].Val += rmseClass.ValuesRMSE5[i]; } } #endregion #region Конвертация массивов ClassValueRmseAlg[] masMonday = new ClassValueRmseAlg[5]; masMonday[0] = AlgOneSumms[0]; masMonday[1] = AlgTwoSumms[0]; masMonday[2] = AlgThreeSumms[0]; masMonday[3] = AlgFourSumms[0]; masMonday[4] = AlgFiveSumms[0]; masMonday[0].NameAlg = "Алгоритм 1"; masMonday[1].NameAlg = "Алгоритм 2"; masMonday[2].NameAlg = "Алгоритм 3"; masMonday[3].NameAlg = "Алгоритм 4"; masMonday[4].NameAlg = "Алгоритм 5"; ClassValueRmseAlg[] masTuesday = new ClassValueRmseAlg[5]; masTuesday[0] = AlgOneSumms[1]; masTuesday[1] = AlgTwoSumms[1]; masTuesday[2] = AlgThreeSumms[1]; masTuesday[3] = AlgFourSumms[1]; masTuesday[4] = AlgFiveSumms[1]; masTuesday[0].NameAlg = "Алгоритм 1"; masTuesday[1].NameAlg = "Алгоритм 2"; masTuesday[2].NameAlg = "Алгоритм 3"; masTuesday[3].NameAlg = "Алгоритм 4"; masTuesday[4].NameAlg = "Алгоритм 5"; ClassValueRmseAlg[] masWednesday = new ClassValueRmseAlg[5]; masWednesday[0] = AlgOneSumms[2]; masWednesday[1] = AlgTwoSumms[2]; masWednesday[2] = AlgThreeSumms[2]; masWednesday[3] = AlgFourSumms[2]; masWednesday[4] = AlgFiveSumms[2]; masWednesday[0].NameAlg = "Алгоритм 1"; masWednesday[1].NameAlg = "Алгоритм 2"; masWednesday[2].NameAlg = "Алгоритм 3"; masWednesday[3].NameAlg = "Алгоритм 4"; masWednesday[4].NameAlg = "Алгоритм 5"; ClassValueRmseAlg[] masThursday = new ClassValueRmseAlg[5]; masThursday[0] = AlgOneSumms[3]; masThursday[1] = AlgTwoSumms[3]; masThursday[2] = AlgThreeSumms[3]; masThursday[3] = AlgFourSumms[3]; masThursday[4] = AlgFiveSumms[3]; masThursday[0].NameAlg = "Алгоритм 1"; masThursday[1].NameAlg = "Алгоритм 2"; masThursday[2].NameAlg = "Алгоритм 3"; masThursday[3].NameAlg = "Алгоритм 4"; masThursday[4].NameAlg = "Алгоритм 5"; ClassValueRmseAlg[] masFriday = new ClassValueRmseAlg[5]; masFriday[0] = AlgOneSumms[4]; masFriday[1] = AlgTwoSumms[4]; masFriday[2] = AlgThreeSumms[4]; masFriday[3] = AlgFourSumms[4]; masFriday[4] = AlgFiveSumms[4]; masFriday[0].NameAlg = "Алгоритм 1"; masFriday[1].NameAlg = "Алгоритм 2"; masFriday[2].NameAlg = "Алгоритм 3"; masFriday[3].NameAlg = "Алгоритм 4"; masFriday[4].NameAlg = "Алгоритм 5"; ClassValueRmseAlg[] masSaturday = new ClassValueRmseAlg[5]; masSaturday[0] = AlgOneSumms[5]; masSaturday[1] = AlgTwoSumms[5]; masSaturday[2] = AlgThreeSumms[5]; masSaturday[3] = AlgFourSumms[5]; masSaturday[4] = AlgFiveSumms[5]; masSaturday[0].NameAlg = "Алгоритм 1"; masSaturday[1].NameAlg = "Алгоритм 2"; masSaturday[2].NameAlg = "Алгоритм 3"; masSaturday[3].NameAlg = "Алгоритм 4"; masSaturday[4].NameAlg = "Алгоритм 5"; ClassValueRmseAlg[] masSunday = new ClassValueRmseAlg[5]; masSunday[0] = AlgOneSumms[6]; masSunday[1] = AlgTwoSumms[6]; masSunday[2] = AlgThreeSumms[6]; masSunday[3] = AlgFourSumms[6]; masSunday[4] = AlgFiveSumms[6]; masSunday[0].NameAlg = "Алгоритм 1"; masSunday[1].NameAlg = "Алгоритм 2"; masSunday[2].NameAlg = "Алгоритм 3"; masSunday[3].NameAlg = "Алгоритм 4"; masSunday[4].NameAlg = "Алгоритм 5"; #endregion Array.Sort(masMonday, new SortByValue()); Array.Sort(masTuesday, new SortByValue()); Array.Sort(masWednesday, new SortByValue()); Array.Sort(masThursday, new SortByValue()); Array.Sort(masFriday, new SortByValue()); Array.Sort(masSaturday, new SortByValue()); Array.Sort(masSunday, new SortByValue()); NamesOfAlgs[0] = masMonday[0].NameAlg; NamesOfAlgs[1] = masTuesday[0].NameAlg; NamesOfAlgs[2] = masWednesday[0].NameAlg; NamesOfAlgs[3] = masThursday[0].NameAlg; NamesOfAlgs[4] = masFriday[0].NameAlg; NamesOfAlgs[5] = masSaturday[0].NameAlg; NamesOfAlgs[6] = masSunday[0].NameAlg; return(NamesOfAlgs); }