diff --git a/infrastructure/event_dispatcher/load_balancer.py b/infrastructure/event_dispatcher/load_balancer.py index 4fe5bc6c..3e4a7a21 100644 --- a/infrastructure/event_dispatcher/load_balancer.py +++ b/infrastructure/event_dispatcher/load_balancer.py @@ -57,6 +57,9 @@ def determine_priority_group(self, priority: int) -> int: control_outputs = self._pid.update(errors) - return np.random.choice( - np.arange(len(control_outputs)), p=softmax(control_outputs) - ) + penalty_factor = np.exp(-processed_ratios) + weighted_outputs = control_outputs * penalty_factor + + smooth_outputs = softmax(weighted_outputs) + + return np.random.choice(np.arange(len(smooth_outputs)), p=smooth_outputs)