Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linprog(method='revised simplex') doctest bug #10124

Closed
mdhaber opened this issue May 3, 2019 · 6 comments · Fixed by #10135
Closed

linprog(method='revised simplex') doctest bug #10124

mdhaber opened this issue May 3, 2019 · 6 comments · Fixed by #10135
Assignees
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.optimize
Milestone

Comments

@mdhaber
Copy link
Contributor

mdhaber commented May 3, 2019

linprog method='revised simplex' (in the 1.3 branch) doesn't solve the example problem in the docstring. The example was supposed to be a doctest, but all the outputs were marked "# may vary", so the problem wasn't caught.

I think a small bug in the phase 1 problem formulation was introduced at some point. Strangely, the issue didn't surface in any of the other tests (or the much more difficult benchmark problems). I can fix it before 1.3 and add the example as a regular test before 1.3 is released. @tylerjereddy Do I submit a PR to the "maintenance/1.3.x" branch?

Reproducing code example:

c = [-1, 4]
A = [[-3, 1], [1, 2]]
b = [6, 4]
x0_bounds = (None, None)
x1_bounds = (-3, None)
from scipy.optimize import linprog
res = linprog(c, A_ub=A, b_ub=b, bounds=(x0_bounds, x1_bounds), method="revised simplex",
              options={"disp": True})
print(res)

The status is 4 (algorithm reported success, but solution was infeasible).

@ilayn
Copy link
Member

ilayn commented May 3, 2019

We are at RC phase to catch these post branch issues. If needed, which seems so, Tyler would backport it

@ilayn ilayn added backport-candidate This fix should be ported by a maintainer to previous SciPy versions. Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.optimize labels May 3, 2019
@ilayn
Copy link
Member

ilayn commented May 3, 2019

If you open a PR also mark it backport candidate and remove it here maybe?

@mdhaber
Copy link
Contributor Author

mdhaber commented May 3, 2019

Will try to do this weekend. Still scheduled to release 5/20?

mdhaber added a commit to mdhaber/scipy that referenced this issue May 4, 2019
@mdhaber mdhaber added defect A clear bug or issue that prevents SciPy from being installed or used as expected and removed backport-candidate This fix should be ported by a maintainer to previous SciPy versions. labels May 4, 2019
@tylerjereddy tylerjereddy added this to the 1.3.0 milestone May 4, 2019
@tylerjereddy
Copy link
Contributor

Hoping we can stick to the schedule yes, but the SkylakeX / AVX OpenBLAS issues have me a little concerned.

The PR should be to master, then we can backport if that seems appropriate--tag the PR to master with backport label so I can see it in the list when I'm doing release duties next time.

tylerjereddy pushed a commit that referenced this issue May 8, 2019
* BUG: fix linprog revised simplex docstring problem failure
linprog with method='revised simplex' failed docstring problem. The cause
was that option 'disp'=True executes _postsolve, which changes the
solution vector. Simple fix was to copy the solution vector before passing
it into _postsolve.

* BUG: optimize: adds tests for bug #10124

* BUG: optimize: fix linprog docstring failure for interior-point

* BUG:optimize:fix linprog interior-point not calling callback on iteration 0

* ENH:optimize:linprog_ip convert displayed variables to float in _display_iter

* ENH:optimize:_linprog_rs use new _postsolve copy option
tylerjereddy pushed a commit to tylerjereddy/scipy that referenced this issue May 8, 2019
* BUG: fix linprog revised simplex docstring problem failure
linprog with method='revised simplex' failed docstring problem. The cause
was that option 'disp'=True executes _postsolve, which changes the
solution vector. Simple fix was to copy the solution vector before passing
it into _postsolve.

* BUG: optimize: adds tests for bug scipy#10124

* BUG: optimize: fix linprog docstring failure for interior-point

* BUG:optimize:fix linprog interior-point not calling callback on iteration 0

* ENH:optimize:linprog_ip convert displayed variables to float in _display_iter

* ENH:optimize:_linprog_rs use new _postsolve copy option
@mdhaber mdhaber reopened this Jul 21, 2019
@mdhaber
Copy link
Contributor Author

mdhaber commented Jul 21, 2019

Apparently this was fixed on some platforms but not all. There was a mistake in test_bug_10124 such that the remaining issue was not caught:

res = linprog(c, A_ub, b_ub, A_eq, b_eq, bounds, method=self.method, options=self.options)

is supposed to be

res = linprog(c, A_ub, b_ub, A_eq, b_eq, bounds, method=self.method, options=self.o)

@mdhaber mdhaber modified the milestones: 1.3.0, 1.4.0, 1.2.2 Jul 21, 2019
@mdhaber mdhaber self-assigned this Jul 21, 2019
@mdhaber mdhaber modified the milestones: 1.4.0, 1.3.1 Jul 21, 2019
@mdhaber
Copy link
Contributor Author

mdhaber commented Jul 21, 2019

@tylerjereddy Didn't realize we were doing a 1.3.1 shortly. Let me get a PR for this out.

@mdhaber mdhaber removed the Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org label Jul 23, 2019
@pv pv closed this as completed in 36571d9 Aug 4, 2019
@tylerjereddy tylerjereddy modified the milestones: 1.3.1, 1.4.0 Aug 4, 2019
toddrjen pushed a commit to toddrjen/scipy that referenced this issue Aug 5, 2019
tylerjereddy pushed a commit to tylerjereddy/scipy that referenced this issue Oct 23, 2019
@tylerjereddy tylerjereddy modified the milestones: 1.4.0, 1.3.2 Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.optimize
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants