Skip to content

Commit a1b1987

Browse files
authored
Merge pull request #134 from ImogenBits/improve_iterated
Improve iterated battles
2 parents 2e7e692 + c69da71 commit a1b1987

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

algobattle/battle.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class Config(Battle.Config):
392392

393393
type: Literal["Iterated"] = "Iterated"
394394

395-
rounds: int = 5
395+
rounds: int = 3
396396
"""Number of times the instance size will be increased until the solver fails to produce correct solutions."""
397397
maximum_size: int = 50_000
398398
"""Maximum instance size that will be tried."""
@@ -429,9 +429,10 @@ async def run_battle(self, fight: FightHandler, config: Config, min_size: int, u
429429
def sizes(size: int, max_size: int) -> Iterable[int]:
430430
counter = count(1)
431431
size = max(size, min_size)
432-
while size <= max_size:
432+
while size < max_size:
433433
yield size
434434
size += next(counter) ** config.exponent
435+
yield max_size
435436

436437
note = "Starting battle..."
437438
for _ in range(config.rounds):

tests/test_battles.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ async def test_full_battle(self) -> None:
155155
await self._expect_fights(always(fail), [1])
156156
await self._expect_fights(
157157
always(succ),
158-
[1, 2, 6, 15, 31, 56, 92, 141, 205, 286, 386, 507, 651, 820]
159-
+ [821, 822, 826, 835, 851, 876, 912, 961]
160-
+ [962, 963, 967, 976, 992]
161-
+ [993, 994, 998]
162-
+ [999, 1000],
158+
[1, 2, 6, 15, 31, 56, 92, 141, 205, 286, 386, 507, 651, 820, 1000],
163159
score=1000,
164160
total=True,
165161
)

0 commit comments

Comments
 (0)