Skip to content

Commit cfd85e2

Browse files
committed
fix(simplex): raise error instead of silent failure on max iterations
1 parent 6c04620 commit cfd85e2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

linear_programming/simplex.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ def run_simplex(self) -> dict[Any, Any]:
302302
self.tableau = self.change_stage()
303303
else:
304304
self.tableau = self.pivot(row_idx, col_idx)
305-
return {}
305+
raise ValueError(
306+
f"Simplex did not converge within {Tableau.maxiter} iterations. "
307+
"The problem may be cycling or unbounded.")
306308

307309
def interpret_tableau(self) -> dict[str, float]:
308310
"""Given the final tableau, add the corresponding values of the basic

0 commit comments

Comments
 (0)