We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e39555 commit ffce18cCopy full SHA for ffce18c
linear_programming/simplex.py
@@ -35,11 +35,15 @@ class Tableau:
35
...
36
ValueError: number of (artificial) variables must be a natural number
37
"""
38
+
39
# Max iteration number to prevent cycling
40
maxiter = 100
- 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')
+ 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")
47
48
# Check if RHS is negative
49
if not (tableau[:, -1] >= 0).all():
@@ -233,7 +237,7 @@ def run_simplex(self) -> dict[Any, Any]:
233
237
... [0, 0, 0.25, 0.25, 2],
234
238
... [0, 1, 0.375, -0.125, 1],
235
239
... [1, 0, -0.125, 0.375, 1]
236
- ... ]), 2, 0).run_simplex()
240
+ ... ]), 2, 0).run_simplex()
241
{'P': 2.0, 'x1': 1.0, 'x2': 1.0}
242
243
# Non-standard: >= constraints
0 commit comments