diff --git a/linear_programming/simplex.py b/linear_programming/simplex.py index a8affe1b72d2..9677acf7e233 100644 --- a/linear_programming/simplex.py +++ b/linear_programming/simplex.py @@ -302,7 +302,11 @@ def run_simplex(self) -> dict[Any, Any]: self.tableau = self.change_stage() else: self.tableau = self.pivot(row_idx, col_idx) - return {} + raise ValueError( + "Simplex did not converge within " + f"{Tableau.maxiter} iterations. The problem may be cycling or " + "unbounded." + ) def interpret_tableau(self) -> dict[str, float]: """Given the final tableau, add the corresponding values of the basic