11
11
12
12
class InteriorPointMethod :
13
13
"""
14
- Operate on linear programming problems using the Primal-Dual Interior-Point Method.
15
-
16
- Attributes:
17
- objective_coefficients (np.ndarray): Coefficient matrix for the objective
18
- function.
19
- constraint_matrix (np.ndarray): Constraint matrix.
20
- constraint_bounds (np.ndarray): Constraint bounds.
21
- tol (float): Tolerance for stopping criterion.
22
- max_iter (int): Maximum number of iterations.
14
+ Operate on linear programming problems using the Primal-Dual Interior-Point Method.
15
+
16
+ Attributes:
17
+ objective_coefficients (np.ndarray): Coefficient matrix for the objective
18
+ function.
19
+ constraint_matrix (np.ndarray): Constraint matrix.
20
+ constraint_bounds (np.ndarray): Constraint bounds.
21
+ tol (float): Tolerance for stopping criterion.
22
+ max_iter (int): Maximum number of iterations.
23
23
"""
24
24
25
25
def __init__ (
@@ -48,7 +48,7 @@ def _is_valid_input(self) -> bool:
48
48
49
49
def _convert_to_standard_form (self ) -> tuple [np .ndarray , np .ndarray ]:
50
50
"""Convert constraints to standard form by adding slack and surplus
51
- variables."""
51
+ variables."""
52
52
(m , n ) = self .constraint_matrix .shape
53
53
slack_surplus = np .eye (m )
54
54
a_standard = np .hstack ([self .constraint_matrix , slack_surplus ])
@@ -57,11 +57,11 @@ def _convert_to_standard_form(self) -> tuple[np.ndarray, np.ndarray]:
57
57
58
58
def solve (self ) -> tuple [np .ndarray , float ]:
59
59
"""
60
- Solve the linear programming problem using the Primal-Dual Interior-Point
61
- Method.
60
+ Solve the linear programming problem using the Primal-Dual Interior-Point
61
+ Method.
62
62
63
- Returns:
64
- tuple: A tuple containing the optimal solution and the optimal value.
63
+ Returns:
64
+ tuple: A tuple containing the optimal solution and the optimal value.
65
65
"""
66
66
a , c = self ._convert_to_standard_form ()
67
67
m , n = a .shape
0 commit comments