-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolution.txt
131 lines (84 loc) · 2.44 KB
/
solution.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Problem
1. Random Solution
2. Cost Function -> How good of a solution.
3. While loop
4. New_Solution = Neighboring Solution (Current_Solution)
5. New_Solution_Cost = CostFunction (New_Solution)
6. If New_Solution > Cost_Solution:
7. Curent Solution = New_Solution
8. Current_Cost = New_Solution_Cost
9. If Current Solution > Best Solution: Best_Solution = Current_Solution
10. Else Probability > 0.5 => Current_Solution = New_Solution
1. Read Data -> INput
Course, Course_Registered_Students
Teachers
Rooms
2. Exams -> End result
Course
Room
Teacher
Day & Time
3. Random Solution
Every course must be scheduled (randomly). Assign Room randomly and teacher randomly.
4. Cost Value/Fitness Value.
Get_Cost_Value (Solution)
courses_scheduled = Check_Course_Schedule(Solution);
student_clashes = check_student_clash(Solution);
Return Courses_scheuled + student_clashes * 10 + teacher_clashes * 10 + consecutive_exams * 0.5
Hard Optimization Functions
1. Check_Course_Schedule (Solution) -> Solution === 2 ya 3 hafton
for course in courses:
if course in courses_schudled:
count++
return count
return number_of_course_not_scheduled;
2. check_student_clash(Solution):
1. Economics -> Students_Registered
2. Communication -> Students_Registered
1 day 2 exams prob and comm
student in these 2 exams
which student has both exams at the same time
count++
return count
Return number_of_students_clashes;
3. Check_teacher_clash (Solution):
First pick 10 Teachers
1 Time 10 Rooms
1 Teacher -> 1 Room
Next 10 Teachers
1 Time 10 Rooms
1 Teacher -> 1 Room
return count
return teacher_clashes
Soft Optimization Functions
Student A
Day 1 = Prob Pak
Day 13 no consecutive
Comm LA
Prob Comm
La Pak
check_consecutive_exams(result):
if(threat(result) == 0)
return result
day1 = Konsa din consecutive exams
day2 = No consecutive exams
result = swap(1 Course of day1, 1 course of day2)
check_consecutive_exams(result)
Utility Functions:
Filter_Students that are enrolled in less than 3 courses
1 Student -> Course[0], Course[5], Course[10]
1st Solution: 50 Student Clashes, 10 Consectuive Exams
2nd Solution: 25 Student Clashes, 150 Consecutive Exams
Neighbouring Solutions
Exams[100].day, Exam[100].time
Randomly Pick Exam
Exam[1].day = rand
Exam[1], Exam[20]
Solution 1 -> Solution 2, Solutino 3, Solution 4
K = 2
Queue = [2, 3]
Solution 2 -> 6, 7, 8
Queue = [3, 6]
Solution 3 => 9, 10, 11
Queue = [6]
Solution 6 =>