Skip to content

feat: 매칭 알고리즘 품질 개선#55

Merged
DaleSeo merged 10 commits intomainfrom
48-improve-matching-algorithm-quality
Mar 29, 2026
Merged

feat: 매칭 알고리즘 품질 개선#55
DaleSeo merged 10 commits intomainfrom
48-improve-matching-algorithm-quality

Conversation

@sounmind
Copy link
Copy Markdown
Member

@sounmind sounmind commented Mar 23, 2026

요약

Closes #48

  • Recency 감쇠 스코어링: 기존 총 만남 횟수 기반(1/(1+count))을 1/(1 + Σ(1/roundsAgo))로 교체 — 최근 만남일수록 큰 페널티, 오래된 만남은 자연 감쇠
  • 페어 단위 하드 제외: 기존 그룹 단위 lookback=4 제외를 페어 단위 lookback=1로 교체. 직전 라운드에서 같은 그룹이었던 두 사람은 다음 라운드에 같은 그룹 불가 (대안 없으면 fallback)
  • Best-of-N 파티션 최적화: greedy 순차 선택을 전역 탐색으로 교체. 랜덤 파티션 N개 생성 후 최고점 선택 (규모별 N: ≤16명 5,000 / 17~30명 2,000 / 30명+ 1,000)
  • 성능 최적화: 페어 점수를 trial 루프 전에 미리 계산하여 중복 연산 제거
  • 정리: 미사용 함수 8개 제거, temperature 옵션 제거, matcher.ts 순감 -287줄

변경 파일

파일 변경 내용
src/matcher.ts 핵심 알고리즘 재작성: 스코어링, 파티션 탐색, 미사용 코드 제거
src/matcher.test.ts 신규 함수 테스트, 통계적 검증, 성능 벤치마크 추가/갱신
src/types.ts MatchingOptions에서 temperature 필드 제거

테스트 결과

  • 47개 테스트 통과 (단위, 통합, 통계적 검증, 성능)
  • 기존 createMatches 통합 테스트 전부 통과 (시그니처/반환 타입 불변)
  • 하드 제외: 직전 라운드 페어가 재매칭되지 않음 (20회 반복 검증)
  • Recency 선호: 페널티가 낮은(오래된) 페어가 높은(최근) 페어보다 선택됨
  • 성능: 30명 매칭 ~16ms 완료 (제한: 500ms)

🤖 Generated with Claude Code

evaninad and others added 9 commits March 23, 2026 08:29
Implements recency-weighted meeting penalty using Σ(1/roundsAgo) formula,
replacing the flat getMeetingCount approach for better recent-history sensitivity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract pairKey helper to deduplicate key generation logic
- Precompute all pair scores before trial loop in findBestPartition,
  eliminating redundant calculateRecencyPenalty calls across N trials
- Strengthen findBestPartition hard exclusion test to check individual
  pair violations instead of only checking both pairs simultaneously

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sounmind sounmind changed the title feat: improve matching algorithm quality feat: 매칭 알고리즘 품질 개선 Mar 23, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sounmind sounmind self-assigned this Mar 23, 2026
@sounmind sounmind requested a review from DaleSeo March 23, 2026 13:22
@DaleSeo DaleSeo merged commit b920481 into main Mar 29, 2026
1 check passed
@DaleSeo DaleSeo deleted the 48-improve-matching-algorithm-quality branch March 29, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

매칭 알고리즘 품질 개선

3 participants