From 1c35b43555663bef4307fc399744145263f09e0d Mon Sep 17 00:00:00 2001 From: Imogen Date: Fri, 29 Dec 2023 23:45:00 +0100 Subject: [PATCH] change Improving.Config weighting formatting --- algobattle/battle.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/algobattle/battle.py b/algobattle/battle.py index 3824a02c..af22a341 100644 --- a/algobattle/battle.py +++ b/algobattle/battle.py @@ -713,7 +713,7 @@ class Config(Battle.Config): """Instance size that will be fought at.""" num_fights: int = 20 """Number of fights that will be fought.""" - weighting: Annotated[int, Ge(1)] = 10 + weighting: Annotated[float, Ge(0)] = 1.1 """How much each successive fight should be weighted more than the previous.""" scores: set[Role] = {Role.generator, Role.solver} """Who to show each fight's scores to.""" @@ -755,9 +755,8 @@ def score(self, config: Config) -> float: if len(self.fights) == 0: return 0 else: - weight = 1 + config.weighting / 100 - total = sum(f.score * weight**i for (i, f) in enumerate(self.fights)) - quotient = (1 - weight ** len(self.fights)) / (1 - weight) + total = sum(f.score * config.weighting**i for (i, f) in enumerate(self.fights)) + quotient = (1 - config.weighting ** len(self.fights)) / (1 - config.weighting) return total / quotient @staticmethod