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

Cannot copy() instances of GurobiBackend. #12973

Closed
sagetrac-e-vaughan mannequin opened this issue May 18, 2012 · 22 comments
Closed

Cannot copy() instances of GurobiBackend. #12973

sagetrac-e-vaughan mannequin opened this issue May 18, 2012 · 22 comments

Comments

@sagetrac-e-vaughan
Copy link
Mannequin

sagetrac-e-vaughan mannequin commented May 18, 2012

GurobiBackend does not implement copy().

I've attached a patch to add this functionality.

The patch also corrects a few doctests in the same file, that have solver="Gurobi" instead of solver="GUROBI".

(The patch was created with Sage 4.8.)

APPLY:

Depends on #14566

Component: linear programming

Keywords: Gurobi, GurobiBackend

Author: Emil R. Vaughan, Nathann Cohen

Reviewer: Volker Braun

Merged: sage-5.10.beta3

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

@sagetrac-e-vaughan

This comment has been minimized.

@sagetrac-e-vaughan

This comment has been minimized.

@sagetrac-e-vaughan
Copy link
Mannequin Author

sagetrac-e-vaughan mannequin commented May 18, 2012

Changed keywords from none to Gurobi, GurobiBackend

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 19, 2012

comment:3

Wow !! Very good patch for a first ! :-D

Well, it did not apply cleanly on version 5.1.beta0 but that was to be expected if you worked on 4.8 Actually, the replacement from GUROBI to Gurobi has been done since, and that was the whole reason why it did not apply. I just rebased your patch on 5.1.beta0 and updated it on the trac ticket.

There is a problem though, for your patch does not compile. When I apply it and type "sage -b" I get this :

Error compiling Cython file:
------------------------------------------------------------
...
            sage: p.set_objective([2, 5])                                           # optional - Gurobi
            sage: p.write_lp(SAGE_TMP+"/lp_problem.lp")                             # optional - Gurobi
        """
        check(self.env, GRBwrite(self.model[0], filename))

    cpdef GurobiBackend copy(self):
         ^
------------------------------------------------------------

sage/numerical/backends/gurobi_backend.pyx:1079:10: C method 'copy' not previously declared in definition part of extension type
Error running command, failed with status 256.
Error installing modified sage library code.

This is because cdef methods should be added to gurobi_backend.pxd as it is added for glpk in glpk_backend.pxd. I will post another patch to do exactly that.

Nathann

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 19, 2012

comment:4

Nice !

So I agree with your changes, but as I added something myself you also need to check that everything is fine on your side, and then we will be able to set this ticket to "positive review", which means that the release manager can add it to the next release of Sage!

Thank you for your patch !!

Nathann

@nathanncohen

This comment has been minimized.

@sagetrac-e-vaughan
Copy link
Mannequin Author

sagetrac-e-vaughan mannequin commented May 19, 2012

comment:6

Thanks Nathann! I am a bit reluctant to upgrade to Sage 5.x to test the patch due to the issues with Core2 Duo Macs....

Also, in my original patch, I did have a

cpdef GurobiBackend copy(self)

line.... Maybe that bit of the patch didn't apply properly in 5.1?

One question: why have you changed copy to be a cdef instead of a cpdef? (I used cpdef because that's what GLPKBackend uses (or did in 4.8).)

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 20, 2012

comment:7

Helloooooo !!!

Thanks Nathann! I am a bit reluctant to upgrade to Sage 5.x to test the patch due to the issues with Core2 Duo Macs....

Ahaha. That's understandable :-D
So the bug happens even when you compile from source ? Scary mac..

Also, in my original patch, I did have a

cpdef GurobiBackend copy(self)

line.... Maybe that bit of the patch didn't apply properly in 5.1?

OOpps. Yes, probably. I looked at the list of rejected lines and saw so many GUROBI -> Gurobi, I probably missed that one.

One question: why have you changed copy to be a cdef instead of a cpdef? (I used cpdef because that's what GLPKBackend uses (or did in 4.8).)

Oops, you are right. Actually, cpef functions are functions that can be called at either C-level or Python level. Well, it more or less changes nothing in this situation, as the code onl calls the copy method from the backends at C level. It's actually totally up to you :-)

Nathann

@jdemeyer jdemeyer modified the milestones: sage-5.0.1, sage-5.1 May 29, 2012
@jdemeyer
Copy link

comment:9

Please fill in your real name as Author.

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Dec 8, 2012

Author: Nathann Cohen

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 11, 2013

Reviewer: Nathann Cohen

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 11, 2013

Changed author from Nathann Cohen to Emil R. Vaughan

@vbraun
Copy link
Member

vbraun commented May 11, 2013

comment:12

patchbot:
apply 16400.patch, trac_12973-review.patch

@vbraun
Copy link
Member

vbraun commented May 11, 2013

Dependencies: #14566

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 11, 2013

Attachment: 16400.patch.gz

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 11, 2013

Attachment: trac_12973-review.patch.gz

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 11, 2013

comment:14

Rebased !

Nathann

@vbraun
Copy link
Member

vbraun commented May 12, 2013

comment:15

lgtm

@vbraun
Copy link
Member

vbraun commented May 12, 2013

Changed reviewer from Nathann Cohen to Volker Braun

@vbraun
Copy link
Member

vbraun commented May 12, 2013

Changed author from Emil R. Vaughan to Emil R. Vaughan, Nathann Cohen

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented May 12, 2013

comment:16

Just learned a new acronym. Thank you very much Volker ! :-)

Nathann

@jdemeyer
Copy link

Merged: sage-5.10.beta3

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