Total hits on items in a sorted list where a hit re-sorts the list

krioni

New member
Joined
Aug 15, 2018
Messages
2
First, please let me know if this belongs in another forum category, but it seemed like probability/statistics was the closest match to my problem.


This is a kind of problem that I don't remember working on before. I could model it as a state machine that iterates through the defined rules, but hope there’s a more formulaic way to get my answers.


Here’s the situation:
You’ve got a collection of people, separated into five groups (A...E) of varying numbers of people: CountOfGroupA, CountOfGroupB, CountOfGroupC, CountOfGroupD, and CountOfGroupE. Those people are put on a list, sorted in priority order, where they are all sorted first by a Rank formula. Each Group has a similar Rank formula, but with a different multiplier and adding factor. Ties-by-Rank _within_ a Group are sorted by Age (oldest person first). Ties-by-Rank between two people from different Groups are decided by being in the alphabetically-earlier Group, so a GroupA person tied-by-Rank with someone from GroupB will come first.


You are going to iteratively hand out an Opportunity to the person at the top of the list (in Rank order, from smallest to largest Rank). How many Opportunities a person has been given is a component of the formula, so that moves them to a different Rank within the list. You then iterate, handing out the next Opportunity to the person who is now at the top of the re-sorted list.


The question is, using those rules and a specified total number of rounds handing out opportunities, how many Opportunities does each group get total?


The formula for a group is as follows:
RankOfIndividualPersonFromGroup =
CoefficientOfGroup * OpportunitiesReceivedSoFarForThisPerson
+ StartingPointsOfGroup


Simplified:
R = c*x + s
where R is Rank, c is the coefficient, x is the OpportunitiesReceivedSoFar (of that person), and s is the StartingPointsGroupA.


The convention is that you pick Coefficients and Starting Points for each Group so that, to start, the people in GroupA are before (lower Rank) all the people in Group B, B is before Group C, and so on.


So, for example, you might have the following situation (simplified to only have two groups):
CountOfPeopleInGroupA = 2
CoefficientGroupA = 1
StartingPointGroupA = 1
So, the Rank formula for A is: x+1


CountOfPeopleInGroupB = 3
CoefficientGroupB = 1.5
StartingPointGroupB = 2
So, the Rank formula for B is: 1.5*x + 2


That means, before any Opportunities have been handed out, the sorted list to start Round 1 would be as follows:
1 = 1*0 + 1, OldestPersonGroupA
1 = 1*0 + 1, 2ndOldestPersonGroupA
2 = 1.5*0 + 2, OldestPersonGroupB
2 = 1.5*0 + 2, 2ndOldestPersonGroupB
2 = 1.5*0 + 2, 3rdOldestPersonGroupB


So, in Round 1, you give an Opportunity to the oldest person in group A.
That means that the oldest person in Group A would get a new Rank:


2 = 1*1 + 1, for OldestPersonGroupA


Notice that person is now “tied” with the people in Group B, but they still come first (Group level is a tie-breaker). That means the list now looks like this, to start Round 2 (most recent change is bolded and underlined):


1 = 1*0 + 1, 2ndOldestPersonGroupA
2 = 1*1 + 1, OldestPersonGroupA
2 = 1.5*0 + 2, OldestPersonGroupB
2 = 1.5*0 + 2, 2ndOldestPersonGroupB
2 = 1.5*0 + 2, 3rdOldestPersonGroupB


So, handing out the Round 2 opportunity will give us this, to start Round 3:


2 = 1*1 + 1, OldestPersonGroupA
2 = 1*1 + 1, 2ndOldestPersonGroupA
2 = 1.5*0 + 2, OldestPersonGroupB
2 = 1.5*0 + 2, 2ndOldestPersonGroupB
2 = 1.5*0 + 2, 3rdOldestPersonGroupB


Now, handing out another Opportunity to the oldest person in Group A means their rank goes up to 3, which moves them to the very bottom of the list, so we get this to start Round 4:


2 = 1*1 + 1, 2ndOldestPersonGroupA
2 = 1.5*0 + 2, OldestPersonGroupB
2 = 1.5*0 + 2, 2ndOldestPersonGroupB
2 = 1.5*0 + 2, 3rdOldestPersonGroupB
3 = 1*2 + 1, OldestPersonGroupA


Handing out the next Opportunity would mean we start Round 5 with:
2 = 1.5*0 + 2, OldestPersonGroupB
2 = 1.5*0 + 2, 2ndOldestPersonGroupB
2 = 1.5*0 + 2, 3rdOldestPersonGroupB
3 = 1*2 + 1, OldestPersonGroupA
3 = 1*2 + 1, 2ndOldestPersonGroupA


Handing out the next Opportunity would mean we start Round 6 with:
2 = 1.5*0 + 2, 2ndOldestPersonGroupB
2 = 1.5*0 + 2, 3rdOldestPersonGroupB
3 = 1*2 + 1, OldestPersonGroupA
3 = 1*2 + 1, 2ndOldestPersonGroupA
3.5 = 1.5*1 + 2, OldestPersonGroupB


...and so on.

So, if there were only 5 Opportunities to hand out (finished 5 rounds), the person totals would be as follows:

Opportunities Received for:

2 for OldestPersonGroupA

2 for 2ndOldestPersonGroupA
1 for OldestPersonGroupB
0 for 2ndOldestPersonGroupB
0 for 3rdOldestPersonGroupB


The gives the final answer I am seeking:
If only 5 Opportunities are given out:
Group A combined gets 4.
Group B combined gets 1.


I know I could solve this using essentially a simulator program that acts like a state machine, iterating over Rounds until every Opportunity has been distributed. What I’m hoping is that there is a way to determine mathematically the total number of opportunities each Group will get, depending on what the count-of-people, coefficient, and starting point is for each of the groups.




Any thoughts on whether that is a reasonable hope and, if so, where to start?
 
...
Any thoughts on whether that is a reasonable hope and, if so, where to start?
...

Does anyone think this is even something that I should be trying to solve formulaically, versus building a simulator state machine in code?
 
Top