Exemple #1
0
        public List <Course> GetRecommendation(int studentId, FilterModel filterModel)
        {
            var availableCourses = GetUnlockedCourses(studentId).ToList();

            if (!filterModel.AvoidRetakeable)
            {
                availableCourses = availableCourses.Union(GetRetakeAbleCourses(studentId)).ToList();
            }
            var courseCombinations = CombinationGenerator.GetAllCombinations <Course>(availableCourses);

            courseCombinations = GetValidCreditCourseCombinations(courseCombinations, filterModel.NumberOfCredits);
            if (filterModel.AvoidClashExams)
            {
                courseCombinations = GetNoClashExamsCombinations(courseCombinations);
            }
            if (filterModel.AvoidTwoExamsInADay)
            {
                courseCombinations = GetNoMultipleExamsInADayCombinations(courseCombinations, 2);
            }
            if (filterModel.AvoidThreeExamsInADay)
            {
                courseCombinations = GetNoMultipleExamsInADayCombinations(courseCombinations, 3);
            }
            List <WarehousePredict> warehouses = CreateWarehouse(courseCombinations, studentId);
            var    result   = GetPrediction(warehouses);
            int    maxIndex = 0;
            double maxValue = 0;

            for (int i = 0; i < result.Length; i++)
            {
                if (result[i] > maxValue)
                {
                    maxValue = result[i];
                    maxIndex = i;
                }
            }
            return(courseCombinations[maxIndex]);
        }