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) {
|
||||
// Instantiate solver with game history
|
||||
// TODO cleaner solver instantiation
|
||||
val history = games.map { games -> games.values.toList() }
|
||||
val history = historyBefore(round)
|
||||
val solver = if (pairing is Swiss) {
|
||||
SwissSolver(round, history, pairables.values.toList(), pairing.pairingParams, pairing.placementParams)
|
||||
} 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")
|
||||
|
||||
// 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 {
|
||||
// apply a *big* score to let the stronger player have white
|
||||
if (hd2 == 0) colorBalanceWeight * 10
|
||||
else 0.0
|
||||
//if (hd2 == 0) colorBalanceWeight * 10
|
||||
//else 0.0
|
||||
0.0
|
||||
}
|
||||
return score
|
||||
}
|
||||
@@ -304,8 +305,6 @@ sealed class BaseSolver(
|
||||
val lSPgroupSize = lowerSP.placeInGroup.second
|
||||
|
||||
|
||||
|
||||
|
||||
if (pairing.main.drawUpDownUpperMode === MainCritParams.DrawUpDown.TOP) {
|
||||
score += duddWeight / 2 * (uSPgroupSize - 1 - upperSP.placeInGroup.first) / uSPgroupSize
|
||||
} else if (pairing.main.drawUpDownUpperMode === MainCritParams.DrawUpDown.MIDDLE) {
|
||||
@@ -332,7 +331,7 @@ sealed class BaseSolver(
|
||||
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 "+upperSP.nameSeed()+" "+upperSP.group+" "+lowerSP.nameSeed()+" "+lowerSP.group)
|
||||
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 {
|
||||
val placementScoreRange = groupsCount
|
||||
|
||||
val geoMaxCost = pairing.geo.avoidSameGeo
|
||||
//val geoMaxCost = 100000000000.0
|
||||
//val geoMaxCost = pairing.geo.avoidSameGeo
|
||||
val geoMaxCost = 100000000000.0
|
||||
|
||||
val countryFactor = preferMMSDiffRatherThanSameCountry
|
||||
val clubFactor: Int = preferMMSDiffRatherThanSameClub
|
||||
|
@@ -12,12 +12,14 @@ class MacMahonSolver(round: Int,
|
||||
private val mmFloor: Int, private val mmBar: Int):
|
||||
BaseSolver(round, history, pairables, pairingParams, placementParams) {
|
||||
|
||||
|
||||
override val scores: Map<ID, Double> by lazy {
|
||||
require (mmBar > mmFloor) { "MMFloor is higher than MMBar" }
|
||||
pairablesMap.mapValues {
|
||||
it.value.let {
|
||||
pairable -> pairable.mmBase +
|
||||
pairable.nbW + // TODO take tournament parameter into account
|
||||
pairable.missedRounds(round) * pairingParams.main.mmsValueAbsent
|
||||
it.value.let { pairable ->
|
||||
pairable.mmBase +
|
||||
pairable.nbW + // TODO take tournament parameter into account
|
||||
pairable.missedRounds(round) * pairingParams.main.mmsValueAbsent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user