Use MMS to choose ByePlayer if Mac-Mahon tournament

This commit is contained in:
Quentin Rendu
2024-05-29 17:55:39 +02:00
committed by Claude Brisson
parent f2a03edfaa
commit 27e6f7f14d
2 changed files with 9 additions and 1 deletions

View File

@@ -52,6 +52,10 @@ sealed class BaseSolver(
// pairing.base.applyByeWeight(p1, p2) + // pairing.base.applyByeWeight(p1, p2) +
pairing.handicap.color(p1, p2) pairing.handicap.color(p1, p2)
open fun computeWeightForBye(p: Pairable): Double{
return p.rank + 2*(p.main+p.rank)
}
fun pair(): List<Game> { fun pair(): List<Game> {
// check that at this stage, we have an even number of pairables // check that at this stage, we have an even number of pairables
// The BYE player should have been added beforehand to make a number of pairables even. // The BYE player should have been added beforehand to make a number of pairables even.
@@ -75,7 +79,7 @@ sealed class BaseSolver(
var weightForBye : Double var weightForBye : Double
var byePlayerIndex = 0 var byePlayerIndex = 0
for (p in nameSortedPairables){ for (p in nameSortedPairables){
weightForBye = p.rank + 2*(p.main + p.rank) weightForBye = computeWeightForBye(p)
if (p.id in historyHelper.byePlayers) weightForBye += 1000 if (p.id in historyHelper.byePlayers) weightForBye += 1000
if (weightForBye <= minWeight){ if (weightForBye <= minWeight){
minWeight = weightForBye minWeight = weightForBye

View File

@@ -33,6 +33,10 @@ class MacMahonSolver(round: Int,
} }
} }
override fun computeWeightForBye(p: Pairable): Double{
return 2*scores[p.id]!!.second
}
override fun SecondaryCritParams.apply(p1: Pairable, p2: Pairable): Double { override fun SecondaryCritParams.apply(p1: Pairable, p2: Pairable): Double {
// playersMeetCriteria = 0 : No player is above thresholds -> apply the full weight // playersMeetCriteria = 0 : No player is above thresholds -> apply the full weight