data-structures-algorithms-group4 / student-project-matching

1 stars 0 forks source link

Algorithm: `reevaluate_assignments` does not consider new student and then removes all assignments from the project #18

Closed lonnychen closed 6 months ago

lonnychen commented 6 months ago

Reference from commit comment:

Running test_td_1 from test_algorithm.py and adding logging statements to matching_algorithm.py, I get the following output trace which is hopefully explanatory when s6 tries to match with p3:

INFO:matching_algorithm:Project assignments: defaultdict(<class 'list'>, {'p3': ['s1', 's3', 's4'], 'p2': ['s2'], 'p1': ['s5']}) INFO:matching_algorithm:Process student s6 DEBUG:matching_algorithm:Check project p3 with availability 0 DEBUG:reevaluate_assignments:current_assignees: ['s1', 's3', 's4'] DEBUG:reevaluate_assignments:preferred_assignees before: ['s1', 's3', 's4'] DEBUG:reevaluate_assignments:preferred_assignees after: [] DEBUG:matching_algorithm:Returned displaced None INFO:matching_algorithm:Project assignments: defaultdict(<class 'list'>, {'p3': [], 'p2': ['s2'], 'p1': ['s5']}) INFO:matching_algorithm:Process student s7 DEBUG:matching_algorithm:Check project p2 with availability 2 DEBUG:matching_algorithm:Check project p3 with availability 0

Algorithm issues to resolve:

  1. The new student does not seem to be considered (or even input into reevaluate_assignments) as preferred_assignees is the same as current_assignees.
  2. All matched students are then removed from the project assignment list instead of just one student,
  3. There is no return of displaced students for processing in the main function.
  4. project_availability['p3'] is not updated although it was emptied.

The resulting matches table from the Flask App is below:

DSA Project Debug - Issue 18
giocopp commented 6 months ago

Should work now, hopefully (test passed)

lonnychen commented 6 months ago

All four issues here have been fixed as of this commit!

Logging output below where s6 does successfully get matched into the full p3, s4 is correctly displaced, and kept_assignees are indeed kept:

INFO:matching_algorithm:Process student s6 INFO:matching_algorithm:Check project p3 with availability 0 INFO:reevaluate_assignments:Reevaluating p3 with potential addition of s6 DEBUG:reevaluate_assignments:current_assignees: ['s1', 's3', 's4'] DEBUG:reevaluate_assignments:kept_assignees: ['s1', 's6', 's3'] DEBUG:reevaluate_assignments:displaced_students: ['s4'] INFO:reevaluate_assignments:Displacing s4 from p3 INFO:reevaluate_assignments:Updated project assignments for p3: ['s1', 's6', 's3'] INFO:matching_algorithm:Updated project assignments: defaultdict(<class 'list'>, {'p3': ['s1', 's6', 's3'], 'p2': ['s2'], 'p1': ['s5']}) DEBUG:matching_algorithm:Updated unassigned students: deque(['s7', 's8', 's9', 's4'])