Skip to content

Commit

Permalink
BUG: optimize: adds tests for bug scipy#10124
Browse files Browse the repository at this point in the history
  • Loading branch information
mdhaber committed May 4, 2019
1 parent 1aa30dc commit 5ecde58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scipy/optimize/_linprog_rs.py
Expand Up @@ -340,7 +340,7 @@ def _phase_two(c, A, x, b, maxiter, tol, maxupdate, mast, pivot, iteration=0,
else:
phase = 2
x_postsolve = x
x_o, fun, slack, con, _, _ = _postsolve(x_postsolve.copy()), *_T_o,
x_o, fun, slack, con, _, _ = _postsolve(x_postsolve.copy(), *_T_o,
tol=tol)

if callback is not None:
Expand Down
19 changes: 19 additions & 0 deletions scipy/optimize/tests/test_linprog.py
Expand Up @@ -1301,6 +1301,25 @@ def test_bug_8973_2(self):
method=self.method, options=self.options)
_assert_success(res, desired_x=[-2], desired_fun=0)

def test_bug_10124(self):
"""
Test for linprog docstring problem
'disp'=True caused revised simplex failure
"""
c = np.zeros(1)
A_ub = np.array([[1]])
b_ub = np.array([-2])
bounds = (None, None)
c = [-1, 4]
A_ub = [[-3, 1], [1, 2]]
b_ub = [6, 4]
bounds = [(None, None), (-3, None)]
o = {"disp": True}
o.update(self.options)
res = linprog(c, A_ub, b_ub, A_eq, b_eq, bounds,
method=self.method, options=self.options)
_assert_success(res, desired_x=[10, -3], desired_fun=-22)

#########################
# Method-specific Tests #
#########################
Expand Down

0 comments on commit 5ecde58

Please sign in to comment.