Pairing evaluation function
OpenGotha's pairing evaluation function delivers, for a given pair of players and for a given round, a cost value
which takes into account evaluation criteria.
Base criteria
Avoid duplicate games
Set to 500 000 * 10^9 if the two players have not yet played each other.
Set to 0 if the two players have already played each other.
Random
If the option is selected, set to a value between 0 and 10^9
The deterministic function is a scrambling function of players names
The non-deterministic function is based on standard Java method.
Balance White and Black
For each player, the number of games played with White and no handicap is compared with the number of games played with Black and no handicap.
If both players give a strictly opposed result, then set to 1 000 000.
If one player's balance is 0 and the other one's is greater than 1, then set to 500 000.
Else set to 0.
Main criteria
Avoid mixing categories
If both players belong to the same category, then set to 20 000 * 10^9.
else set to coef * 20 000 * 10^9 where coef is a number between 0.0 and 1.0, computed by a concavity function
Minimize score difference
Aims at pairing inside a group.
If both players have equal score then set to 100 * 10^9.
else set to coef * 100 * 10^9 where coef is a number between 0.0 and 1.0, computed by a concavity function
Draw-up Draw-down
Aims at choosing players according to their positions inside their group (Top/Middle/Bottom) and at
correcting previous draw-ups/draw-downs.
If players have a group distance >=4, set to 0
else 5 scenarii :
- scenario = 0 : Both players have been already drawn up/down in the same sense
- scenario = 1 : One of the players has been already drawn up/down in the same sense
- scenario = 2 : Normal conditions (does not correct anything and no previous draw in the same sense.
This case also occurs if one DU/DD is increased, while one is compensated
- scenario = 3 : It corrects a previous DU/DD for one player
- scenario = 4 : It corrects a previous DU/DD for both players
If scenario = 0, set to 0
Else take in account the position of each player inside his group.
This gives a value between 0 and 20 000 000, according to the choice of "choose player in the top/middle/bottom" parameter.
If scenario = 1, add 20 000 000
If scenario = 2, add 40 000 000
If scenario = 3, add 60 000 000
If scenario = 4, add 80 000 000
Set to the resulting value, which is a number between 0 and 100 000 000
If players belong to different categories, decrease the resulting value
Seeding
Aims at pairing according to chosen seeding system : "Split and Random", "Split and Fold" or "Split and Slip".
The cost of this criterion is between 0 and maxSeeding = 5 000 000
cla1 and cla2 being the internal placement ( 0 to groupSize - 1) of players inside the group ...
- Split and Random.
If both players are not in the same half of the group, the cost is randomly chosen between 0.8 * maxSeeding and 1.0 * maxSeeding
else cost = 0
- Split and Fold.
x = cla1 + cla2 - (groupSize - 1)
cost = maxSeeding - maxSeeding * x^2 / (groupSize - 1)^2
- Split and Slip.
x = 2 * |cla1 - cla2| - groupSize
cost = maxSeeding - maxSeeding * x^2 / groupSize^2
Secondary criteria
Are secondary criteria relevant for these players ?
Secondary criteria are not applied for players above a certain ranking, as set by the organizer (by default, 1D) and, optionnaly (by default, secondary criteria applied), for players with a number of wins >= (number of rounds) /2.
When both players are concerned by secondary criteria, the function values are set as computed.
When both players are excluded from secondary criteria, the function values are set as to the maximum possible.
When one player is excluded from secondary criteria and the other player is not, an intermediate value will be computed (see sources for details)
Minimize handicap
The maximum value is 20 000 * 10^9 . The minimum is 0
Between the extrema, set to coef * 20 000 * 10^9 where coef is a number between 0.0 and 1.0, computed by a concavity function a If MMS difference is 0, set it to Secondary criteria are not applied for players above a certain ranking, as set by the organizer (by default, 4D) and, optionnaly (by default, secondary criteria applied), for players with a number of wins >= (number of rounds) /2.
Geographical criteria
A malus value is computed if both players belong to the same club or group of clubs. An other one if both players belong to the same country. The values of the malus depends on the "Prefer a score gap of ..." as defined by the user.
The geographical malus is computed as a combination of both malus.
The concavity function is used to compute the weight of several criteria.
Let us see why this function is necessary and how it is used.
An example : have a tournament where you have 1 player 1K, 2 players 2K, 2 players 3K, ... 2 players 10K and 1 player 11K.
The parity issue will result in a choice between :
- Pair everybody with his same rank fellow. And fix the parity issue by pairing the 1K with the 11K.
- Pair the 1K with a 2K, the other 2K with a 3K, etc.
Any human organizer would choose the second option, but the computer might not, if you don't take care.
Assume that in your evaluation function, the base value for a pair is 1000 and you give a penalty of 100 * d for a dan/kyu rank difference.
The sum of values will be, in both cases 9000.
Now, with the concavity function.
Instead of 1000 - 100*d, you use 1000 * (1.0 - x) * (1.0 + k * x)) (OpenGotha uses 0.5 for k. x = d/maxRange, d/10 here)
Then, the sum of values will be 9 * 1000 + 0 = 9000 in solution 1 and 10 * 945 = 9450 in solution 2
OpenGotha prefers solution 2.
OpenGotha is hosted by GitHub. Sources are available from lucvannier/opengotha github repository
In Tournament.java, see the costValue method.