Skip to content

Commit

Permalink
fix: Disable matching retention for now (#1148)
Browse files Browse the repository at this point in the history
* fix: Disable matching retention for now

Does not work so good in practice

* fix: Adapt tests

---------

Co-authored-by: Jonas Wilms <[email protected]>
  • Loading branch information
Jonasdoubleyou and Jonas Wilms authored Oct 8, 2024
1 parent 02f4dab commit aa13f63
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
28 changes: 14 additions & 14 deletions common/match/matching.perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,27 +123,27 @@ describe('Real World Matching Performance', () => {
'new',
10,
{
matchCountSum: 1044,
matchCountAvg: 15.582089552238806,
matchingSubjectsSum: 1793,
matchingSubjectsAvg: 1.7174329501915708,
matchingState: 332,
pupilWaitingTimeAvg: 20.26238745497861,
studentWaitingTimeAvg: 61.03486072712683,
matchCountSum: 1045,
matchCountAvg: 15.597014925373134,
matchingSubjectsSum: 1748,
matchingSubjectsAvg: 1.6727272727272726,
matchingState: 326,
pupilWaitingTimeAvg: 8.35097324007621,
studentWaitingTimeAvg: 51.64871701057732,
matchRuns: 67,
},
],
[
'new',
1,
{
matchCountSum: 1044,
matchCountAvg: 2.4110854503464205,
matchingSubjectsSum: 1795,
matchingSubjectsAvg: 1.7193486590038314,
matchingState: 323,
pupilWaitingTimeAvg: 17.05913367225194,
studentWaitingTimeAvg: 57.4907587186702,
matchCountSum: 1045,
matchCountAvg: 2.4133949191685913,
matchingSubjectsSum: 1706,
matchingSubjectsAvg: 1.632535885167464,
matchingState: 316,
pupilWaitingTimeAvg: 3.9678646337387073,
studentWaitingTimeAvg: 47.77617396444717,
matchRuns: 433,
},
],
Expand Down
9 changes: 7 additions & 2 deletions common/match/matching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,21 @@ export function matchScore(request: MatchRequest, offer: MatchOffer, currentDate
// how good a match is in (0, 1)
const score = 0.99 * subjectBonus + 0.01 * stateBonus;

// TODO: Prefer helpers that waited longer

// TODO: Fix retention for matches with only few subjects (e.g. both helper and helpee only have math as subject)
// in that case the score is not so high, and thus they are retained for a long time, although the match is perfect

// Retention: Do not directly match not so perfect matches,
// but let them wait for a few days, maybe a better match arrives
const offerWaitDays = (+currentDate - +offer.requestAt) / MS_PER_DAY;
/* const offerWaitDays = (+currentDate - +offer.requestAt) / MS_PER_DAY;
const requestWaitDays = (+currentDate - +request.requestAt) / MS_PER_DAY;
// Keep them at most for 3 weeks, and linearily increase the chance of getting matched
const doRetention = requestWaitDays < 21;
if (doRetention && score < 1 - requestWaitDays / 40) {
return NO_MATCH;
}
} */

return score;
}
Expand Down

0 comments on commit aa13f63

Please sign in to comment.