Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,36 @@ def lambda_c(course, student_list): #course is an object of course class, studen

def lambda_s(student): #Returns lambda_s
return (student.preferences[0][1]*0.8+student.CG*0.2);

def instructorAllotPreference(instructor_list, course_list): #Not checking for clashes, not checking if student applied for the course.
#List of all instructors, list of all courses.
for i in instructor_list:
for j in course_list:
for k, l in i.preference:
if (k==j.course_code):
heapq.heappush(j.selected, l);
l.alloted=j;
j.size_remaining=j.size_remaining-1;

def fillApplied(course_list, student_list):
#List of all courses, list of all students
for i in student_list:
for j in course_list:
if(i.preferences[0][0]==j.course_code):
heapq.heappush(j.applied, i);

def sortCourses(course_list, student_list):
#List of all courses, list of all students
lambda_c_list=[];
for i in course_list:
c=lambda_c(i, student_list);
lambda_c_list.append((i, c));

sorted(lambda_c_list, key=getKey);
return lambda_c_list;



def getKey(item):
return item[1];