Skip to content

Commit b7048af

Browse files
committed
Fix affinity bonus normalization by totalCapacity in Score function
The affinity bonus is now divided by totalCapacity to match the normalization applied to the base score, ensuring consistent placement behavior across nodes with different CPU counts.
1 parent b9916c4 commit b7048af

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/api/internal/orchestrator/placement/placement_best_of_K.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (b *BestOfK) Score(node *nodemanager.Node, resources nodemanager.SandboxRes
6363

6464
score := (cpuRequested + float64(reserved) + config.Alpha*usageAvg) / totalCapacity
6565
if len(affinityScores) > 0 {
66-
score -= affinityScores[0][node.ID]
66+
score -= affinityScores[0][node.ID] / totalCapacity
6767
}
6868

6969
return score

0 commit comments

Comments
 (0)