320 likes | 400 Views
An Investigation of the Course-Section Assignment Problem. Assoc. Prof. Zeki Bayram Eastern Mediterranean University T.R.N.Cyprus. Problem Specification. Student registration period Students should be registered to courses with the minimal number of conflicts
E N D
An Investigation of the Course-Section Assignment Problem Assoc. Prof. Zeki Bayram Eastern Mediterranean University T.R.N.Cyprus
Problem Specification • Student registration period • Students should be registered to courses with the minimal number of conflicts • For a specific student, courses to be taken are known. Meeting times of course-sections also known. • Need to decide on which sections to register with the minimum number of clashes
Problem Specification • Student/advisor preferences also play a role • Course-section assignment problem: given the courses the student should take, generate schedules for the student, in increasing order of the number of conflicts each schedule contains, up to a specified maximum • Student and his advisor can then choose one they prefer (semi-automated)
Computational Complexity • Scheduling problems which are decision problems, of a similar nature, are NP-complete • Our problem is a function problem, rather than a decision problem – enumeration, given as input courses, and section information about courses • Conjecture: Related decision problem “Is it possible to schedule n courses with at most k conflicts” is NP-complete.
Proposed Algorithm – high level • i = 0 • Repeat • Generate all schedules with exactly i conflicts • i i + 1 • Until the desired number of schedules have been generated
Algorithm Issues • Finding schedules at a given level done through backtracking search • Search space pruned if the total number of conflicts already exceed the currently allowed level • Implemented as a Javascript program and runs in the Web browser’s JavaScript engine
Formal Problem Specification • Definition 1. A meeting-time is a day-period pair, such as <Monday, 3 >, meaning the third period (i.e. 10:30) on Monday. • Definition 2. The function rep(D,P) is defined as (val(D) ∗ 8)+P, where <D, P > is a meeting-time, val(Monday) = 0, val(Tuesday) = 1, val(Wednesday) =2, val(Thursday) = 3 and val(Friday) = 4. rep(D, P)is a unique integer representation of a meeting-time < D,P >.
Formal Problem Specification • Definition 3. A course-section assignment is a function that maps a course to one of its sections. • Definition 4. The function meetingTimes(C,S) returns the set of meeting times (represented as integers) of section S of course C. In other words, x ∈ meetingT imes(C, S) iff < D,P > is a meeting-time of section S of course C and x = rep(D, P).
Formal Problem Specification • Definition 5. The function nconf(assign) takes a course-section assignment as an argument and returns the number of conflicts it contains. Specifically, let < C1, . . ., Cn > be a list of courses and assign be a course-section assignment. nconf(assign) is defined as | meetingT imes(assign(C1)) |+ ... +|meetingTimes(assign(Cn)) | − |meetingT imes(assign(C1)) ∪ . . . ∪ meetingTimes(assign(Cn))|
Formal Problem Specification • Definition 6. Given a list of courses < C1, . . . , Cn >, the course-section assignment problem (CSAP) is to generate a sequence < ass1, ass2, . . . > of course-section assignments in such a way that every assignment appears exactly once in the sequence, and if assi comes before assj in the sequence, then nconf(assi) ≤ nconf(assj).
Input to the Algorithm • C, the maximum number of conflicts that can be tolerated. • List of courses course1, course2, . . . , courseL for which we need to find schedules with at most C conflicts. • K, the number of sections per course. • The function meetingTimes(i, j) that gives the bitmap for course i, section j. • maxSolutions, the maximum number of solutions that should be generated
Output of the Algorithm • All combinations of course sections such that the number of conflicts does not exceed C and solutions are generated in increasing order of the number of conflicts they contain, up to a maximum of max solutions solutions
Algorithm (part 1) • declare current as an array[0..L] of bitmaps • declare nc as an array[0..L] of integer • declare next as an array[1..L +1] of integer • declare result as an array[1..L] of integer • ns ← 0 // number of solutions generated so far • for c ← 0 to C • i ← 1 // the next course to process • next[1] ← 1 // section 1 of course 1 to be processed first • current[0] ← (000000 . . .) // bitmap of forty zeroes • nc[0] ← 0 // initial node contains no conflicts
Algorithm (part 2) • loop • if ns > max solutions then exit program end if • if i = 0 then exit loop end if • if next[i]> K then i ← i − 1 continue loop end if • if i = L + 1 then • if c = nc[i − 1] then • print the result array • ns ← ns + 1 • end if • i ← i −1 // backtrack • continue loop • end if
Algorithm (part 3) • newConflicts ← countOnes(meetingTimes(i, next[ i ]) current[i − 1]) • if (newConflicts + nc[i − 1]) ≤ c then • nc[i] ← nc[i − 1] + newConflicts • current[i] ← current[ i − 1 ] meetingTimes(i, next[ i ]) • result[ i ] ← next[ i ] • next[ i ] ← next[ i ] + 1 • next[ i +1 ] ← 1 • i ← i + 1 • continue loop • end if • next[ i ] ← next[ i ] + 1 end loop • end for
Algorithm Complexity – Worst Case • Number of nodes visited by the algorithm an accurate measure of its time complexity • In the implicit tree traversed by the algorithm: • Level of the root = 0 • Level of the leaf nodes = N • Branching factor (number of sections of a course) = K • Number of nodes in the tree =
Algorithm Complexity – Worst case • C = Maximum number of conflicts that are tolerated • Algorithm makes C+1 passes over the implicit tree • Number of nodes visited in tree tree by the algorithm =
Algorithm Complexity – Average Case • Notation: P(Y@Lb) = probability that a node at level b with exactly Y conflicts is visited • c’ = Maximum number of conflicts we can tolerate in a specific iteration of the algorithm • Given c’, the expected number of nodes visited by the algorithm if we can tolerate c’ or less number of conflicts =
Algorithm Complexity – Average case • C = Maximum number of conflcits we can tolerate in the solution • Average case comlexity for the whole algorithm =
Computing P(j@Li) Base cases • P(0@L0) = 1 • P(0@L1) = 1 • P(j@L0=) = 0 for j > 0 • P(j@L1) = 0 for j > 0
Computing P(j@Li) Base cases (cont) • R = Number of hours a course is taught in a week • P(j@L2) =
Computing P(j@Li) Recursive case • Let mean that k new conflicts are introduced when going from a node at level i-1 to a node at level i. • Let mean the probability of introducing k new conflicts when going from a node at level i-1 to a node at level i, if there are already e conflicts at the node at level i-1.
Computing P(j@Li) Recursive case • For i>2, we have • where
Explanation • R is the number of hours per week each course is taught. • At level i-1, we have alrady allocated sections to i-1 courses. Since they have e conflicts, (i-1)R-e slots (out of 40) are already taken.To go to the next level node, k slots of the new course must coincide with already taken slots at level i-1, and R-k slots must coincide with the free slots at level i-1.
Explanation is just all possible ways of choosing R slots from 40 slots.
Conclusion • We defined formally the course-section assignment problem • We proposed an algorithm for it • We investigated the time-complexity of the algorithm using a probabilistic approach • We showed a Web application that implements the algorithm
Future Work • Investigating the applicability of the proposed algorithm to similar scheduling problems • Adapting the probabilistic approach for computing the the average-case complexity of the algorithm to other scheduling algorithms
References • http://cmpe.emu.edu.tr/bayram/VRegistration/form.asp