# Assigning Candidate Tutors to Modules: A Preference Adjustment Matching Algorithm (PAMA)
## 4 The Preference Adjustment Matching Algorithm (PAMA)
### The PAMA Logic
### Some Scenarios of the PAMA Execution

#### 4.4.1 One-Round Assignments Scenario

Assuming that two modules, named mA and mB, must choose 1 and 2 tutors correspondently from 4 candidate tutors named t1, t2, t3 and t4. The tutors' rankings in the modules and the tutors' preferences are presented in Table 1

In the first round, the PAMA will start the examination of mA: At first, mA will pick t2, who is the highest-ranked tutor for the module. t2 has mA on top of his/her preferences; hence, t2 will be assigned to mA. After the assignment, t2 preferences will be cleared, and t2 will be also removed from mB rankings as well. Next, according to the mA rankings, t1, t4, and t3 will be marked as ineligible since mA is now completed. Next, the algorithm will examine mB: mB will first pick t3, who is the highest remaining ranked tutor for the module. t3 has mB on top of his/her preferences; hence, t3 will be assigned to mB. After the assignment, t3 will free all his/her preferences. In the same way, t1 will be also assigned and mB will be completed. Next, t4 will be marked as ineligible. In the next round all modules will seem completed, hence the algorithm will bypass them and finish. #### 4.4.2 Two-Round Assignments Scenario

By explicitly changing the order of mA tutors' rankings (Table 2), the PAMA will be executed in two rounds. As depicted in Table 3, in the first round the PAMA will start the examination of mA: First, mA will pick t3, who is the highest-ranked tutor for the module. t3 does not have mA on top of his/her preferences; hence, the position will be assumed as pending and the algorithm will continue to the next tutor. According to the mA rankings, t1 will be examined next. Since t1 has mA on top of his/her preferences, the algorithm will keep t1 in the ranking list and, next, will mark t4 and t2 as ineligible as they cannot be assigned to mA (mA will assign either t3 or t1). Next, the algorithm will examine mB: [PERSON] will first pick t2, who is the highest-ranked tutor for the module. t2 has mB on top of his/her preferences (after the removal of mA during the former examination of mA). Therefore, t2 will be assigned to mB. Next, t3 will also be assigned. mB will then be completed, and the algorithm will remove it from all tutors' preferences lists. In the second round, PAMA will start again with the examination of mA: Now, mA will pick t1, who is the highest-ranked remaining tutor for the module. Now t1 has mA on top of his/her preferences; hence, t1 will be assigned to mA. The module will be completed, and PAMA will check the mB module, which is already completed, and then the 2 nd round will finish. In the next round, all modules will be completed; hence, the algorithm will bypass them and finish. \begin{table}
\begin{tabular}{c c c c c c c c c c c c c c c c c c c c c c



#### 4.4.3 Deadlock Scenario

By explicitly changing the order of mB tutors' rankings, the PAMA will be driven to a deadlock. In the paradigm of Table 4, we can see that t3 and t1 preferences are opposite to mA and mB rankings. This will result in a deadlock in which each module will wait for the assignment of the first-ranked tutor to another module in order to complete its assignments and vice versa. In the first round, the PAMA will start the examination of mA (see Table 5): First, mA will pick t3, who is the highest-ranked tutor for the module. t3 does not have mA on top of his/her preferences; hence, the slot will be assumed as pending, and the algorithm will continue to the next tutor. According to the mA rankings, t1 will be examined next. Since t1 has mA as his/her 1 st preference, the algorithm will keep t1 in the ranking list. Next, it will mark t4 and t2 as ineligible, as they cannot be assigned to mA (since mA will assign either t3 or t1). Next, the algorithm will examine mB: mB will first pick t2, who is the highest ranked tutor for the module. t2 has mB on top of his/her preferences (after the removal of mA during the former examination); hence, t2 will be assigned in mB.