From 719241f2224156ec39a25c03dc626ec21f922f4f Mon Sep 17 00:00:00 2001 From: Imogen Date: Sat, 7 Oct 2023 22:04:59 +0200 Subject: [PATCH 1/2] default to 3 rounds --- algobattle/battle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algobattle/battle.py b/algobattle/battle.py index ab106a63..0e560127 100644 --- a/algobattle/battle.py +++ b/algobattle/battle.py @@ -392,7 +392,7 @@ class Config(Battle.Config): type: Literal["Iterated"] = "Iterated" - rounds: int = 5 + rounds: int = 3 """Number of times the instance size will be increased until the solver fails to produce correct solutions.""" maximum_size: int = 50_000 """Maximum instance size that will be tried.""" From c69da71e903040ef45ce2bf0f5ba0bb3f32752b2 Mon Sep 17 00:00:00 2001 From: Imogen Date: Sat, 7 Oct 2023 22:55:39 +0200 Subject: [PATCH 2/2] skip to last instance size if max was stepped over --- algobattle/battle.py | 3 ++- tests/test_battles.py | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/algobattle/battle.py b/algobattle/battle.py index 0e560127..5cafb882 100644 --- a/algobattle/battle.py +++ b/algobattle/battle.py @@ -429,9 +429,10 @@ async def run_battle(self, fight: FightHandler, config: Config, min_size: int, u def sizes(size: int, max_size: int) -> Iterable[int]: counter = count(1) size = max(size, min_size) - while size <= max_size: + while size < max_size: yield size size += next(counter) ** config.exponent + yield max_size note = "Starting battle..." for _ in range(config.rounds): diff --git a/tests/test_battles.py b/tests/test_battles.py index fb74b6cc..c0459548 100644 --- a/tests/test_battles.py +++ b/tests/test_battles.py @@ -155,11 +155,7 @@ async def test_full_battle(self) -> None: await self._expect_fights(always(fail), [1]) await self._expect_fights( always(succ), - [1, 2, 6, 15, 31, 56, 92, 141, 205, 286, 386, 507, 651, 820] - + [821, 822, 826, 835, 851, 876, 912, 961] - + [962, 963, 967, 976, 992] - + [993, 994, 998] - + [999, 1000], + [1, 2, 6, 15, 31, 56, 92, 141, 205, 286, 386, 507, 651, 820, 1000], score=1000, total=True, )