Skip to content

Commit 65aab41

Browse files
docs: add algorithm description
1 parent eb55987 commit 65aab41

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,7 @@ This model contains information about Meet@Mensa's use-cases.
108108

109109
There's much more to see, check it out!
110110
- [API Spec](https://aet-devops25.github.io/team-devoops/api.html)
111-
- [CI/CD Pipeline Documentation]() # TODO Add
112-
- [The Meet@Mensa Algorithm]() # TODO Add
111+
- [Problem Statement](docs/problem_statement.md)
112+
- [Grafana Dashboards]() # TODO Add
113+
- [CI/CD Pipeline]() # TODO Add
114+
- [Matching Algorithm](server/matching/README.md)

server/matching/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,50 @@ Diagram showing the basic class structure for the Matching Microservice
77

88
![Class Diagram](../../resources/diagrams/meetatmensa_uml_class_matching.png)
99

10+
## The Meet@Mensa Matching Algorithm
11+
12+
### Goal
13+
Match students into groups of 3-5, taking preferences into consideration, but prioritizing primarily including as many students in the match as possible.
14+
15+
### Step 0: Prepare Clusters
16+
17+
Students are assigned to "clusters" representing the potential start-times of an event.
18+
Since events take 45 minutes, a student is added to cluster 1 (11:00 - 11:45) if they are available in time-slots 1 (11:00 - 11:15) , 2 (11:15-11:30) and 3 (11:30-11:45).
19+
A single student can be assigned to multiple clusters.
20+
21+
### Step 1: Eliminate Dead Clusters
22+
23+
Meet@Mensa groups must be made up of at least 3 students. Clusters containing less than 2 students therefore are considered "dead" and are removed.
24+
If removing a cluster would remove a student's last entry in any cluster, that student is considered unmatchable.
25+
26+
### Step 2: Determine Critical Candidate
27+
28+
Our priority is ensuring as many students are matched as possible.
29+
To enable this, we next determine which user is in the fewest clusters, and therefore most at risk of becoming unmatchable.
30+
In case of ties we select the most flexible student (with the fewest filters set) as critical.
31+
32+
### Step 3: Construct Minimal Group around Critical Candidate
33+
34+
The algorithm then generates all possible 3-person groups that can include the critical candidate and checks them for quality.
35+
Group quality is determined by the preferences of each user in said group.
36+
For all users with preferences in the group, one "quality point" is awarded every time another student in the group fulfills one of their preferences.
37+
Students without preferences are treated as if all their preferences were fulfilled.
38+
The algorithm then selects the highest quality group that includes the Critical Candidate.
39+
40+
### Step 4: Remove Matched Users from Clusters
41+
42+
All entries corresponding to the 3 users are then removed from the clusters
43+
44+
### Step 5: Loop
45+
46+
Repeat Steps 1-4 until all clusters are empty
47+
48+
### Step 6: Attempt to fit Unmatchable Students
49+
50+
Finally, the algorithm check for any possibility to include students that were previously set as unmatchable into one of the matched groups.
51+
If multiple such groups are possible, the one with the highest quality is picked.
52+
Because of the nature of the clusters, at most 2 unmatchable users should left per cluster, meaning group sizes will not exceed 5.
53+
1054
## Local Deployment with Docker
1155
```
1256
# Build and tag the Docker image

0 commit comments

Comments
 (0)