Remove debug writings and add weight test files

This commit is contained in:
Quentin Rendu
2023-12-29 12:37:12 +01:00
parent ac983918b0
commit 7ff668847c
7 changed files with 33681 additions and 10 deletions

View File

@@ -117,15 +117,15 @@ sealed class BaseSolver(
// add game for ByePlayer // add game for ByePlayer
if (chosenByePlayer != ByePlayer) result += Game(id = Store.nextGameId, table = 0, white = ByePlayer.id, black = chosenByePlayer.id, result = Game.Result.fromSymbol('b')) if (chosenByePlayer != ByePlayer) result += Game(id = Store.nextGameId, table = 0, white = ByePlayer.id, black = chosenByePlayer.id, result = Game.Result.fromSymbol('b'))
val DEBUG_EXPORT_WEIGHT = true val DEBUG_EXPORT_WEIGHT = false
if (DEBUG_EXPORT_WEIGHT) { if (DEBUG_EXPORT_WEIGHT) {
println("DUDD debug") /*println("DUDD debug")
println(nameSortedPairables[4].nameSeed() + " " + nameSortedPairables[25].nameSeed()) println(nameSortedPairables[4].nameSeed() + " " + nameSortedPairables[25].nameSeed())
pairing.main.applyDUDD(nameSortedPairables[25],nameSortedPairables[4], debug=true) pairing.main.applyDUDD(nameSortedPairables[25],nameSortedPairables[4], debug=true)
println("Standings debug: place Name group score sos sosos ranking rating") println("Standings debug: place Name group score sos sosos ranking rating")
for (p in pairingSortedPairables){ for (p in pairingSortedPairables){
println(p.place.toString() + " " + p.nameSeed() + " " + p.group.toString() + " " + p.main.toString() + " " + p.sos.toString() + " " + p.sosos.toString() + " " + p.displayRank() + " " + p.rating) println(p.place.toString() + " " + p.nameSeed() + " " + p.group.toString() + " " + p.main.toString() + " " + p.sos.toString() + " " + p.sosos.toString() + " " + p.displayRank() + " " + p.rating)
} }*/
//println("Seeding debug") //println("Seeding debug")
//pairing.main.applySeeding(nameSortedPairables[20],nameSortedPairables[9], debug=true) //pairing.main.applySeeding(nameSortedPairables[20],nameSortedPairables[9], debug=true)
//pairing.main.applySeeding(nameSortedPairables[9],nameSortedPairables[20], debug=true) //pairing.main.applySeeding(nameSortedPairables[9],nameSortedPairables[20], debug=true)
@@ -251,7 +251,7 @@ sealed class BaseSolver(
return score return score
} }
open fun MainCritParams.applyDUDD(p1: Pairable, p2: Pairable, debug: Boolean =false): Double { open fun MainCritParams.applyDUDD(p1: Pairable, p2: Pairable): Double {
var score = 0.0 var score = 0.0
// TODO apply Drawn-Up/Drawn-Down if needed // TODO apply Drawn-Up/Drawn-Down if needed
@@ -332,7 +332,7 @@ sealed class BaseSolver(
score += 4 * duddWeight score += 4 * duddWeight
} }
if(debug){ /*if(debug){
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())
@@ -340,7 +340,7 @@ sealed class BaseSolver(
println("u/lSPgroupsize = "+uSPgroupSize.toString()+" "+lSPgroupSize.toString()) println("u/lSPgroupsize = "+uSPgroupSize.toString()+" "+lSPgroupSize.toString())
println("u/lSPplaceingroup = "+upperSP.placeInGroup.first.toString()+" "+lowerSP.placeInGroup.first.toString()) println("u/lSPplaceingroup = "+upperSP.placeInGroup.first.toString()+" "+lowerSP.placeInGroup.first.toString())
println("score = " + score.toString()) println("score = " + score.toString())
} }*/
} }
@@ -354,7 +354,7 @@ sealed class BaseSolver(
return score return score
} }
fun MainCritParams.applySeeding(p1: Pairable, p2: Pairable, debug: Boolean =false): Double { fun MainCritParams.applySeeding(p1: Pairable, p2: Pairable): Double {
var score = 0.0 var score = 0.0
// Apply seeding for players in the same group // Apply seeding for players in the same group
if (p1.group == p2.group) { if (p1.group == p2.group) {
@@ -390,14 +390,14 @@ sealed class BaseSolver(
} }
} }
if(debug){ /*if(debug){
println("Names "+p1.nameSeed()+" "+p1.group+" "+p2.nameSeed()+" "+p2.group) println("Names "+p1.nameSeed()+" "+p1.group+" "+p2.nameSeed()+" "+p2.group)
println("Seed Sytem = " + currentSeedSystem.toString()) println("Seed Sytem = " + currentSeedSystem.toString())
println("groupsize = "+p1.placeInGroup.second.toString()+" "+p2.placeInGroup.second.toString()+" "+groupSize) println("groupsize = "+p1.placeInGroup.second.toString()+" "+p2.placeInGroup.second.toString()+" "+groupSize)
println("place in group p1 = "+cla1.toString()+" p2 = "+cla2.toString()) println("place in group p1 = "+cla1.toString()+" p2 = "+cla2.toString())
println("score = " + Math.round(score).toString()) println("score = " + Math.round(score).toString())
println("detrandom(p1,p2) = " + (maxSeedingWeight-detRandom(seedingWeight*0.2, p1, p2)).toString()) println("detrandom(p1,p2) = " + (maxSeedingWeight-detRandom(seedingWeight*0.2, p1, p2)).toString())
} }*/
} }
return Math.round(score).toDouble() return Math.round(score).toDouble()
} }

View File

@@ -267,7 +267,7 @@ class PairingTests: TestBase() {
val byePlayerList = mutableListOf<Long>(354, 359, 356, 357, 345, 339, 368, 344, 349, 341) val byePlayerList = mutableListOf<Long>(354, 359, 356, 357, 345, 339, 368, 344, 349, 341)
for (round in 1..7) { for (round in 1..10) {
//games = TestAPI.post("/api/tour/$id/pair/$round", Json.Array(playersList.filter{it != byePlayerList[round-1]})).asArray() //games = TestAPI.post("/api/tour/$id/pair/$round", Json.Array(playersList.filter{it != byePlayerList[round-1]})).asArray()
BaseSolver.weightsLogger = PrintWriter(FileWriter(getOutputFile("weights.txt"))) BaseSolver.weightsLogger = PrintWriter(FileWriter(getOutputFile("weights.txt")))
if (round in forcedPairingList){ if (round in forcedPairingList){
@@ -301,6 +301,7 @@ class PairingTests: TestBase() {
} }
} }
@Test @Test
fun `testSimpleMM`() { fun `testSimpleMM`() {
/* /*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff