# Assigning Candidate Tutors to Modules: A Preference Adjustment Matching Algorithm (PAMA)
## 4 The Preference Adjustment Matching Algorithm (PAMA)  
Given graph G (V, E) with V vertices and E edges, a set of edges is called a matching (or correspondence) if and only if no two edges share a common vertex, namely, each edge of the matching connects a different pair of vertices, and there are no common vertices between the edges of the matching (also known as independence). The assignment problem can be captured as a bipartite graph, where one set of vertices is the modules and another set is the tutors. In this initial graph, edges are only between vertices from different sets, showing the tutors' preferences for modules and their rankings. A simple case of three tutors, three modules, and one assignment per module is depicted in Figure 1.  
PAMA adopts a maximal matching approach by bilaterally examining both preferences and rankings for a maximal matching such that no more edges can be added without  
Figure 1: A simple case of the assignment problem in a bipartite graph and the matching highlighted, as performed by PAMA. violating independence (Figure 1). Preferences refer to tutors' ordered choices of modules (with \(\text{P}_{\text{jr}}\) being the r-th choice in descending order preference for tutor j) and rankings represent the descending order of tutors for each module (with \(\text{R}_{\text{ir}}\) being the r-th ranked tutor for module i). Maximal matching should be distinguished from maximum matching, which is the matching that contains the most edges. PAMA aims to obtain the maximal matching that satisfies all the module requirements. However, as the bilateral examination process of PAMA might lead to deadlock(s) (Section 4.1), in those cases, PAMA cannot ensure the maintenance of maximal matching in those situations. Indeed, while PAMA loses maximality when deadlock(s) occur, these are resolvable, so PAMA converges to stability in such a case. Unlike the unilateral Gale-Shapley algorithm, which can introduce biases toward one set, PAMA is balanced and therefore has no disjunction toward either set. It is worth referring to the greedy algorithms, where the difference with maximal ones is subtle. The matching produced by a greedy algorithm is always maximal, but not all maximal matchings can be produced by a greedy approach. Greedy algorithms make locally optimal choices without considering any future consequences, looking only at immediate gains; hence, they are also called \"myopic\" [21]. PAMA differs from the greedy algorithms in that it includes pending slots as correction mechanisms instead of taking immediate decisions on every case. PAMA takes into consideration the three rules below:  
1. Each element in the first set has a list of ranked elements from the second set. 2. Each element in the first set has a maximum number of pairs that must be created if it is possible. 3. Each element in the second list has a preference list of elements from the first set. This approach combines the advantages of stability with enhanced flexibility for institutions. In cases where stability might be lost, PAMA's deadlock resolution mechanisms provide satisfaction particularly to the institution while still maintaining reasonable outcomes for tutors. This addresses a known limitation of traditional stable matching algorithms like Gale-Shapley, which inherently favor the proposing side. By employing an iterative process with pending slots and policy-driven deadlock resolution, PAMA achieves equitable outcomes that respect both institutional ranking priorities and individual tutor preferences. An explanatory example of the algorithm invocation is the case of tutors' assignment to modules based on a combination of module preferences (how the modules rank tutors) and tutor preferences (how tutors rank modules). The algorithm proceeds in rounds, during which each module, one by one, attempts to stable fill its available positions by reviewing its ranked list of tutors. It checks whether each tutor is eligible for assignment, prioritizing those who have the module as their first preference.