Add test for unsorted pairings (not matching default table number with OpenGotha)

This commit is contained in:
Quentin Rendu
2023-10-21 11:42:33 +02:00
parent 31f37a63ff
commit c4f9281faf
2 changed files with 48 additions and 23 deletions

View File

@@ -125,10 +125,6 @@ sealed class Solver(
abstract val mainLimits: Pair<Double, Double>
// SOS and variants will be computed based on this score
fun pair(): List<Game> {
if (round>1){
println("Solver.kt Games played before round "+round.toString()+" :")
println(history[0])
}
weightLogs.clear()
// check that at this stage, we have an even number of pairables
if (pairables.size % 2 != 0) throw Error("expecting an even number of pairables")
@@ -173,7 +169,7 @@ sealed class Solver(
val graph = builder.build()
val matching = KolmogorovWeightedPerfectMatching(graph, ObjectiveSense.MAXIMIZE)
val solution = matching.matching
val sorted = solution.map{
listOf(graph.getEdgeSource(it), graph.getEdgeTarget(it))
}.sortedWith(compareBy({ min(it[0].place, it[1].place) }))