I've already managed to implement Elo's rating system on items. What I am comparing does not really matter, but for the example let's say we are trying to find out what subjectively the best number is (1|2|3|4|5, but this can be any range/set) by user input.
The most often practiced way of doing this, is selecting two random elements of the set and letting the user pick one of them. Note that this does not properly compare everything to everything; you might get duplicate comparisons and some combinations might never be compared.
My idea is to populate a combinations table with all the unique combinations between what is being compared (amount of rows: {count Array elements} choose 2 / example: 5 nCr 2). A and b are foreign keys to the score table holding the data for elo's rating system.
If an element disappears, the table can be cleaned and when a new element is added, a new set of permutations is added to the table.
id a b
1 1 2
2 1 3
3 1 4
4 1 5
5 2 3
The user would then be showed a randomly picked combination from the combinations table: ([...] WHERE NOT id IN (ids of combinations this user has already set a vote for
)). If there's nothing left, a message is shown that "everything has already been compared to everything, come back after {cron_time}!".
Users should be able to compare without registration. Plug and play. This is one of the first problems which arise. How to identify unique users? Sessions could work but they can easily be renewed by the user. Ideas?
This implementation scales horribly. Both for each new user (the processed_combinations, even though truncated daily, can go huge) and the combinations table. Sure it works fine with comparing 1 to 5 with a few users, but what if we want to compare 1 to 100, or even thousand?
What are your ideas for a better implementation?