mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 10:28:39 +00:00
fix precommit typehints
This commit is contained in:
parent
de6cb052a0
commit
f40dad1c8b
@ -27,8 +27,7 @@ class Tableau:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, tableau: np.ndarray, n_vars: int, n_art_vars: int | None = None
|
self, tableau: np.ndarray, n_vars: int, n_art_vars: int) -> None:
|
||||||
) -> None:
|
|
||||||
# Check if RHS is negative
|
# Check if RHS is negative
|
||||||
if np.any(tableau[:, -1], where=tableau[:, -1] < 0):
|
if np.any(tableau[:, -1], where=tableau[:, -1] < 0):
|
||||||
raise ValueError("RHS must be > 0")
|
raise ValueError("RHS must be > 0")
|
||||||
@ -39,10 +38,6 @@ class Tableau:
|
|||||||
# Number of decision variables x1, x2, x3...
|
# Number of decision variables x1, x2, x3...
|
||||||
self.n_vars, self.n_art_vars = n_vars, n_art_vars
|
self.n_vars, self.n_art_vars = n_vars, n_art_vars
|
||||||
|
|
||||||
# Number of artificial variables to be minimised
|
|
||||||
if self.n_art_vars is None:
|
|
||||||
self.n_art_vars = len(np.where(tableau[self.n_vars : -1] == -1)[0])
|
|
||||||
|
|
||||||
# 2 if there are >= or == constraints (nonstandard), 1 otherwise (std)
|
# 2 if there are >= or == constraints (nonstandard), 1 otherwise (std)
|
||||||
self.n_stages = (self.n_art_vars > 0) + 1
|
self.n_stages = (self.n_art_vars > 0) + 1
|
||||||
|
|
||||||
@ -72,7 +67,7 @@ class Tableau:
|
|||||||
... 2).generate_col_titles()
|
... 2).generate_col_titles()
|
||||||
['x1', 'x2', 's1', 's2', 'RHS']
|
['x1', 'x2', 's1', 's2', 'RHS']
|
||||||
"""
|
"""
|
||||||
args = (self.n_vars, self.n_slack, self.n_art_vars)
|
args = (self.n_vars, self.n_slack)
|
||||||
|
|
||||||
# decision | slack
|
# decision | slack
|
||||||
string_starts = ["x", "s"]
|
string_starts = ["x", "s"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user