Remember Prom Night? πΆ
One of the biggest issues β we faced was to make sure all the handsome boysπ€΅ were paired to all the gorgeous girlsπ in a fashion that takes care of everyone's priority π
"Nah! That's just a fairytale scenario", if this is your thought maybe python πcan do some magic do ensure that we can pair all of our mates in a manner they never break up
Yesβ‘, it can be done. Although we can't guarentee of getting those perfect pairs πsnitched together always but everyone gets to happy.π
As every other wizardsπ§ββοΈ , python has its own conditions βfor this spell:
- Everyone should be brutually honest when asked about ranking their partners in order of preferrence
- The number of boys and girls must be equal. We don't want anyone to be left out in the corner. π
The given use case is an application of the popular Stable Marriage Problem and is solved by theGayle-Shapely algorithm
Initialize all m β M and w β W to free
while β free man m who still has a woman w to propose to do
w := first woman on m's list to whom m has not yet proposed
if w is free then
(m, w) become engaged
else some pair (m', w) already exists
if w prefers m to m' then
m' becomes free
(m, w) become engaged
else
(m', w) remain engaged
end if
end if
repeat
- Until there's any boy left unpaired, the remaining unpaired boys go and ask out the girls as per their turns
- Each unmatched boy asks out the girls in his order of preference
- For every girl he asks out, if the girl is single, then she accepts the proposal and they get paired
- If the girl is already paired with another boy, she chooses according to her order of preference either to reject the proposal or to dump her current partner and accept the proposal,getting repaired in the process
- If a boy is dumped, he has to again ask out a girl in the above process
Convinced..huh? π and want this spell for yourself?
Here you go:
- clone or Download this repo β¬
- Open the Terminal π±βπ»
- Move inside π the repo
cd AutoPromPicker
- Open
autoprompick.py
and change the names of the girls,boys and preferences as desired𧱠- Now, the climax you have been waiting for!π. Run the script using Terminal
python autoprompick.py
- Abracadabra β‘
I assume you have python installed on your system and set to path.
- Tune this script to take in the number of girls and boys from the terminal,their names and preference of each
- Create a GUI for this
- Deployπ’ the above using Flask
- Create an end to end auto prom picker system, where the
N
boys andN
girls register themselves,put up their profile,rate each other and our script takes those values and gives them their best pair(s) as per precedence of ask out