From 0c2a82f9a75f83d8b569be69438609ab48436345 Mon Sep 17 00:00:00 2001 From: m5l14i11 Date: Fri, 20 Sep 2024 14:56:07 +0300 Subject: [PATCH] upd --- infrastructure/event_dispatcher/load_balancer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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)