Opened 9 months ago

Closed 8 months ago

#26999 closed defect (fixed)

1 optional gurobi doctest failing

Reported by: slabbe Owned by: embray
Priority: major Milestone: sage-8.7
Component: linear programming Keywords:
Cc: Merged in:
Authors: Erik Bray Reviewers: Sébastien Labbé
Report Upstream: N/A Work issues:
Branch: 8cd23e4 (Commits) Commit: 8cd23e4e7d51dd860637151d958c6d265cf1d687
Dependencies: Stopgaps:

Description (last modified by slabbe)

Using 8.6.beta1 with Gurobi installed and available in Sage (as explained here), the command

sage -t --optional=sage,external src/sage/numerical/backends/gurobi_backend.pyx

gives

Using --optional=external,memlimit,sage
External software to be detected: cplex,ffmpeg,graphviz,gurobi,imagemagick,internet,latex,macaulay2,magma,maple,mathematica,matlab,octave,pandoc,scilab
Doctesting 1 file.
sage -t src/sage/numerical/backends/gurobi_backend.pyx
**********************************************************************
File "src/sage/numerical/backends/gurobi_backend.pyx", line 50, in sage.numerical.backends.gurobi_backend.GurobiBackend
Failed example:
    TestSuite(p.get_backend()).run(skip="_test_pickling")         # optional - Gurobi
Expected nothing
Got:
    Failure in _test_copy:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/misc/sage_unittest.py", line 296, in run
        test_method(tester = tester)
      File "sage/numerical/backends/generic_backend.pyx", line 1255, in sage.numerical.backends.generic_backend.GenericBackend._test_copy (build/cythonized/sage/numerical/backends/generic_backend.c:14740)
        self._do_test_problem_data(tester, cp)
      File "sage/numerical/backends/generic_backend.pyx", line 1229, in sage.numerical.backends.generic_backend.GenericBackend._do_test_problem_data (build/cythonized/sage/numerical/backends/generic_backend.c:14457)
        assert_equal_problem_data(method)
      File "sage/numerical/backends/generic_backend.pyx", line 1226, in sage.numerical.backends.generic_backend.GenericBackend._do_test_problem_data.assert_equal_problem_data (build/cythonized/sage/numerical/backends/generic_backend.c:13727)
        tester.assertEqual(getattr(self, method)(), getattr(cp, method)(),
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/unittest/case.py", line 513, in assertEqual
        assertion_func(first, second, msg=msg)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/unittest/case.py", line 506, in _baseAssertEqual
        raise self.failureException(msg)
    AssertionError: problem_name does not match
    ------------------------------------------------------------
    Failure in _test_copy_does_not_share_data:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/misc/sage_unittest.py", line 296, in run
        test_method(tester = tester)
      File "sage/numerical/backends/generic_backend.pyx", line 1265, in sage.numerical.backends.generic_backend.GenericBackend._test_copy_does_not_share_data (build/cythonized/sage/numerical/backends/generic_backend.c:14947)
        self._do_test_problem_data(tester, cpcp)
      File "sage/numerical/backends/generic_backend.pyx", line 1229, in sage.numerical.backends.generic_backend.GenericBackend._do_test_problem_data (build/cythonized/sage/numerical/backends/generic_backend.c:14457)
        assert_equal_problem_data(method)
      File "sage/numerical/backends/generic_backend.pyx", line 1226, in sage.numerical.backends.generic_backend.GenericBackend._do_test_problem_data.assert_equal_problem_data (build/cythonized/sage/numerical/backends/generic_backend.c:13727)
        tester.assertEqual(getattr(self, method)(), getattr(cp, method)(),
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/unittest/case.py", line 513, in assertEqual
        assertion_func(first, second, msg=msg)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/unittest/case.py", line 506, in _baseAssertEqual
        raise self.failureException(msg)
    AssertionError: problem_name does not match
    ------------------------------------------------------------
    The following tests failed: _test_copy, _test_copy_does_not_share_data
**********************************************************************
1 item had failures:
   1 of   3 in sage.numerical.backends.gurobi_backend.GurobiBackend
    [207 tests, 1 failure, 0.14 s]
----------------------------------------------------------------------
sage -t src/sage/numerical/backends/gurobi_backend.pyx  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 0.2 seconds
    cpu time: 0.1 seconds
    cumulative wall time: 0.1 seconds
External software detected for doctesting: gurobi

Change History (13)

comment:1 Changed 9 months ago by slabbe

This failure was first seen in 8.6.beta0 and was not present in 8.5.beta5. Looking at what was merged in 8.5.beta6 and 8.6.beta0, the first natural hypothesis would be that this failure was introduced in #24740 merged in 8.6.beta0.

comment:2 Changed 9 months ago by slabbe

  • Description modified (diff)

comment:3 Changed 9 months ago by slabbe

  • Description modified (diff)

comment:4 Changed 9 months ago by embray

  • Owner changed from (none) to embray

Probably so; I don't think we've tested against all optional packages (though perhaps that's just something I'm going to start doing, at least with all the optional packages I can successfully install on a give platform...).

comment:5 follow-up: Changed 9 months ago by embray

I see now; this is not even an optional package, but an external dependency of proprietary software :( Nevertheless, the issue seems straightforward...

comment:6 Changed 9 months ago by embray

On second thought, looking at the relevant code changes, it's not at all clear what would have changed to result in this difference, especially on Python 2. It's possible #24740 is not even related.

It would help if you could do some examples manually, since the output from the test suite is not very helpful (it would be better if it showed the actual difference).

What does it show if you do:

sage: from copy import copy
sage: p = MixedIntegerLinearProgram(solver="Gurobi")
sage: b = p.get_backend()
sage: b.problem_name()
???
sage: b2 = copy(b)
sage: b2.problem_name()
???

That seems to be the test this is doing, though I'm not positive if that's all that's needed to reproduce the failure, and without access to Gurobi I can't easily debug it :(

comment:7 Changed 9 months ago by slabbe

I have access to two machines with Gurobi installed, one running 8.5.beta4 and the other running 8.6.rc0:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.5.beta4, Release Date: 2018-11-18               │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: from copy import copy
sage: p = MixedIntegerLinearProgram(solver="Gurobi")
sage: b = p.get_backend()
sage: b.problem_name()
''
sage: b2 = copy(b)
sage: b2.problem_name()
''
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.6.rc0, Release Date: 2019-01-03                 │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: from copy import copy
sage: p = MixedIntegerLinearProgram(solver="Gurobi")
sage: b = p.get_backend()
sage: b.problem_name()
''
sage: b2 = copy(b)
sage: b2.problem_name()
'(null)_copy'

comment:8 in reply to: ↑ 5 Changed 9 months ago by slabbe

Replying to embray:

I see now; this is not even an optional package, but an external dependency of proprietary software :(

"For University Users: If you are a student, faculty, or staff member at a recognized degree-granting institution, you may be eligible for a free, full-featured, no-size limit, academic version of Gurobi."

Source: http://www.gurobi.com/academia/academia-center

comment:9 Changed 9 months ago by embray

Thanks--all of the above is useful info.

comment:10 Changed 9 months ago by embray

  • Authors set to Erik Bray
  • Branch set to u/embray/ticket-26999
  • Commit set to 8cd23e4e7d51dd860637151d958c6d265cf1d687
  • Status changed from new to needs_review

I haven't tested, but this should fix it. (You were right of course by it being introduced by #24740; not surprising though the reason was a bit subtle.)


New commits:

8cd23e4Trac #26999: fix GurobiBackend.problem_name()
Last edited 9 months ago by embray (previous) (diff)

comment:11 Changed 9 months ago by slabbe

  • Reviewers set to Sébastien Labbé
  • Status changed from needs_review to positive_review

It fixes the issue.

comment:12 Changed 8 months ago by embray

  • Milestone changed from sage-8.6 to sage-8.7

Retarging tickets optimistically to the next milestone. If you are responsible for this ticket (either its reporter or owner) and don't believe you are likely to complete this ticket before the next release (8.7) please retarget this ticket's milestone to sage-pending or sage-wishlist.

comment:13 Changed 8 months ago by vbraun

  • Branch changed from u/embray/ticket-26999 to 8cd23e4e7d51dd860637151d958c6d265cf1d687
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.