Talk:Fairshare between two and more: Difference between revisions

m
→‎Fairness and randomized rewards: Thanks for the investigation
(Trying to figure out "fairness")
m (→‎Fairness and randomized rewards: Thanks for the investigation)
 
(4 intermediate revisions by 2 users not shown)
Line 6:
 
:: Great :-) <br>--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 18:26, 2 February 2020 (UTC)
::: I tried to clearify things to me, like [[User:Paddy3118|Paddy3118]] described in his links.Without different values, it makes no sense.<BR>TheRest first will get the highest value of a bucketremoved, theexplanation secondby the[[User:Paddy3118|Paddy3118]] maximum of left over and so on([[User:Horst.Ih|Horst.h]]) use a bucket of size Peoplecnt and the values are PeopleCnt downto 1[[User:Horst.h|Horst.Theh]] choosen people grabs one value from([[User Toptalk:Horst.Afterh|talk]]) all11:42, people26 areJune finished the game starts again2020 ( MOD peoplecntUTC). <lang pascal>program Fair;
===Fairness example and cycles===
{$IFDEF FPC}
I saw Horsts' Perl program above, and recognized that the idea of fairness is hard to bring across so I thought I might do an example by hand.
{$MODE DELPHI}
{$OPTIMIZATION ON,ALL}
{$CodeAlign proc=8}
{$ELSE}
{$APPTYPE CONSOLE}
{$ENDIF}
 
The set of numbers in this case are not a linear progression, so we (maybe), see the emergence of Thue-Morse as being the most "fair" calculated as the spread in final amounts per person.
const
cntbasedigits = 21;
type
tSumDigit = record
sdSumDig : NativeUint;
sdBase : NativeUint;
sdNumber : NativeUint;
sdDigits : array[0..cntbasedigits-1] of NativeUint;
end;
var
SumWealth : array of NativeUint;
Values : array of NativeUint;
 
'''For all cases we will have have three people A B and C to choose the best at their turn, from the same, ever decreasing pots of money.'''
function InitSumDigit(n,base : NativeUint):tSumDigit;
var
sd : tSumDigit;
qt : NativeUint;
i : integer;
begin
with sd do
begin
sdNumber:= n;
sdBase := base;
fillchar(sdDigits,SizeOf(sdDigits),#0);
sdSumDig :=0;
i := 0;
// calculate Digits und sum them up
while n > 0 do
begin
qt := n div sdbase;
{n mod base}
sdDigits[i] := n-qt*sdbase;
inc(sdSumDig,sdDigits[i]);
n:= qt;
inc(i);
end;
end;
InitSumDigit:=sd;
end;
 
====18 then 27 Fibonacci numbers====
procedure IncSumDigit(var sd:tSumDigit);
<pre>Numbers: [2584, 1597, 987, 610, 377, 233, 144, 89, 55, 34, 21, 13, 8, 5, 3, 2, 1, 1]
var
i,d: integer;
begin
i := 0;
with sd do
begin
inc(sdNumber);
repeat
d := sdDigits[i];
inc(d);
inc(sdSumDig);
//base-1 times the repeat is left here
if d < sdbase then
begin
sdDigits[i] := d;
BREAK;
end
else
begin
sdDigits[i] := 0;
dec(sdSumDig,sdbase);
inc(i);
end;
until i > high( sdDigits);
end;
end;
 
Order: ABC_ABC_ABC_ABC_ABC_ABC : Simple Repetition
procedure First25(base:NativeUint);
A gets: 2584 + 610 + 144 + 34 + 8 + 2 = 3382
var
B gets: 1597 + 377 + 89 + 21 + 5 + 1 = 2090
MySumDig : tSumDigit;
C gets: 987 + 233 + 55 + 13 + 3 + 1 = 1292
cnt: NativeUint;
Maximum difference in amounts = 2090
begin
write(' [',base:5,'] -> ');
MySumDig:=InitSumDigit(0,base);
cnt := 0;
repeat
with MySumDig do
write(sdSumDig MOD sdbase,'-');
inc(cnt);
IncSumDigit(MySumDig);
until cnt >= 25;
writeln('....');
end;
 
Order: ABC-BCA-CAB_ABC-BCA-CAB : Simple Rotation
procedure CheckRoundsOfPeople(turns,peopleCnt:NativeUint);
A gets: 2584 + 233 + 89 + 34 + 3 + 1 = 2944
var
B gets: 1597 + 610 + 55 + 21 + 8 + 1 = 2292
MySumDig : tSumDigit;
C gets: 987 + 377 + 144 + 13 + 5 + 2 = 1528
i,
Maximum difference in amounts = 1416
wholeWealth,
minWealth,
maxWealth : NativeUint;
Begin
setlength(SumWealth,peopleCnt);
setlength(Values,peopleCnt);
//Values[0] = peopleCnt ...Values[peopleCnt-1] = 1
For i := 0 to peopleCnt-1 do
Values[i] := peopleCnt-i;
 
Order: ABC-BCA-CAB-BCA-CAB-ABC : Thue-Morse Fairshare
MySumDig:=InitSumDigit(0,peopleCnt);
A gets: 2584 + 233 + 89 + 13 + 5 + 2 = 2926
i := 0;
B gets: 1597 + 610 + 55 + 34 + 3 + 1 = 2300
while i<turns do
C gets: 987 + 377 + 144 + 21 + 8 + 1 = 1538
begin
Maximum difference in amounts = 1388
inc(SumWealth[MySumDig.sdSumDig MOD peopleCnt],Values[i MOD peopleCnt]);
IncSumDigit(MySumDig);
inc(i);
end;
setlength(Values,0);
MinWealth := High(MinWealth);
MaxWealth := Low(MaxWealth);
For i := 0 to peopleCnt-1 do
Begin
wholeWealth := SumWealth[i];
IF MaxWealth<wholeWealth then
MaxWealth:=wholeWealth;
IF MinWealth>wholeWealth then
MinWealth := wholeWealth;
end;
writeln(peopleCnt:6,turns:11,MinWealth:10,MaxWealth:10, MinWealth/MaxWealth:10:7);
setlength(SumWealth,0);
end;
 
Numbers: [196418, 121393, 75025, 46368, 28657, 17711, 10946, 6765, 4181, 2584, 1597, 987, 610, 377, 233, 144, 89, 55, 34, 21, 13, 8, 5, 3, 2, 1, 1]
procedure CheckRoundsOfPeopleOneByOne(turns,peopleCnt:NativeUint);
var
i,
wholeWealth,
minWealth,
maxWealth : NativeUint;
Begin
setlength(SumWealth,peopleCnt);
setlength(Values,peopleCnt);
//Values[0] = peopleCnt ...Values[peopleCnt-1] = 1
For i := 0 to peopleCnt-1 do
Values[i] := peopleCnt-i;
 
Order: ABC_ABC_ABC_ABC_ABC_ABC_ABC_ABC_ABC : Simple Repetition
i := 0;
A gets: 196418 + 46368 + 10946 + 2584 + 610 + 144 + 34 + 8 + 2 = 257114
while i<turns do
B gets: 121393 + 28657 + 6765 + 1597 + 377 + 89 + 21 + 5 + 1 = 158905
begin
C gets: 75025 + 17711 + 4181 + 987 + 233 + 55 + 13 + 3 + 1 = 98209
//first gets always the max value 0,1,2,3,4..,n
Maximum difference in amounts = 158905
inc(SumWealth[i MOD peopleCnt],Values[i MOD peopleCnt]);
inc(i);
end;
setlength(Values,0);
MinWealth := High(MinWealth);
MaxWealth := Low(MaxWealth);
For i := 0 to peopleCnt-1 do
Begin
wholeWealth := SumWealth[i];
IF MaxWealth<wholeWealth then
MaxWealth:=wholeWealth;
IF MinWealth>wholeWealth then
MinWealth := wholeWealth;
end;
writeln(peopleCnt:6,turns:11,MinWealth:10,MaxWealth:10, MinWealth/MaxWealth:10:7);
setlength(SumWealth,0);
end;
 
Order: ABC-BCA-CAB_ABC-BCA-CAB_ABC-BCA-CAB : Simple Rotation
const
A gets: 196418 + 17711 + 6765 + 2584 + 233 + 89 + 34 + 3 + 1 = 223838
cTURNS = 500;
B gets: 121393 + 46368 + 4181 + 1597 + 610 + 55 + 21 + 8 + 1 = 174234
begin
C gets: 75025 + 28657 + 10946 + 987 + 377 + 144 + 13 + 5 + 2 = 116156
First25(2);First25(3);First25(5); First25(11);
Maximum difference in amounts = 107682
writeln;
writeln('Fair share');
writeln(' people turns MinWealth MaxWealth ratio MinWealth/MaxWealth');
CheckRoundsOfPeople(11*11,11);
CheckRoundsOfPeople(1377 *1377,1377);
CheckRoundsOfPeople(cTURNS*11,11);
CheckRoundsOfPeople(cTURNS*1377,1377);
 
Order: ABC-BCA-CAB-BCA-CAB-ABC-CAB-ABC-BCA : Thue-Morse Fairshare
writeln;
A gets: 196418 + 17711 + 6765 + 987 + 377 + 144 + 21 + 8 + 1 = 222432
writeln('First gets max value , last gets 1');
B gets: 121393 + 46368 + 4181 + 2584 + 233 + 89 + 13 + 5 + 2 = 174868
writeln(' people turns MinWealth MaxWealth ratio MinWealth/MaxWealth');
C gets: 75025 + 28657 + 10946 + 1597 + 610 + 55 + 34 + 3 + 1 = 116928
CheckRoundsOfPeopleOneByOne(11*11,11);
Maximum difference in amounts = 105504
CheckRoundsOfPeopleOneByOne(1377 *1377,1377);
</pre>
CheckRoundsOfPeopleOneByOne(cTURNS*11,11);
CheckRoundsOfPeopleOneByOne(cTURNS*1377,1377);
end.</lang>
{{out}}
<pre>
[ 2] -> 0-1-1-0-1-0-0-1-1-0-0-1-0-1-1-0-1-0-0-1-0-1-1-0-0-....
[ 3] -> 0-1-2-1-2-0-2-0-1-1-2-0-2-0-1-0-1-2-2-0-1-0-1-2-1-....
[ 5] -> 0-1-2-3-4-1-2-3-4-0-2-3-4-0-1-3-4-0-1-2-4-0-1-2-3-....
[ 11] -> 0-1-2-3-4-5-6-7-8-9-10-1-2-3-4-5-6-7-8-9-10-0-2-3-4-....
 
Thue-Morse is best in ''this'' case.
Fair share
people turns MinWealth MaxWealth ratio MinWealth/MaxWealth
11 121 66 66 1.0000000
1377 1896129 948753 948753 1.0000000
11 5500 2985 3015 0.9900498
1377 688500 125250 563750 0.2221729
 
Hmmm, I feel a blog coming on...
First gets max value , last gets 1
 
//[ 11] -> 0-1-2-3-4-5-6-7-8-9-10-0-1-2-3-4-5-6-7-8-9-10-0-1-2-3-....
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 03:50, 26 June 2020 (UTC)
people turns MinWealth MaxWealth ratio MinWealth/MaxWealth
 
11 121 11 121 0.0909091
===Fairness and randomized rewards===
1377 1896129 1377 1896129 0.0007262
I needed to further investigate Horst's work above finding repeated rotations being best, being best, and me finding that for Fibonacci (also above), Thue-Morse wins over repeated rotations.
11 5500 500 5500 0.0909091
 
1377 688500 500 688500 0.0007262</pre>
I wrote something that for the rewards just took some random integers and ordered them highest to lowest; then used different orderings of three people selecting their best reward on the from that reward order. The winning ordering would have the least difference between peoples total reward, '''and crucially multiple orderings can have the win if they all have the same minimum spread of peoples winnings.'''
:::This shows the fairness.But a cyclic value of people A to C is sufficient.<BR>The easier sequence ABC_BCA_CAB will get the same results. A,B,C are in every possible position, so square( peopleCnt) is fair too. [[User:Horst.h|Horst.h]]14:16, 25 June 2020 (UTC)
 
;Results:
<pre>## ALL SIMULATIONS BEING OF 3 PEOPLE TAKING TURNS TO TAKE EVER DECREASING AMOUNTS OF CASH FROM A REWARD_LIST.
 
Give summary stats on 250_000 repetitions of:
New reward_list = an ordered, random, selection of between 3 and 84 ints from the range 999_999 .. 0:
(Note: reward_list length is always a multiple of 3)
Each of the following 4 methods of ordering used to order this reward_list [
"Randomised: Gen from repeat(shuffle('ABC')) eg ABC CAB ABC ABC BCA ...",
"Simple Repetition: Gen from repeat('ABC') eg ABC ABC ABC ...",
"Simple Rotation: Gen from repeat(rotate('ABC')) eg ABC BCA CAB, ABC BCA CAB, ... ",
"Thue-Morse Fairshare: Start _sequence_ not replicated later, but 'balanced' ABC's",
]
The ordering(s) with the LEAST spread of winnings per person wins the round.
 
SUMMARY
Wins for All 250_000 repetitions
order_by_thue_morse : 116_022
order_by_rotation : 116_007
order_by_randomise : 51_744
order_by_repetition : 8_905
 
Wins for All 88_099 repetitions where: len(reward_list) div 9 == 0
order_by_thue_morse : 37_591
order_by_rotation : 37_471
order_by_randomise : 13_037
Wins for All 115_767 repetitions where: len(reward_list) div 9 == 3
order_by_rotation : 42_194
order_by_thue_morse : 42_080
order_by_randomise : 22_588
order_by_repetition : 8_905
Wins for All 88_812 repetitions where: len(reward_list) div 9 == 6
order_by_thue_morse : 36_351
order_by_rotation : 36_342
order_by_randomise : 16_119
 
Wins for All 26_679 repetitions where: len(reward_list) div 27 == 0
order_by_thue_morse : 11_310
order_by_rotation : 11_209
order_by_randomise : 4_160
Wins for All 62_423 repetitions where: len(reward_list) div 27 == 3
order_by_thue_morse : 20_059
order_by_rotation : 19_973
order_by_randomise : 13_486
order_by_repetition : 8_905
Wins for All 35_168 repetitions where: len(reward_list) div 27 == 6
order_by_thue_morse : 14_211
order_by_rotation : 14_137
order_by_randomise : 6_820
Wins for All 34_589 repetitions where: len(reward_list) div 27 == 9
order_by_rotation : 15_083
order_by_thue_morse : 14_936
order_by_randomise : 4_570
Wins for All 26_598 repetitions where: len(reward_list) div 27 == 12
order_by_rotation : 11_068
order_by_thue_morse : 10_888
order_by_randomise : 4_642
Wins for All 26_654 repetitions where: len(reward_list) div 27 == 15
order_by_thue_morse : 11_045
order_by_rotation : 10_976
order_by_randomise : 4_633
Wins for All 26_831 repetitions where: len(reward_list) div 27 == 18
order_by_thue_morse : 11_345
order_by_rotation : 11_179
order_by_randomise : 4_307
Wins for All 26_746 repetitions where: len(reward_list) div 27 == 21
order_by_rotation : 11_153
order_by_thue_morse : 11_133
order_by_randomise : 4_460
Wins for All 26_990 repetitions where: len(reward_list) div 27 == 24
order_by_rotation : 11_229
order_by_thue_morse : 11_095
order_by_randomise : 4_666
</pre>
 
Thue-Morse wins for this case of random rewards, but not by much!
 
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 12:04, 26 June 2020 (UTC)
:A simple rotation of n slots/people is balanced (= A..Z were all once in every position 1..n ) after n rotations like Thue-Morse, but Thue-Morse changes than the order of the permutations of ABC so A isn't always the first fetcher after n*n.That's more fair.Still more work to calculate and for big n the balance n*n is hard to reach.After that point Thue-Morse makes the difference over simple rotation. --[[User:Horst.h|Horst.h]] [[User:Horst.h|Horst.h]] ([[User talk:Horst.h|talk]]) 06:39, 27 June 2020 (UTC)
Anonymous user