mirror of
https://github.com/tgorordo/carousel.git
synced 2026-06-12 20:42:13 -07:00
switch using it.permutations in check_unstable for legibility
This commit is contained in:
parent
55aa0b8e43
commit
85f1b71d3f
1 changed files with 1 additions and 11 deletions
|
|
@ -85,7 +85,7 @@ def get_rank(ranking, ranker, rankee):
|
|||
|
||||
def check_unstable(match, applicant_ranking, reviewer_ranking):
|
||||
applicants = applicant_ranking.columns[1:] # assume unique applicants
|
||||
for a, b in it.combinations(applicants, 2):
|
||||
for a, b in it.permutations(applicants, 2):
|
||||
A = (
|
||||
match.select(c for c in match.iter_columns() if a in c).to_series().name
|
||||
) # the reviewer a is matched to
|
||||
|
|
@ -101,16 +101,6 @@ def check_unstable(match, applicant_ranking, reviewer_ranking):
|
|||
)
|
||||
if b_prefers_A and A_prefers_b:
|
||||
return True
|
||||
|
||||
# or
|
||||
a_prefers_B = get_rank(applicant_ranking, a, B) < get_rank(
|
||||
applicant_ranking, a, A
|
||||
)
|
||||
B_prefers_a = get_rank(reviewer_ranking, B, a) < get_rank(
|
||||
reviewer_ranking, B, b
|
||||
)
|
||||
if a_prefers_B and B_prefers_a:
|
||||
return True
|
||||
# else
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue