Skip to content

Commit 3a63883

Browse files
committed
fix warnings
1 parent 3eecb9b commit 3a63883

7 files changed

Lines changed: 37 additions & 15 deletions

File tree

.claude/settings.local.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(python -m pytest symplex/test.py -W error::DeprecationWarning)"
5+
]
6+
}
7+
}

branch_and_bound.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __str__(self):
118118
out.append("global update") #: {z_lb}")
119119
out = "\n".join(out) + "\n"
120120
# \l is graphviz' new line and left align escape sequence
121-
return out.replace("\n", "\l")
121+
return out.replace("\n", "\\l")
122122

123123
step = 0
124124
r_global = 0

cspell.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": "0.2",
3+
"words": [
4+
"symplex",
5+
"lexmin",
6+
"lexmax",
7+
"lexcmp",
8+
"lexfeasible"
9+
]
10+
}

pytest.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
[pytest]
22
pythonpath = .
3+
filterwarnings =
4+
ignore::DeprecationWarning:mpmath
5+
ignore::DeprecationWarning:networkx
6+
ignore:::matplotlib
7+
ignore:::pyparsing

symplex/perturb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from symplex.utils import *
33

44

5-
def pertubation_vector(perm: Iterable[int], eps):
6-
"""
7-
Provided a sufficiently small epsilon returns a pertubation vector
5+
def perturbation_vector(perm: Iterable[int], eps):
6+
r"""
7+
Provided a sufficiently small epsilon returns a perturbation vector
88
s.t. (A, b+e(\epsilon)) is in general position
99
:param: permutation of m constraints, usually `range(m)`
1010
:param eps:
@@ -15,7 +15,7 @@ def pertubation_vector(perm: Iterable[int], eps):
1515

1616
def perturbed_polygon(A: Matrix, b: Matrix, eps=Rational(1, 128)):
1717
m = A.shape[0]
18-
return A, b + pertubation_vector(range(m), eps)
18+
return A, b + perturbation_vector(range(m), eps)
1919

2020

2121
def v_star_from_perturbed_polygon(A: Matrix, b: Matrix, b_pert: Matrix, v_pert: Matrix):

symplex/test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,24 @@ def test_example3428():
101101
r1 = range(m)
102102
r2 = [5, 4, 3, 1, 0, 7, 6, 2]
103103

104-
# once with explicit pertubation
105-
e = pertubation_vector(r1, Rational(1, 64))
104+
# once with explicit perturbation
105+
e = perturbation_vector(r1, Rational(1, 64))
106106
v_3_e = v_3 + (sub_matrix(A, B) ** -1 * sub_matrix(e, B))
107107
b_e = b + e
108-
res, v_r1_star_expl_pert, _, _ = simplex(A, b_e, c, v_3_e, B, pivot_rule_i=PivotRule.MINIMAL())
109-
v_r1_star_expl = v_star_from_perturbed_polygon(A, b, b_e, v_r1_star_expl_pert)
108+
res, v_r1_star_explicit_pert, _, _ = simplex(A, b_e, c, v_3_e, B, pivot_rule_i=PivotRule.MINIMAL())
109+
v_r1_star_explicit = v_star_from_perturbed_polygon(A, b, b_e, v_r1_star_explicit_pert)
110110

111-
e = pertubation_vector(r2, Rational(1, 64))
111+
e = perturbation_vector(r2, Rational(1, 64))
112112
v_3_e = v_3 + (sub_matrix(A, B) ** -1 * sub_matrix(e, B))
113113
b_e = b + e
114-
res, v_r2_star_expl_pert, _, _ = simplex(A, b_e, c, v_3_e, B, pivot_rule_i=PivotRule.MINIMAL())
115-
v_r2_star_expl = v_star_from_perturbed_polygon(A, b, b_e, v_r2_star_expl_pert)
114+
res, v_r2_star_explicit_pert, _, _ = simplex(A, b_e, c, v_3_e, B, pivot_rule_i=PivotRule.MINIMAL())
115+
v_r2_star_explicit = v_star_from_perturbed_polygon(A, b, b_e, v_r2_star_explicit_pert)
116116

117117
# and once with our fancy lexmin rule
118118
res, v_r1_star_lexmin, _, _ = simplex(A, b, c, v_3, B, pivot_rule_i=PivotRule.LEXMIN(r1))
119119
res, v_r2_star_lexmin, _, _ = simplex(A, b, c, v_3, B, pivot_rule_i=PivotRule.LEXMIN(r2))
120-
assert v_r1_star_expl == v_r1_star_lexmin
121-
assert v_r2_star_expl == v_r2_star_lexmin
120+
assert v_r1_star_explicit == v_r1_star_lexmin
121+
assert v_r2_star_explicit == v_r2_star_lexmin
122122

123123

124124
def test_ex93():

toolbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __get_graph_from_adjacency_matrix(csvfile, filling_values=None, isDirected=F
9292

9393

9494
def __get_graph_from_edge_list(csvfile, directed=True):
95-
xs = np.genfromtxt(csvfile, delimiter=",", dtype=None, names=True)
95+
xs = np.genfromtxt(csvfile, delimiter=",", dtype=None, names=True, encoding=None)
9696
edges = []
9797
for x in xs:
9898
fnode = x[0]

0 commit comments

Comments
 (0)