Update secondary weight to match Opengotha v3.52

This commit is contained in:
Quentin Rendu
2024-05-24 22:32:36 +02:00
parent 0796c75fbc
commit bb259494e3
2 changed files with 26 additions and 25 deletions

View File

@@ -410,23 +410,20 @@ sealed class BaseSolver(
open fun SecondaryCritParams.apply(p1: Pairable, p2: Pairable): Double {
// Do we apply Secondary Criteria
// secCase = 0 : No player is above thresholds -> apply secondary criteria
// secCase = 1 : At least one player is above thresholds -> do not apply
// playersMeetCriteria = 0 : No player is above thresholds -> apply secondary criteria
// playersMeetCriteria = 1 : 1 player is above thresholds -> apply half the weight
// playersMeetCriteria = 2 : Both players is above thresholds -> apply the full weight
var score = 0.0
var secCase = 0
var playersMeetCriteria = 0
val nbw2Threshold: Int
if (nbWinsThresholdActive) nbw2Threshold = totalRounds
else nbw2Threshold = 2 * totalRounds
val nbw2Threshold =
if (nbWinsThresholdActive) totalRounds
else 2 * totalRounds
if( (2*p1.nbW >= nbw2Threshold) ||
(2*p2.nbW >= nbw2Threshold) ) secCase = 1
if (2*p1.nbW >= nbw2Threshold) playersMeetCriteria++
if (2*p2.nbW >= nbw2Threshold) playersMeetCriteria++
if (secCase == 0) score = pairing.geo.apply(p1, p2)
return score
return 0.5*playersMeetCriteria*pairing.geo.apply(p1, p2)
}
fun GeographicalParams.apply(p1: Pairable, p2: Pairable): Double {

View File

@@ -35,24 +35,28 @@ class MacMahonSolver(round: Int,
override fun SecondaryCritParams.apply(p1: Pairable, p2: Pairable): Double {
// Do we apply Secondary Criteria?
// - no player is above thresholds -> apply secondary criteria
// - at least one player is above thresholds -> do not apply
// playersMeetCriteria = 0 : No player is above thresholds -> apply the full weight
// playersMeetCriteria = 1 : 1 player is above thresholds -> apply half the weight
// playersMeetCriteria = 2 : Both players are above thresholds -> do not apply weight
var playersMeetCriteria = 0
val nbw2Threshold =
if (nbWinsThresholdActive) totalRounds
else 2 * totalRounds
val skipSecondary =
(2 * p1.nbW >= nbw2Threshold) ||
(2 * p2.nbW >= nbw2Threshold) ||
barThresholdActive && (
(p1.rank + p1.nbW >= mmBar) ||
(p2.rank + p2.nbW >= mmBar)
)
// Test whether each pairable meets one of the criteria
// subtract Pairable.MIN_RANK to thresholds to convert ranks to MMS score
if (2 * p1.nbW >= nbw2Threshold
|| barThresholdActive && (p1.mms >= mmBar - Pairable.MIN_RANK)
|| p1.mms >= rankSecThreshold - Pairable.MIN_RANK) playersMeetCriteria++
return if (skipSecondary) 0.0
else pairing.geo.apply(p1, p2)
if (2 * p2.nbW >= nbw2Threshold
|| barThresholdActive && (p2.mms >= mmBar - Pairable.MIN_RANK)
|| p2.mms >= rankSecThreshold - Pairable.MIN_RANK) playersMeetCriteria++
return if (playersMeetCriteria==2) 0.0
else 0.5*(2-playersMeetCriteria)*pairing.geo.apply(p1, p2)
}
override fun HandicapParams.pseudoRank(pairable: Pairable): Int {