//insert rateVector function private void crossOver(out VectorOfCourses o_VectorFirst, out VectorOfCourses o_VectorSecond, VectorOfCourses i_VectorOfCoursesFirst, VectorOfCourses i_VectorOfCoursesSecond, int i_CutRatio) { o_VectorFirst = new VectorOfCourses(); o_VectorSecond = new VectorOfCourses(); o_VectorFirst.Vector.AddRange(i_VectorOfCoursesFirst.Vector.GetRange(0, i_CutRatio)); o_VectorFirst.Vector.AddRange(i_VectorOfCoursesSecond.Vector.GetRange(i_CutRatio, i_VectorOfCoursesSecond.Vector.Count - i_CutRatio)); o_VectorSecond.Vector.AddRange(i_VectorOfCoursesSecond.Vector.GetRange(0, i_CutRatio)); o_VectorSecond.Vector.AddRange(i_VectorOfCoursesFirst.Vector.GetRange(i_CutRatio, i_VectorOfCoursesFirst.Vector.Count - i_CutRatio)); o_VectorFirst.rateVector(m_Student); o_VectorSecond.rateVector(m_Student); }
//insert rateVector function private void checkForMutation(VectorOfCourses i_Vector, List<List<CourseBlock>> i_CourseBlock) { int count = 0; bool rateAgain = false; int index; for (; count < i_Vector.Vector.Count; count++) { if (rnd.Next(k_MutationCrossOverSize) == 1) { rateAgain = true; index = getIndex(i_Vector.Vector[count].ID, i_CourseBlock); i_Vector.Vector[count] = i_CourseBlock[index][rnd.Next(i_CourseBlock[index].Count)]; } } if (rateAgain) { i_Vector.rateVector(m_Student); } }