Opened 9 years ago

Closed 8 years ago

#13281 closed defect (duplicate)

gurobi backend has no copy(), and creates named constraints since v5

Reported by: dimpase Owned by: ncohen
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: linear programming Keywords:
Cc: ncohen Merged in:
Authors: Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


installing Gurobi switches the default LP solver to Gurobi, leading to doctest failure in mip.pyx

File "/usr/local/src/sage/sage-5.2.rc0/devel/sage-main/sage/numerical/mip.pyx", line 298:
    sage: q = copy(p)
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage/sage-5.2.rc0/local/bin/", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/usr/local/src/sage/sage-5.2.rc0/local/bin/", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/usr/local/src/sage/sage-5.2.rc0/local/bin/", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_4[4]>", line 1, in <module>
        q = copy(p)###line 298:
    sage: q = copy(p)
      File "/usr/local/src/sage/sage-5.2.rc0/local/lib/python2.7/", line 80, in copy
        return copier(x)
      File "mip.pyx", line 320, in sage.numerical.mip.MixedIntegerLinearProgram.__copy__ (sage/numerical/mip.c:2352)
        p._backend = (<GenericBackend> self._backend).copy()
    AttributeError: 'sage.numerical.backends.gurobi_backend.GurobiBacke' object has no attribute 'copy'

And indeed, there is no copy() in gurobi backend.

Another bunch of tests that fail in a similar fashion, due to Gurobi (version 5) automatically naming constraints, and so one gets

File "/usr/local/src/sage/sage-5.2.rc0/devel/sage-main/sage/numerical/mip.pyx", line 1132:
      x_0 + x_1 <= 10.0
      x_0 - x_1 <= 0.0
      x_0 <= 4.0
      R0: x_0 + x_1 <= 10.0
      R1: x_0 - x_1 <= 0.0
      R2: x_0 <= 4.0
      x_0 is a continuous variable (min=0.0, max=+oo)
      x_1 is a continuous variable (min=0.0, max=+oo)

and other similar failures from show().

One particular way to fix this would be to set the solver to be GLPK in all these tests, and create similar optional tests for Gurobi.

And, lastly, Gurobi version 5 on OSX 10.6 outputs [-0.0, 3.0] rather than [0.0, 3.0] in a doctest in gurobi_backend.pyx.

Change History (3)

comment:1 Changed 8 years ago by vbraun

  • Authors set to Volker Braun
  • Milestone changed from sage-5.10 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Duplicate of #12973

comment:2 Changed 8 years ago by dimpase

  • Status changed from needs_review to positive_review

comment:3 Changed 8 years ago by jdemeyer

  • Authors Volker Braun deleted
  • Resolution set to duplicate
  • Reviewers set to Volker Braun
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.