Keep malavasi test, validate weights.
This commit is contained in:
@@ -425,7 +425,9 @@ sealed class BaseSolver(
|
||||
|
||||
// Same club and club group (TODO club group)
|
||||
var clubRatio = 0.0
|
||||
val commonClub = p1.club == p2.club
|
||||
// To match OpenGotha, only do a case insensitive comparison of the first four characters.
|
||||
// But obviously, there is a margin of improvement here towards some way of normalizing clubs.
|
||||
val commonClub = p1.club?.take(4)?.uppercase() == p2.club?.take(4)?.uppercase()
|
||||
val commonGroup = false // TODO
|
||||
|
||||
if (commonGroup && !commonClub) {
|
||||
|
38
api-webapp/src/test/kotlin/MalavasiTest.kt
Normal file
38
api-webapp/src/test/kotlin/MalavasiTest.kt
Normal file
@@ -0,0 +1,38 @@
|
||||
package org.jeudego.pairgoth.test
|
||||
|
||||
import com.republicate.kson.Json
|
||||
import org.jeudego.pairgoth.pairing.solver.BaseSolver
|
||||
import org.jeudego.pairgoth.test.PairingTests.Companion.compare_weights
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.io.FileWriter
|
||||
import java.io.PrintWriter
|
||||
import java.nio.charset.StandardCharsets
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class MalavasiTest: TestBase() {
|
||||
|
||||
@Test
|
||||
fun testMalavasi() {
|
||||
val tournament = Json.Companion.parse(
|
||||
getTestFile("opengotha/malavasi/malavasi.geobug.tour").readText(StandardCharsets.UTF_8)
|
||||
)!!.asObject()
|
||||
val resp = TestAPI.post("/api/tour", tournament).asObject()
|
||||
val tourId = resp.getInt("id")
|
||||
BaseSolver.weightsLogger = PrintWriter(FileWriter(getOutputFile("malavasi-weights.txt")))
|
||||
val games = TestAPI.post("/api/tour/$tourId/pair/2", Json.Array("all")).asArray()
|
||||
// Oceane is ID 548, Valentine 549
|
||||
val buggy = games.map { it as Json.Object }.filter { game ->
|
||||
// build the two-elements set of players ids
|
||||
val players = game.entries.filter { (k, v) -> k == "b" || k == "w" }.map { (k, v) -> (v as Number).toInt() }.toSet()
|
||||
// keep games with Oceane or Valentine
|
||||
players.contains(548) || players.contains(549)
|
||||
}
|
||||
|
||||
// if the bug is still here, buggy contains a single element
|
||||
assertEquals(2, buggy.size)
|
||||
|
||||
// compare weights
|
||||
assertTrue(compare_weights(getOutputFile("malavasi-weights.txt"), getTestFile("opengotha/malavasi/malavasi_weights_R2.txt")), "Not matching opengotha weights for Malavasi test")
|
||||
}
|
||||
}
|
@@ -27,6 +27,7 @@ class PairingTests: TestBase() {
|
||||
MemoryStore.reset()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun compare_weights(file1: File, file2: File, skipSeeding: Boolean = false):Boolean {
|
||||
BaseSolver.weightsLogger!!.flush()
|
||||
// Maps to store name pairs and costs
|
||||
@@ -100,6 +101,7 @@ class PairingTests: TestBase() {
|
||||
}
|
||||
return identical
|
||||
}
|
||||
}
|
||||
|
||||
fun compare_games(games:Json.Array, opengotha:Json.Array, skipColor: Boolean = false): Boolean{
|
||||
if (games.size != opengotha.size) {
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<Tournament fullVersionNumber="3.52.03" runningMode="SAL" saveDT="20240804105607">
|
||||
<Tournament fullVersionNumber="3.52.03" runningMode="SAL" saveDT="20240830124804" dataVersion="201">
|
||||
<Players>
|
||||
<Player agaExpirationDate="" agaId="" club="TFMi" country="CZ" egfPin="17986925" ffgLicence="" ffgLicenceStatus="" firstName="Jan" grade="4k" name="Adamek" participating="11111111111111111111" rank="4k" rating="1705" ratingOrigin="" registeringStatus="FIN" smmsCorrection="0"/>
|
||||
<Player agaExpirationDate="" agaId="" club="Cluj " country="RO" egfPin="15813413" ffgLicence="" ffgLicenceStatus="" firstName="Lidia" grade="5k" name="Agafitei" participating="00000111001111111111" rank="5k" rating="1589" ratingOrigin="" registeringStatus="PRE" smmsCorrection="0"/>
|
||||
@@ -988,7 +988,6 @@
|
||||
<Player agaExpirationDate="" agaId="" club="31To" country="FR" egfPin="" ffgLicence="" ffgLicenceStatus="" firstName="David" grade="5k" name="BROUARD" participating="10000000001111111111" rank="5k" rating="1595" ratingOrigin="" registeringStatus="FIN" smmsCorrection="0"/>
|
||||
</Players>
|
||||
<Games>
|
||||
// TODO - table number is not any more kinda random like this
|
||||
<Game blackPlayer="JABARINALI" handicap="0" knownColor="true" result="RESULT_BLACKWINS" roundNumber="1" tableNumber="1" whitePlayer="OVSIIENKOVSEVOLOD"/>
|
||||
<Game blackPlayer="KRÄMERLUKAS" handicap="0" knownColor="true" result="RESULT_BLACKWINS" roundNumber="1" tableNumber="2" whitePlayer="CAMPAGNIEREMI"/>
|
||||
<Game blackPlayer="SURMAMATEUSZ" handicap="0" knownColor="true" result="RESULT_BLACKWINS" roundNumber="1" tableNumber="3" whitePlayer="SPIEGELLOTHAR"/>
|
||||
@@ -1362,15 +1361,16 @@
|
||||
</Games>
|
||||
<ByePlayer>
|
||||
<ByePlayer player="CeronElisa" roundNumber="1"/>
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
null
|
||||
<ByePlayer player="Albert_LedunSoline" roundNumber="1"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ByePlayer>
|
||||
<TournamentParameterSet>
|
||||
<GeneralParameterSet bInternet="false" basicTime="1" beginDate="2024-07-28" canByoYomiTime="0" complementaryTimeSystem="FISCHER" director="" endDate="2024-08-10" fischerTime="60" genCountNotPlayedGamesAsHalfPoint="false" genMMBar="4D" genMMFloor="20K" genMMS2ValueAbsent="1" genMMS2ValueBye="2" genMMZero="30K" genNBW2ValueAbsent="0" genNBW2ValueBye="2" genRoundDownNBWMMS="true" komi="6.5" location="Toulouse" name="EGC 2024 Main Open" nbMovesCanTime="0" numberOfCategories="1" numberOfRounds="10" shortName="20240727-main_open" size="19" stdByoYomiTime="0"/>
|
||||
@@ -1380,7 +1380,7 @@ null
|
||||
[<PlacementCriterion name="MMS" number="1"/>, <PlacementCriterion name="SOSM" number="2"/>, <PlacementCriterion name="SOSOSM" number="3"/>, <PlacementCriterion name="NULL" number="4"/>, <PlacementCriterion name="NULL" number="5"/>, <PlacementCriterion name="NULL" number="6"/>]
|
||||
</PlacementCriteria>
|
||||
</PlacementParameterSet>
|
||||
<PairingParameterSet paiBaAvoidDuplGame="500000000000000" paiBaBalanceWB="1000000" paiBaDeterministic="true" paiBaRandom="0" paiMaAdditionalPlacementCritSystem1="Rating" paiMaAdditionalPlacementCritSystem2="None" paiMaAvoidMixingCategories="0" paiMaCompensateDUDD="true" paiMaDUDDLowerMode="MID" paiMaDUDDUpperMode="MID" paiMaDUDDWeight="100000000" paiMaLastRoundForSeedSystem1="2" paiMaMaximizeSeeding="5000000" paiMaMinimizeScoreDifference="100000000000" paiMaSeedSystem1="SPLITANDRANDOM" paiMaSeedSystem2="SPLITANDSLIP" paiSeAvoidSameGeo="1215752192" paiSeBarThresholdActive="true" paiSeDefSecCrit="100000000000" paiSeMinimizeHandicap="0" paiSeNbWinsThresholdActive="false" paiSePreferMMSDiffRatherThanSameClub="3" paiSePreferMMSDiffRatherThanSameCountry="1" paiSeRankThreshold="1D" paiStandardNX1Factor="0.5"/>
|
||||
<PairingParameterSet paiBaAvoidDuplGame="500000000000000" paiBaBalanceWB="1000000" paiBaDeterministic="true" paiBaRandom="0" paiMaAdditionalPlacementCritSystem1="Rating" paiMaAdditionalPlacementCritSystem2="None" paiMaAvoidMixingCategories="0" paiMaCompensateDUDD="true" paiMaDUDDLowerMode="MID" paiMaDUDDUpperMode="MID" paiMaDUDDWeight="100000000" paiMaLastRoundForSeedSystem1="2" paiMaMaximizeSeeding="5000000" paiMaMinimizeScoreDifference="100000000000" paiMaSeedSystem1="SPLITANDRANDOM" paiMaSeedSystem2="SPLITANDSLIP" paiSeAvoidSameGeo="100000000000" paiSeBarThresholdActive="true" paiSeDefSecCrit="100000000000" paiSeMinimizeHandicap="0" paiSeNbWinsThresholdActive="false" paiSePreferMMSDiffRatherThanSameClub="3" paiSePreferMMSDiffRatherThanSameCountry="1" paiSeRankThreshold="1D" paiStandardNX1Factor="0.5"/>
|
||||
<DPParameterSet displayClCol="true" displayCoCol="true" displayIndGamesInMatches="true" displayNPPlayers="false" displayNumCol="true" displayPlCol="true" gameFormat="short" playerSortType="name" showByePlayer="true" showNotFinallyRegisteredPlayers="true" showNotPairedPlayers="true" showNotParticipatingPlayers="false" showPlayerClub="true" showPlayerCountry="false" showPlayerGrade="true"/>
|
||||
<PublishParameterSet exportToLocalFile="true" htmlAutoScroll="false" print="false"/>
|
||||
</TournamentParameterSet>
|
1413338
api-webapp/src/test/resources/opengotha/malavasi/malavasi_weights_R2.txt
Normal file
1413338
api-webapp/src/test/resources/opengotha/malavasi/malavasi_weights_R2.txt
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user