Symmetric detrandom

This commit is contained in:
Claude Brisson
2024-09-02 22:44:10 +02:00
parent 8d76ce471b
commit 3fb5f79529
2 changed files with 3 additions and 4 deletions

View File

@@ -13,7 +13,8 @@ fun detRandom(max: Double, p1: Pairable, p2: Pairable): Double {
var nR = "$name1$name2".mapIndexed { i, c ->
c.code.toDouble() * (i + 1)
}.sum() * 1234567 % (max + 1)
if (inverse) nR = max - nR
// we want the symmetry
// if (inverse) nR = max - nR
return nR
}

View File

@@ -367,9 +367,7 @@ sealed class BaseSolver(
SPLIT_AND_RANDOM -> {
if ((2 * cla1 < groupSize && 2 * cla2 >= groupSize) || (2 * cla1 >= groupSize && 2 * cla2 < groupSize)) {
val randRange = maxSeedingWeight * 0.2
val rand: Double
if (p1.fullName() > p2.fullName()) {rand = detRandom(randRange, p2, p1)}
else {rand = detRandom(randRange, p1, p2)}
val rand = detRandom(randRange, p2, p1)
maxSeedingWeight - rand
} else {
0.0