Skip to content

Matching Algorithm

Sidharth4032 edited this page Dec 8, 2023 · 4 revisions

At its core, the algorithm processes a student's profile and compares it against all others in the database, assigning scores based on the degree of match across various criteria. These criteria include subject interests, compatibility in skill levels, alignment of study objectives, overlapping availability for study sessions, and similar preferences for study environments or methods. The algorithm then sorts potential matches by their calculated scores, prioritizing those with higher compatibility. This ensures that students are paired with the most suitable study partners, fostering effective and goal-oriented study sessions. The algorithm's efficiency lies in its ability to dynamically adapt to a diverse range of student needs and preferences, making it a central feature of the StudyMatch platform.

Pseudocode for Student Match Algorithm:

// Pseudocode for Student Match Algorithm

// Function to find study matches for a student
function findStudyMatches(student) {
    // Retrieve student's profile information
    subjectsInterested = student.subjectsInterested
    skillLevel = student.skillLevel
    studyGoals = student.studyGoals
    availableTimes = student.availableTimes
    studyModePreference = student.studyModePreference

    // Retrieve all other students' profiles
    allStudents = getAllStudentsProfiles()

    // Initialize an empty list for potential matches
    potentialMatches = []

    // Loop through each student in the database
    for each otherStudent in allStudents {
        if otherStudent != student {
            // Calculate match score based on different criteria
            matchScore = calculateMatchScore(student, otherStudent)

            // Add the student and their match score to potential matches
            potentialMatches.add({student: otherStudent, score: matchScore})
        }
    }

    // Sort potential matches based on the match score in descending order
    sortedMatches = sortMatchesByScore(potentialMatches)

    // Return the top matches
    return getTopMatches(sortedMatches)
}

// Function to calculate match score
function calculateMatchScore(student, otherStudent) {
    score = 0

    // Add points for subject match
    score += weightSubject * compareSubjects(student.subjectsInterested, otherStudent.subjectsInterested)

    // Add points for skill level compatibility
    score += weightSkillLevel * compareSkillLevel(student.skillLevel, otherStudent.skillLevel)

    // Add points for goal alignment
    score += weightGoals * compareStudyGoals(student.studyGoals, otherStudent.studyGoals)

    // Add points for scheduling compatibility
    score += weightScheduling * compareAvailability(student.availableTimes, otherStudent.availableTimes)

    // Add points for study mode preference match
    score += weightStudyMode * compareStudyMode(student.studyModePreference, otherStudent.studyModePreference)

    return score
}

// Function to sort potential matches by score
function sortMatchesByScore(matches) {
    // Sort the matches list based on the score in descending order
    return matches.sort((a, b) => b.score - a.score)
}

// Function to return top matches from the sorted list
function getTopMatches(sortedMatches) {
    // Define the number of top matches to return
    numberOfTopMatches = 5

    // Return the first 'numberOfTopMatches' from the sorted list
    return sortedMatches.slice(0, numberOfTopMatches)
}

// The following are helper functions to compare different criteria
function compareSubjects(subjects1, subjects2) { /* ... */ }
function compareSkillLevel(level1, level2) { /* ... */ }
function compareStudyGoals(goals1, goals2) { /* ... */ }
function compareAvailability(times1, times2) { /* ... */ }
function compareStudyMode(mode1, mode2) { /* ... */ }

Clone this wiki locally