I want to rank a population $P=\{P_1,\ldots,P_n\}$. I am given a set $R=\{R_1,\ldots,R_k\}$ of partial rankings. The partial rankings may have varying sizes (e.g. the first ranking ranks only 8 individuals, the next ranking ranks 20 individuals, ...).
I want to assign points to each combination of individual $P_i$ and ranking $R_i$. If $P_i$ does not participate in $R_i$, $P_i$ should get 0 points. If $P_i$ participates in $R_i$, $P_i$ should get points depending on their rank in $R_i$ and the size of $R_i$.
The total points of an an individual $P_i$ is the sum of their points in their 4 best rankings.
How should I design the function that assigns points for a certain rank $j$ in a ranking of size $s$?