Proposal - Round Robin Gift Exchange
Dec. 2nd, 2005 04:43 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Several people have suggested gift exhanges, or secret santas, or the like. The idea being, for people who don't know, that a group of people who would like to get each other presents, but don't have time, money or ideas enough, buy and receive one gift from people chosen randomly. (Normally by drawing names, so no-one occurs twice.)
I would use a computer algorithm, making the procedure:
* Sign up on a website listing 5-10 people you would buy a gift for one of.[1]
* You or it emails them and invites them to do the same.
* Next week, everyone is conveniently matched so they get an email giving them one person to buy a present for (ETA: from the list of people they specified they knew!), and will get one gift but they don't know who from yet.
* ETA: the matching may start from a friends list, but would probably need to be confirmed by hand.
I like the idea, and the tech necessary should be minimal.

[1] Or more if you like, but there shouldn't be much point. And don't choose your best friends necessarily. Miss out anyone you're buying for anyway, and anyone you can't think of anything for. And choose randomly so no-one's offended.
I would use a computer algorithm, making the procedure:
* Sign up on a website listing 5-10 people you would buy a gift for one of.[1]
* You or it emails them and invites them to do the same.
* Next week, everyone is conveniently matched so they get an email giving them one person to buy a present for (ETA: from the list of people they specified they knew!), and will get one gift but they don't know who from yet.
* ETA: the matching may start from a friends list, but would probably need to be confirmed by hand.
I like the idea, and the tech necessary should be minimal.
[1] Or more if you like, but there shouldn't be much point. And don't choose your best friends necessarily. Miss out anyone you're buying for anyway, and anyone you can't think of anything for. And choose randomly so no-one's offended.
no subject
Date: 2005-12-02 04:51 pm (UTC)no subject
Date: 2005-12-02 04:55 pm (UTC)Um. You first need to think about things like 'how are the least-connected of the people likely to end up signed up connected and how is the gift going to get between them' and 'how much should each person spend' and 'are there any appropriateness limits / allergic reactions we will need to take into account'.
no subject
Date: 2005-12-02 05:05 pm (UTC)Obviously there are existing websites that let 50 people exchange gifts.
Does that it less stupid?
no subject
Date: 2005-12-02 05:42 pm (UTC)No!
no subject
Date: 2005-12-02 05:46 pm (UTC)no subject
Date: 2005-12-02 05:04 pm (UTC)As you may remember from Graph Theory, a perfect matching of this type can fail to exist iff there is any set of too-selective givers such that the union of all the recipients they'd be willing to buy presents for has smaller size than the set itself. (By complementing both sets you can also derive a set of unlucky recipients such that there aren't enough givers willing to buy presents for them.) In that situation my code can also tell you what that set is, although it's unclear what you'd do about it if it happened. Perhaps mail all the people in the too-selective set and politely suggest that they choose at least one additional recipient from the unlucky set?
no subject
Date: 2005-12-02 05:06 pm (UTC)no subject
Date: 2005-12-02 05:11 pm (UTC)It's a very good way of getting started, because it's a ready made list of people you know about that well, but I think it would require manual editing, (a) because my flist includes virtual people and (b) I wanted to include people who don't lj.
no subject
Date: 2005-12-02 05:14 pm (UTC)no subject
Date: 2005-12-02 05:20 pm (UTC)no subject
Date: 2005-12-02 10:36 pm (UTC)no subject
Date: 2005-12-02 05:08 pm (UTC)If it comes to it, the code would probably indeed be very useful; I knew it would be a solved problem.
no subject
Date: 2005-12-02 05:27 pm (UTC)So if you wander into the Subversion repository (a web interface to which is linked from the main puzzle page), you should find
maxflow.h
andmaxflow.c
which define a set of functions which use the Ford-Fulkerson algorithm to solve the max-flow/min-cut problem. This is a superset of the perfect matching problem, which is why I wrote that rather than a simpler matching-finder.To solve a perfect matching problem, first construct a network containing one source, one node for each giver, one node for each recipient, and one sink. You need a graph edge going from the source to each giver, one from each recipient to the sink, and one going from each giver to each recipient iff that giver is willing to buy for that recipient. Hence, the maximum flow in that network is also the largest available matching. So then run the
maxflow
function; it will return you aflow
array stating whether each graph edge is part of the matching. It will also return a total maximum-flow value telling you how many edges were in the matching, from which you can quickly tell whether it was complete or not. If not, you can examine thecut
array to see which vertices were the cause of the problem: giver vertices with a 0 in thecut
array are the too-selective set, and recipients with a 1 are the unlucky people who not enough givers will buy for.An example of most of this code is given in the function
new_game_desc()
intents.c
, and again in theexecute_move()
function.I hope that's of the slightest use :-)
no subject
Date: 2005-12-02 05:41 pm (UTC)no subject
Date: 2005-12-02 05:35 pm (UTC)(S)
no subject
Date: 2005-12-02 05:39 pm (UTC)no subject
Date: 2005-12-03 08:58 pm (UTC)no subject
Date: 2005-12-04 05:45 pm (UTC)