Implement avoidSameFamily geographic criterion
When enabled, avoid pairing players from the same club who have the same family name (surname). Uses existing player.name field.
This commit is contained in:
@@ -87,6 +87,7 @@ data class GeographicalParams(
|
||||
val preferMMSDiffRatherThanSameClubsGroup: Int = 2, // Typically = 2
|
||||
val preferMMSDiffRatherThanSameClub: Int = 3, // Typically = 3
|
||||
val proportionMainClubThreshold: Double = 0.4, // If the biggest club has a proportion of players higher than this, the secondary criterium is not applied
|
||||
val avoidSameFamily: Boolean = false, // When enabled, avoid pairing players from the same club with the same family name
|
||||
) {
|
||||
companion object {
|
||||
val disabled = GeographicalParams(avoidSameGeo = 0.0)
|
||||
|
||||
@@ -504,7 +504,14 @@ sealed class Solver(
|
||||
// else: effectiveCommonClub = true → clubRatio stays 0 (no bonus for same club)
|
||||
clubRatio = min(clubRatio, 1.0)
|
||||
|
||||
// TODO Same family
|
||||
// Same family: when enabled and players are from the same club, check if they have the same surname
|
||||
// If so, remove the bonus to avoid pairing family members (even if local club logic gave them a bonus)
|
||||
if (avoidSameFamily && commonClub) {
|
||||
val sameFamily = p1.name.uppercase() == p2.name.uppercase()
|
||||
if (sameFamily) {
|
||||
clubRatio = 0.0 // No bonus for same family within same club
|
||||
}
|
||||
}
|
||||
|
||||
// compute geoRatio
|
||||
val mainPart = max(countryRatio, clubRatio)
|
||||
|
||||
@@ -247,7 +247,8 @@ onLoad(() => {
|
||||
},
|
||||
geo: {
|
||||
mmsDiffCountry: form.val('mmsDiffCountry'),
|
||||
mmsDiffClub: form.val('mmsDiffClub')
|
||||
mmsDiffClub: form.val('mmsDiffClub'),
|
||||
avoidSameFamily: form.val('avoidSameFamily')
|
||||
},
|
||||
handicap: {
|
||||
useMMS: form.val('useMMS'),
|
||||
|
||||
@@ -142,6 +142,12 @@
|
||||
rather than pairing players of the same club.
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>
|
||||
<input type="checkbox" name="avoidSameFamily" value="true" #if($tour.pairing.geo.avoidSameFamily) checked #end/>
|
||||
avoid pairing players from the same club with the same family name
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="title"><i class="dropdown icon"></i>Handicap parameters</div>
|
||||
<div class="content">
|
||||
|
||||
Reference in New Issue
Block a user