Skip to content

Commit ffce18c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3e39555 commit ffce18c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

linear_programming/simplex.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ class Tableau:
3535
...
3636
ValueError: number of (artificial) variables must be a natural number
3737
"""
38+
3839
# Max iteration number to prevent cycling
3940
maxiter = 100
40-
def __init__(self, tableau: np.ndarray, n_vars: int, n_artificial_vars: int) -> None:
41-
if tableau.dtype != 'float64':
42-
raise TypeError('Tableau must have type float64')
41+
42+
def __init__(
43+
self, tableau: np.ndarray, n_vars: int, n_artificial_vars: int
44+
) -> None:
45+
if tableau.dtype != "float64":
46+
raise TypeError("Tableau must have type float64")
4347

4448
# Check if RHS is negative
4549
if not (tableau[:, -1] >= 0).all():
@@ -233,7 +237,7 @@ def run_simplex(self) -> dict[Any, Any]:
233237
... [0, 0, 0.25, 0.25, 2],
234238
... [0, 1, 0.375, -0.125, 1],
235239
... [1, 0, -0.125, 0.375, 1]
236-
... ]), 2, 0).run_simplex()
240+
... ]), 2, 0).run_simplex()
237241
{'P': 2.0, 'x1': 1.0, 'x2': 1.0}
238242
239243
# Non-standard: >= constraints

0 commit comments

Comments
 (0)