jeudi 19 mars 2015

Randomly matching users

I'm trying to think of an algorithm that randomly pairs Users based on some User defined attributes (location, interests, etc). Many apps and games have implemented similar algorithms, for example, Tinder (the popular dating mobile app) randomly matches Users based on their locations, gender, and age. Though, with Tinder, it doesn't matter about both Users "pairing" with each other. Whereas, I'm trying to pair Users for some sort of instant communication and interaction.


The problem is I don't know where to begin. I don't want to reinvent the wheel if its been done so many times or at least use another implementation as a reference. Though, my Google searches haven't been resourceful, most likely due to not exactly knowing what to search for, such as, a specific algorithm name.


How would I implement a weighted random User matching algorithm? A best match algorithm would be even better. I don't expect you to provide all the code for one (unless it's really easy), psuedo-code/theory or a link to a well defined library or implentation will do.


What I'm thinking of so far:


Storing/Connecting



  • Separate Users into two tables: Active and Passive. Active User performs random search/pair algorithm through the Passive table. Sends matched Passive User a match request. Passive User accepts first received match request denies all others. Users are matched for communication and can be removed from the tables. Might need a timeout for the Passive User if it's not "picked" after some time so it can become an Active User.


Searching



  • Active User randomly selects set amount of Passive Users based on something like set range from Active Users location. Take into account Passive Users set range from their location?


Weighted Algorithm



  • Each User defined attribute is assigned a specific weight for importance. Calculate number of matched attributes (what about similar or in range?) along with their weight combined together. Sort Users based on their match value. Perform storing/connecting stage for the highest matched Passive User. If that User accepts match request, they are connected, if not try next highest matched Passive User. If no connection is made start entire algorithm over.





Aucun commentaire:

Enregistrer un commentaire