Last active
February 18, 2025 15:36
-
-
Save mukuljainx/93de6106124b677ed9df2e9f51eb87f7 to your computer and use it in GitHub Desktop.
A program to allocate courses to student as per their preferences and availability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This will left many unallocated student as there is no upper cap defiend for cce student on CSE and ECE courses. | |
import numpy as np | |
studentPreferenceFile = open("generated.csv", "r") | |
#creating objects of student choice | |
studentPreferenceFileData = studentPreferenceFile.readlines() | |
studentPreference = [] #of objects | |
for line in studentPreferenceFileData: | |
line = line.strip() | |
studentDataArray = line.split(",") | |
studentDataObject = {"rollNumber": studentDataArray[0], "branch": studentDataArray[1], "courseCount": int(studentDataArray[2]) ,"preferrence" : studentDataArray[3:], "alloted" : []} | |
studentPreference.append(studentDataObject) | |
#creating objects of course seat availability | |
courseAvailabilityFile = open("course.csv", "r") | |
courseAvailabilityFileData = courseAvailabilityFile.readlines() | |
courseAvailability = {} | |
for line in courseAvailabilityFileData: | |
line = line.strip() | |
courseDataArray = line.split(",") | |
courseAvailability[courseDataArray[0]] = {"name": courseDataArray[1], "seats": int(courseDataArray[2])} | |
allotmentList = [] | |
file = open("allotmentList.csv", "w") | |
for x in xrange(0,8): | |
np.random.shuffle(studentPreference) | |
for student in studentPreference: | |
# print "coursecount: " + str(student["courseCount"]) | |
# print "x: " + str(x) | |
# print len(student["preferrence"]) | |
# print "--------------------" | |
if student["courseCount"] > 0 and len(student["preferrence"]) >= (x+1) and courseAvailability[student["preferrence"][x]]["seats"] > 0: | |
# print courseAvailability[student["preferrence"][x]]["seats"] | |
# print "x-----x" | |
courseAvailability[student["preferrence"][x]]["seats"] -= 1 | |
student["alloted"].append(student["preferrence"][x]) | |
student["courseCount"] -= 1 | |
if student["courseCount"] == 0: | |
allotmentList.append(student) | |
studentPreference.remove(student) | |
print len(studentPreference) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A course allocation program that assigns students to courses based on their preferences and availability would greatly enhance the education system. By considering students' interests and scheduling constraints, such a system can optimize learning experiences and reduce conflicts. For example, integrating online resources like https://learnerstv.org/Free-Chemistry-video-lecture-courses.htm can supplement course materials and provide additional learning opportunities. Implementing AI-driven algorithms can ensure fair distribution, minimize scheduling conflicts, and improve overall student satisfaction. This approach promotes efficiency and personalized learning, ultimately benefiting both students and educational institutions.