Skip to content

Commit 87956a5

Browse files
committed
fixed linting issues
1 parent a95d3d7 commit 87956a5

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

simopt/base.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from __future__ import annotations
55

6+
import contextlib
67
from abc import ABC, abstractmethod
78
from copy import deepcopy
89
from enum import Enum
@@ -327,11 +328,18 @@ def solve(self, problem: Problem) -> None:
327328
raise NotImplementedError
328329

329330
def run(self, problem: Problem) -> tuple[list[Solution], list[int]]:
331+
"""Run the solver on a problem.
332+
333+
Args:
334+
problem (Problem): The problem to solve.
335+
336+
Returns:
337+
tuple[list[Solution], list[int]]: A tuple containing a list of solutions
338+
and a list of intermediate budgets.
339+
"""
330340
self.budget = Budget(problem.factors["budget"])
331-
try:
341+
with contextlib.suppress(BudgetExhaustedError):
332342
self.solve(problem)
333-
except BudgetExhaustedError:
334-
pass
335343

336344
recommended_solns = self.recommended_solns
337345
intermediate_budgets = self.intermediate_budgets

0 commit comments

Comments
 (0)