Sounds like a variation on the Stable Roommate problem?
https://en.m.wikipedia.org/wiki/Stable_roommates_problem?wprov=sfla1
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send
Thanks! Just what I needed.
/Jens Axel
2018-05-15 13:04 GMT+02:00 Daniel Prager :
> A more low-tech approach ...
>
> #lang racket
>
> (require threading)
>
> (define students '(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z))
>
> (define indexes (for/hash ([s students] [i (in-naturals)])
A more low-tech approach ...
#lang racket
(require threading)
(define students '(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z))
(define indexes (for/hash ([s students] [i (in-naturals)])
(values s i)))
; A -> 0, B -> 1, ...
(define (index student)
(hash-ref indexes s
Context:
I have students A, B, C, ..., Z that needs to work in pairs for their exam.
Each student has made a wish list with 3 other students that they'd like to
work with.
I need to find the maximum possible pairing.
I think - maybe - that the algorithm I need is Edmond's blossom algorithm.
Am I
4 matches
Mail list logo