fixed mmsolver instantiation in dudd computation
This commit is contained in:
@@ -74,11 +74,11 @@ sealed class Tournament <P: Pairable>(
|
|||||||
fun recomputeDUDD(round: Int, gameID: ID) {
|
fun recomputeDUDD(round: Int, gameID: ID) {
|
||||||
// Instantiate solver with game history
|
// Instantiate solver with game history
|
||||||
// TODO cleaner solver instantiation
|
// TODO cleaner solver instantiation
|
||||||
val history = games.map { games -> games.values.toList() }
|
val history = historyBefore(round)
|
||||||
val solver = if (pairing is Swiss) {
|
val solver = if (pairing is Swiss) {
|
||||||
SwissSolver(round, history, pairables.values.toList(), pairing.pairingParams, pairing.placementParams)
|
SwissSolver(round, history, pairables.values.toList(), pairing.pairingParams, pairing.placementParams)
|
||||||
} else if (pairing is MacMahon) {
|
} else if (pairing is MacMahon) {
|
||||||
MacMahonSolver(round, history, pairables.values.toList(), pairing.pairingParams, pairing.placementParams, pairing.mmBar, pairing.mmFloor)
|
MacMahonSolver(round, history, pairables.values.toList(), pairing.pairingParams, pairing.placementParams, pairing.mmFloor, pairing.mmBar)
|
||||||
} else throw Exception("Invalid tournament type")
|
} else throw Exception("Invalid tournament type")
|
||||||
|
|
||||||
// Recomputes DUDD
|
// Recomputes DUDD
|
||||||
|
@@ -194,8 +194,9 @@ sealed class BaseSolver(
|
|||||||
else if (wb1 == 0 && abs(wb2) >= 2 || wb2 == 0 && abs(wb1) >= 2) colorBalanceWeight / 2 else 0.0
|
else if (wb1 == 0 && abs(wb2) >= 2 || wb2 == 0 && abs(wb1) >= 2) colorBalanceWeight / 2 else 0.0
|
||||||
} else {
|
} else {
|
||||||
// apply a *big* score to let the stronger player have white
|
// apply a *big* score to let the stronger player have white
|
||||||
if (hd2 == 0) colorBalanceWeight * 10
|
//if (hd2 == 0) colorBalanceWeight * 10
|
||||||
else 0.0
|
//else 0.0
|
||||||
|
0.0
|
||||||
}
|
}
|
||||||
return score
|
return score
|
||||||
}
|
}
|
||||||
@@ -304,8 +305,6 @@ sealed class BaseSolver(
|
|||||||
val lSPgroupSize = lowerSP.placeInGroup.second
|
val lSPgroupSize = lowerSP.placeInGroup.second
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (pairing.main.drawUpDownUpperMode === MainCritParams.DrawUpDown.TOP) {
|
if (pairing.main.drawUpDownUpperMode === MainCritParams.DrawUpDown.TOP) {
|
||||||
score += duddWeight / 2 * (uSPgroupSize - 1 - upperSP.placeInGroup.first) / uSPgroupSize
|
score += duddWeight / 2 * (uSPgroupSize - 1 - upperSP.placeInGroup.first) / uSPgroupSize
|
||||||
} else if (pairing.main.drawUpDownUpperMode === MainCritParams.DrawUpDown.MIDDLE) {
|
} else if (pairing.main.drawUpDownUpperMode === MainCritParams.DrawUpDown.MIDDLE) {
|
||||||
@@ -332,7 +331,7 @@ sealed class BaseSolver(
|
|||||||
score += 4 * duddWeight
|
score += 4 * duddWeight
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if(debug){
|
/*if(true) {
|
||||||
println("Names DU DD "+p1.nameSeed()+" "+p1_DU+" "+p1_DD+" "+p2.nameSeed()+" "+p2_DU+" "+p2_DD)
|
println("Names DU DD "+p1.nameSeed()+" "+p1_DU+" "+p1_DD+" "+p2.nameSeed()+" "+p2_DU+" "+p2_DD)
|
||||||
println("Names "+upperSP.nameSeed()+" "+upperSP.group+" "+lowerSP.nameSeed()+" "+lowerSP.group)
|
println("Names "+upperSP.nameSeed()+" "+upperSP.group+" "+lowerSP.nameSeed()+" "+lowerSP.group)
|
||||||
println("DUDD scenario, GroupDiff = "+scenario.toString()+" "+(upperSP.group-lowerSP.group).toString())
|
println("DUDD scenario, GroupDiff = "+scenario.toString()+" "+(upperSP.group-lowerSP.group).toString())
|
||||||
@@ -421,8 +420,8 @@ sealed class BaseSolver(
|
|||||||
fun GeographicalParams.apply(p1: Pairable, p2: Pairable): Double {
|
fun GeographicalParams.apply(p1: Pairable, p2: Pairable): Double {
|
||||||
val placementScoreRange = groupsCount
|
val placementScoreRange = groupsCount
|
||||||
|
|
||||||
val geoMaxCost = pairing.geo.avoidSameGeo
|
//val geoMaxCost = pairing.geo.avoidSameGeo
|
||||||
//val geoMaxCost = 100000000000.0
|
val geoMaxCost = 100000000000.0
|
||||||
|
|
||||||
val countryFactor = preferMMSDiffRatherThanSameCountry
|
val countryFactor = preferMMSDiffRatherThanSameCountry
|
||||||
val clubFactor: Int = preferMMSDiffRatherThanSameClub
|
val clubFactor: Int = preferMMSDiffRatherThanSameClub
|
||||||
|
@@ -12,10 +12,12 @@ class MacMahonSolver(round: Int,
|
|||||||
private val mmFloor: Int, private val mmBar: Int):
|
private val mmFloor: Int, private val mmBar: Int):
|
||||||
BaseSolver(round, history, pairables, pairingParams, placementParams) {
|
BaseSolver(round, history, pairables, pairingParams, placementParams) {
|
||||||
|
|
||||||
|
|
||||||
override val scores: Map<ID, Double> by lazy {
|
override val scores: Map<ID, Double> by lazy {
|
||||||
|
require (mmBar > mmFloor) { "MMFloor is higher than MMBar" }
|
||||||
pairablesMap.mapValues {
|
pairablesMap.mapValues {
|
||||||
it.value.let {
|
it.value.let { pairable ->
|
||||||
pairable -> pairable.mmBase +
|
pairable.mmBase +
|
||||||
pairable.nbW + // TODO take tournament parameter into account
|
pairable.nbW + // TODO take tournament parameter into account
|
||||||
pairable.missedRounds(round) * pairingParams.main.mmsValueAbsent
|
pairable.missedRounds(round) * pairingParams.main.mmsValueAbsent
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user