Symmetric detrandom
This commit is contained in:
@@ -13,7 +13,8 @@ fun detRandom(max: Double, p1: Pairable, p2: Pairable): Double {
|
|||||||
var nR = "$name1$name2".mapIndexed { i, c ->
|
var nR = "$name1$name2".mapIndexed { i, c ->
|
||||||
c.code.toDouble() * (i + 1)
|
c.code.toDouble() * (i + 1)
|
||||||
}.sum() * 1234567 % (max + 1)
|
}.sum() * 1234567 % (max + 1)
|
||||||
if (inverse) nR = max - nR
|
// we want the symmetry
|
||||||
|
// if (inverse) nR = max - nR
|
||||||
return nR
|
return nR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -367,9 +367,7 @@ sealed class BaseSolver(
|
|||||||
SPLIT_AND_RANDOM -> {
|
SPLIT_AND_RANDOM -> {
|
||||||
if ((2 * cla1 < groupSize && 2 * cla2 >= groupSize) || (2 * cla1 >= groupSize && 2 * cla2 < groupSize)) {
|
if ((2 * cla1 < groupSize && 2 * cla2 >= groupSize) || (2 * cla1 >= groupSize && 2 * cla2 < groupSize)) {
|
||||||
val randRange = maxSeedingWeight * 0.2
|
val randRange = maxSeedingWeight * 0.2
|
||||||
val rand: Double
|
val rand = detRandom(randRange, p2, p1)
|
||||||
if (p1.fullName() > p2.fullName()) {rand = detRandom(randRange, p2, p1)}
|
|
||||||
else {rand = detRandom(randRange, p1, p2)}
|
|
||||||
maxSeedingWeight - rand
|
maxSeedingWeight - rand
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
|
Reference in New Issue
Block a user