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

BUG: optimize: linprog failing TestLinprogSimplexBland::test_unbounded_below_no_presolve_corrected #10303

Closed
mdhaber opened this issue Jun 14, 2019 · 6 comments
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 Jun 14, 2019

Failure on Travis CI X.2. See #10238

______ TestLinprogSimplexBland.test_unbounded_below_no_presolve_corrected ______
[gw0] linux -- Python 3.7.1 /home/travis/virtualenv/python3.7.1/bin/python

self = <scipy.optimize.tests.test_linprog.TestLinprogSimplexBland object at 0x7ff9ae535e10>

    def test_unbounded_below_no_presolve_corrected(self):
        c = [1]
        bounds = [(None, 1)]
    
        o = {key: self.options[key] for key in self.options}
        o["presolve"] = False
    
        res = linprog(c=c, bounds=bounds,
                      method=self.method,
>                     options=o)

bounds     = [(None, 1)]
c          = [1]
o          = {'bland': True, 'presolve': False}
self       = <scipy.optimize.tests.test_linprog.TestLinprogSimplexBland object at 0x7ff9ae535e10>

/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/scipy/optimize/tests/test_linprog.py:681: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/scipy/optimize/_linprog.py:525: in linprog
    c, c0=c0, A=A, b=b, callback=callback, _T_o=T_o, **solver_options)
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/scipy/optimize/_linprog_simplex.py:638: in _linprog_simplex
    nit0=nit1, bland=bland, _T_o=_T_o)
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/scipy/optimize/_linprog_simplex.py:386: in _solve_simplex
    pivcol_found, pivcol = _pivot_col(T, tol, bland)
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/scipy/optimize/_linprog_simplex.py:93: in _pivot_col
    return True, np.nonzero(ma.mask == False)[0][0]
<__array_function__ internals>:6: in nonzero
    ???
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/numpy/core/fromnumeric.py:1849: in nonzero
    return _wrapfunc(a, 'nonzero')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = True, method = 'nonzero', args = (), kwds = {}
bound = <built-in method nonzero of numpy.bool_ object at 0x7ff9cc0a82b8>

    def _wrapfunc(obj, method, *args, **kwds):
        bound = getattr(obj, method, None)
        if bound is None:
            return _wrapit(obj, method, *args, **kwds)
    
        try:
>           return bound(*args, **kwds)
E           DeprecationWarning: Calling nonzero on 0d arrays is deprecated, as it behaves surprisingly. Use `atleast_1d(cond).nonzero()` if the old behavior was intended. If the context of this warning is of the form `arr[nonzero(cond)]`, just use `arr[cond]`.

args       = ()
bound      = <built-in method nonzero of numpy.bool_ object at 0x7ff9cc0a82b8>
kwds       = {}
method     = 'nonzero'
obj        = True

/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/numpy/core/fromnumeric.py:61: DeprecationWarning
@peterbell10
Copy link
Member

peterbell10 commented Jun 14, 2019

In answer to why it's happening now #10238 (comment). The build is with a dev version of NumPy numpy-1.17.0.dev0+a84476d, apparently this was only deprecated yesterday numpy/numpy#13708.

@mdhaber
Copy link
Contributor Author

mdhaber commented Jun 14, 2019

Thanks!

@tylerjereddy tylerjereddy added scipy.optimize defect A clear bug or issue that prevents SciPy from being installed or used as expected labels Jun 14, 2019
mdhaber added a commit to mdhaber/scipy that referenced this issue Jun 14, 2019
@jdriscoll7
Copy link
Contributor

I went through and tried to fix all the deprecated nonzero() calls. Waiting to see if I pass Travis tests - the commits will be on #10298.

I'll let you know if my changes actually fix anything (or maybe they will break more).

@mdhaber
Copy link
Contributor Author

mdhaber commented Jun 14, 2019

@jwd0023 Oh, I was already doing this in #10306. Unless #10298 is ready to merge, probably better to keep it separate.

@jdriscoll7
Copy link
Contributor

@mdhaber I botched mine - yours looks like it will work. Thanks!

@ev-br
Copy link
Member

ev-br commented Jun 14, 2019

Fixed by #10306, closing.

@ev-br ev-br closed this as completed Jun 14, 2019
@ev-br ev-br added this to the 1.4.0 milestone Jun 14, 2019
tylerjereddy pushed a commit to tylerjereddy/scipy that referenced this issue Aug 5, 2019
@tylerjereddy tylerjereddy modified the milestones: 1.4.0, 1.3.1 Aug 6, 2019
tylerjereddy pushed a commit to tylerjereddy/scipy that referenced this issue Sep 2, 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

No branches or pull requests

5 participants