Skip to content

Commit 0d01e82

Browse files
committed
Update heuristic.py
1 parent 92ae6ce commit 0d01e82

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

‎heuristic.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def find_index(mylist, char):
3131
for sub_list in mylist:
3232
if char in sub_list:
3333
return (mylist.index(sub_list))
34-
return False
34+
return -1
3535

3636
def schedule(T,N,M,class_subjects, teacher_subjects, subject_duration):
3737
schedule = []
@@ -46,17 +46,14 @@ def schedule(T,N,M,class_subjects, teacher_subjects, subject_duration):
4646
subject_index_done = None
4747
subject_index = None
4848

49-
print(classes)
5049
# Xếp thời khóa biểu cho lớp-môn đầu tiên vào các ngày và tiết trống trước tiên trong tuần.
5150
for i,c in classes:
5251
shift = 0
5352
for sub, duration in c:
5453
status = False
5554
for teacher,subject_non_available in teachers_non_available:
56-
print(sub)
5755
subject_index = find_index(subject_non_available,sub)
58-
if subject_index:
59-
print(f"class {i} sub {sub} list {subject_non_available} index {subject_index} shift {shift}")
56+
if subject_index != -1:
6057
if (shift not in range(i,j) for i,j in subject_non_available[subject_index][1]):# Khi phân công lớp-môn tiếp theo, kiểm tra xem lớp-môn đó có thể được phân công vào các ngày và tiết trống còn lại mà không gây chồng lấp với các lớp-môn đã phân công trước đó.
6158
subject_index_done = subject_index
6259
teacher_done = teacher

0 commit comments

Comments
 (0)