Lets say that there is a queue where users await matchmaking. The algorithm needs to select a number of hosts from two different groups (group A and group B). The players of each match will be part of the opposite group from the host (match hosted by a member of group A will be filled with players from group B). However, the queue will most likely have a disproportionate ratio of these groups. For example, group A could have 100 people in queue and group B could have 300. Games will be generated with between 5-10 players for each host.
What is a good way to go about this that minimizes the amount of people not in a match and evenly disperses hosting roles between the two groups?
Related
I have 150 students, and have to assign them to specific groups (with different topics). They can rank their preferences for the topics and will each have different groups. My main issue (more than being optimal with respect to a certain metric) is that the outcome has to be doable in the timetable.
More precisely, here are some data:
150 students
10 topics that each student will rank
each student will be assigned to 5 topics
the groups for each topic have to be between 10 and 15 (there may be various groups for the same topic or no group for some topics)
the final assignment has to fit into a timetable: there will be only 5 time slots (different groups can be on the same slots, but students cannot duplicate themselves to follow various groups at the same time)
What kind of algorithms could provide possibilities for such a situation?
I am asked to develop a pop-up ad display system for website. What it does is that the website will record the urls that the users visit and display the most relevant pop-up ad for them.
The website administrator first needs to define some groups (e.g. "Golfers", "Video game players") and then define some rules such as:
If the user visits the url pattern http://www.domain.com/golf-clubs/* and stay on that page for more than 10 seconds, he will be assigned to the Golfers group.
Also, the website administrator can create ads and assign them to different groups. For example, he can create a golf club promotion ad for users with the Golfers group. When the user visits the website again, the system will check if he belongs to any group(s) and display the most relevant ad for him.
For the user identification part, I am going to simply use cookies, which is to assign an unique cookie to every new website visitor.
The difficult part for me is to design the logic about which pop-up ad to display when the user belongs to multiple groups. For example, if he belongs to both Golfers and Video game players groups. Rather than randomly choosing one to display, is there a better way to handle such situation?
I have come up with a solution that I don't know if it's good or not. That is when a user is assigned a group it also comes with a score for that group. For example, if a user belongs to both Golfers and Video game players groups but he has a higher score for the Golfers group, the system will display a Golfers group ad for him as the first priority.
But this creates another difficult problem, how should the group scores calculated for each user? I also need to account for that recent page visits are of more importance, for example, maybe the user was a golfer and belongs to the Golfers group with a very high score but he recently visits a lot of video game web pages and gets assigned the Video game players group, how many scores should he get in this group?
Any thoughts would be appreciated.
Your problem is really close to some Operating System problems. For example when it decides about what to keep in cache and what to delete. Both "number" and "time" of visits influence the decision, and of course there are plenty of policies to select.
Here I try to make one in order to show how they work. I want to make it simple and manageable, so I use weights for time wand number of visits v. For each category, keep number of visits n and their relative times t. Then calculate sum of weight of time divided by relative times (except the expired ones) plus times of visits multiplied by corresponding weight: w/t+n*v.
Larger t leads to smaller score, while larger n (number of visits) improves the score.
I think I have a moderately useful solution but really curious if anyone has a better way. I'm also unsure how to properly define the type of problem I have, which means I haven't done much Googling.
The problem:
I have an unknown number of players who are selecting roles for a game. Valid roles are 1-5. The players MUST select a primary role, but they also have an option for a secondary role. The options for their secondary role are "none", one of 1-5 (different from their primary), or "any". I must then put players into teams of 5, each team requires one of each number. The goal is to maximize the number of correctly formed teams.
My current solution:
Divide players into 3 groups: A) People who selected "none" as their secondary, B) People who selected a number as their secondary, C) people who selected "any" s their secondary
Fill up teams with players from group A, placing them as their primary role.
Count the number of open positions remaining in the existing, non-full teams
Count the number roles represented by group B (both primary and secondary)
Based on the count of open positions, start adding players from group B - the order for filling positions is biggest deficit to smallest deficit, with a preference to picking players who have as their other role a number with the biggest size (by representation) in group B
Fill in the left overs with group C
If worse came to worse I could always just throw people into groups regardless of their preferred role, but ideally I would create correct groups.
Do primary and secondary roles have the same bearing on team balance? If so, you could look at the problem from the point of the teams and the status of each team's current roles/needs.
For example, the first person on team A may be both 1 and 3, so team A has a 1 and a 3. The next person on team A should not be a 1 or a 3 in either the primary or secondary role. Using the remaining team needs (roles 2,4,5) you can iterate through the possible members until either 1) the team is filled/balanced or 2) there are no remaining candidates.
Is there more to the problem? I get the feeling I'm not getting the whole issue.
I'm writing an application for a society in my campus and the main job of this application is to put members into groups subject to several
I need to determine the number of groups which depends on the number of members.
Then I need to arbitrarily/randomly select leaders for each group.
Then I need to add members to each group ensuring that each group satisfies the following constraints:
The number of members(including the leader) should be less than or equal to 7 and greater than or equal to 4 .
No more than 2/3 of the group should be the same gender.
No more than 2/3 of the group should be the same year of study.
Each member is classified as coming from a certain region depending on their place of residency. All members of the group should come from the same region.
Now I'd like to know how to go about this in terms of what known data structures and abstract data types can I use? What known algorithms can come in handy? Is there already a known computer science problem similar to mine that I can read up on?... etc... I think you get the question. I've done some googling around the web but nothing really helpful so far.
I have a data set consisting of 250 students from different schools and classrooms. For the experimental design, I would like to generate in a random manner 35 groups consisting of approx. 7 students in each group, and then after the first activity, break up the students as randomly as possible in to 25 groups of 10 students each. Is there a package and example of how I can perform this in R?
If there's no relation between which groups students are in during the first and second activities, then it's the same problem twice over.
Assuming a student can only belong to one group at a time, just shuffle the array and pull out elements per your group size until there are no more left.
students=1:250;
rand_students=sample(students,length(students));