diff --git a/cooperative_cuisine/scores.py b/cooperative_cuisine/scores.py index 05891b2f4e950f1ceb1895a7ab03712d677feae6..eb8529381456cbd4b5d438964d6425d713ef2c35 100644 --- a/cooperative_cuisine/scores.py +++ b/cooperative_cuisine/scores.py @@ -91,6 +91,12 @@ from cooperative_cuisine.hooks import HookCallbackClass def constant_score(max_score: float, time_percentage: float = 1.0): + """Returns the constant score. No time dependence. + + Args: + max_score: The maximum score to be returned. + time_percentage: The time percentage. Default is 1.0. + """ return max_score @@ -100,6 +106,17 @@ def linear_score( time_percentage: float = 1.0, round_decimals: int = 0, ): + """ + Returns the linear score based on the time percentage. + + Args: + max_score: Maximum possible score. + min_score_ratio: Minimum score ratio. Default is 0.0. + time_percentage: Time percentage of the order. Default is 1.0. + round_decimals: Number of decimals to round the score to. Default is 0. + + Returns: Modified score based on the time percentage. + """ modified_score = float( np.round( max(max_score * time_percentage, max_score * min_score_ratio), @@ -116,6 +133,19 @@ def stepped_score( round_decimals: int = 0, time_percentage: float = 1.0, ): + """ + Modifies the score based on a step function based on the time percentage. + + Args: + max_score: Maximum possible score. + steps: Steps for the score ratios. + score_ratios: Ratios for the score based on the steps. + round_decimals: Number of decimals to round the score to. Default is 0. + time_percentage: Time percentage of the order. Default is 1.0. + + Returns: Modified score based on the time percentage. + + """ if len(steps) != len(score_ratios): raise ValueError("steps and vals must have the same length")