06-12-2016, 09:19 AM
(This post was last modified: 06-12-2016, 03:45 PM by Sylvain Boisse.)
Hi everyone, first post here. Let me just first say I absolutely love this App! <3
Now to the problem at hand, I thought of a robust algorithm for fair splitting. Works for any tracks, any number of drivers, any number of servers, providing a 'fair' split, with top drivers in more packed server whenever possible, no servers at less than half grid, and of course mimimum number of servers is use!
Let's say you have
I hope I am being clear!
As you can see, load is spread, so no secondary server is left with a handful of drivers. At the same time, higher splits are favored : Server 1 load is always high.
Any thoughts? I am willing to provide pseudo-code or actual tested code for this, in any language.
Now to the problem at hand, I thought of a robust algorithm for fair splitting. Works for any tracks, any number of drivers, any number of servers, providing a 'fair' split, with top drivers in more packed server whenever possible, no servers at less than half grid, and of course mimimum number of servers is use!
Let's say you have
- A track whose start grid can accomodate G drivers (for my example G=20)
- A group of N ranked drivers (formy example N=12,18,25,...,64)
- A number of servers S (for my example S=3)
- If N>G*S: fill all servers (not enough servers for all the drivers!)
- If 0<N<=G: everyone on server 1
- If G<N<=1.5xG : split 50%/50% on servers: S1=S2= N/2 (with uneven N, favor highest split server)
- If 1.5xG<N : fill Server 1, rest is split between remaining servers as per rule 2&3&4 recursively
Code:
N=12: S1=12 | S2=0 | S3=0 | rule2: all on S1
N=18: S1=18 | S2=0 | S3=0 | rule2: all on S1
N=25: S1=13 | S2=12 | S3=0 | rule3: 50/50 split on S1&S2 (round towards S1)
N=28: S1=14 | S2=14 | S3=0 | rule3: 50/50 split S1&S2
N=35: S1=20 | S2=15 | S3=0 | rule4: fill S1, 15 drivers remain, rule 2: all on S2
N=42: S1=20 | S2=11 | S3=11 | rule4: fill S1, 22 drivers remain, rule 3: 50/50 on S2&S3
N=49: S1=20 | S2=15 | S3=14 | rule4: fill S1, 21 drivers remain, rule 3: 50/50 on S2&S3 (round towards S2)
N=57: S1=20 | S2=20 | S3=17 | rule4: fill S1, 37 drivers remain, rule 4: fill S2, rule 2: all on S3
N=64: S1=20 | S2=20 | S3=20 | rule1: fill all (not enough servers)
I hope I am being clear!
As you can see, load is spread, so no secondary server is left with a handful of drivers. At the same time, higher splits are favored : Server 1 load is always high.
Any thoughts? I am willing to provide pseudo-code or actual tested code for this, in any language.