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

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

Closed
dimpase opened this issue Jul 22, 2012 · 4 comments
Closed

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

dimpase opened this issue Jul 22, 2012 · 4 comments

Comments

@dimpase
Copy link
Member

dimpase commented Jul 22, 2012

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/ncadoctest.py", 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/sagedoctest.py", 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/ncadoctest.py", 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/copy.py", 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:
    sage: p.show()
Expected:
    Maximization:
    <BLANKLINE>
    Constraints:
      x_0 + x_1 <= 10.0
      x_0 - x_1 <= 0.0
      x_0 <= 4.0
    ...
Got:
    Maximization:
    <BLANKLINE>
    Constraints:
      R0: x_0 + x_1 <= 10.0
      R1: x_0 - x_1 <= 0.0
      R2: x_0 <= 4.0
    Variables:
      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.

CC: @nathanncohen

Component: linear programming

Reviewer: Volker Braun

Issue created by migration from https://trac.sagemath.org/ticket/13281

@vbraun
Copy link
Member

vbraun commented May 11, 2013

comment:1

Duplicate of #12973

@vbraun
Copy link
Member

vbraun commented May 11, 2013

Author: Volker Braun

@jdemeyer
Copy link

Changed author from Volker Braun to none

@jdemeyer
Copy link

Reviewer: Volker Braun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants