Skip to content

Commit cb65d42

Browse files
committed
refactor PenaltyOfMaximumCountOfClassInSection
1 parent 22fef1a commit cb65d42

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Course Scheduler/Services/GeneticAlgorithm.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ private int PenaltyOfMaximumCountOfClassInSection(List<CourseTeacherClassTime> c
7575
var sectionAndCount = sections.GroupBy(x => x)
7676
.Select(g => new { Value = g.Key, Count = g.Count() });
7777

78+
var maximumCountOfClass = 3;
7879
foreach (var section in sectionAndCount)
7980
{
80-
if (section.Count > 3)
81+
if (section.Count > maximumCountOfClass)
8182
{
82-
penalty += section.Count - 3;
83+
penalty += (section.Count - maximumCountOfClass);
8384
}
8485
}
8586
return penalty;

0 commit comments

Comments
 (0)