diff --git a/linear_programming/simplex.py b/linear_programming/simplex.py index a8affe1b72d2..e2557c1303dd 100644 --- a/linear_programming/simplex.py +++ b/linear_programming/simplex.py @@ -302,7 +302,13 @@ def run_simplex(self) -> dict[Any, Any]: self.tableau = self.change_stage() else: self.tableau = self.pivot(row_idx, col_idx) - return {} + + max_iterations = Tableau.maxiter + raise ValueError( + "Simplex did not converge within " + + str(max_iterations) + + " 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