Skip to content

Commit

Permalink
Merge pull request #138 from ImogenBits/solver_exceptions
Browse files Browse the repository at this point in the history
Fix program run exception handling
  • Loading branch information
Benezivas authored Oct 25, 2023
2 parents c2ee22c + fa40605 commit 8d21543
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions algobattle/battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ async def run(
set_cpus=self.set_cpus,
ui=ui,
)
if gen_result.instance is None:
if gen_result.info.error is not None:
return Fight(score=1, max_size=max_size, generator=gen_result.info, solver=None)
assert gen_result.instance is not None

sol_result = await self.solver.run(
gen_result.instance,
Expand All @@ -189,8 +190,9 @@ async def run(
set_cpus=self.set_cpus,
ui=ui,
)
if sol_result.solution is None:
if sol_result.info.error is not None:
return Fight(score=0, max_size=max_size, generator=gen_result.info, solver=sol_result.info)
assert sol_result.solution is not None

if self.problem.with_solution:
assert gen_result.solution is not None
Expand Down

0 comments on commit 8d21543

Please sign in to comment.