File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44from __future__ import annotations
55
6+ import contextlib
67from abc import ABC , abstractmethod
78from copy import deepcopy
89from 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
You can’t perform that action at this time.
0 commit comments