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
LP and MIP Solvers in Sage ( with symbolics ) #6869
Comments
comment:2
This applies fine to 4.1.2.a0 and passes testall without any other packages installed (no glpk, etc). Running more tests... |
comment:3
The module
|
comment:4
Done ! |
comment:5
Attachment: MIP-now-symbolic.patch.gz |
comment:6
ncohen asked this question in IRC:
This is encouraging you to define an equality method
Take the case of writing the method
In the "EXAMPLES" section of that method, you should have an example as follows with appropriate values for
which should return True when you actually doctest the MIP module. Define a similar equality method for the other two classes. One thing I dislike in code is to see it squashed together. This makes it more difficult to read, taking into account also that other people need to understand what that code does, its logical flow, and they might have been spending all day reading code. Good coding style is a plus here if you want your code to be as easily understandable as possible. Instead of doing this:
do this:
Another issue is global namespace pollution. What I mean is that you should try to avoid as much as possible injecting your module, class, or function names into the global namespace when Sage loads itself. This is what you're currently doing with this code:
What this means is that when you load Sage, all the class and function names defined in the module mip.pyx are loaded into the global namespace. An advantage to this is that a user doesn't have to first import the relevant class or function prior to using it. With the above import statement, I can do this
Without the import statement, I would need to do this:
I can see that importing stuff when Sage is being loaded saves a lot of time explicitly importing that stuff. But a downside is that the global namespace is being polluted with module, class or function names that are not really necessary to load at the start. As more names are put into the global namespace, it takes longer and longer to load Sage. |
comment:7
This applies fine to 4.1.2.a0 on an ubuntu 9.04 machine and passes sage -testall (with no packages, eg glpk, applied). The docstrings look fine (as before). I then applies glpk and reran sage -testall. All tests passes sage -testall except this:
I doubt this is related, so giving this a positive review. |
comment:8
See #6913 for a follow-up to this ticket. It addresses the issue of writing those |
Reviewer: David Joyner, Minh Van Nguyen |
Author: Nathann Cohen |
Merged: Sage 4.1.2.alpha2 |
comment:10
After going through this patch, I think it would be best to revert it before 4.1.2 is released. There is still a lot of things that need to be done to get it cleaned up. Some of the things,
I have some code that addresses some of these things that I'll put up shortly. |
comment:11
See #7012 for a follow up to this ticket. It addresses mhansen's suggestions. |
Hello everybody !!!
After the work done in #6502 I rewrote the whole class taking into account the fact that some people may want to use this class too, instead of just focusing on the fact I needed it quickly to write Graph-Theoretic functions.
Here is the new numerical.MIP class, using symbolics, I hope sufficiently documented and tested, and everything... Thank you for your help !! This should be the last run ;-)
To use it, you have to install either GLPK from ticket #6867 or Coin-OR CBC from #6868 ( if you have installed a former version, they won't be compatible ! )
The class and the doctests, though, should behave peacefully if none of them is installed ! :-)
Nathann
CC: @haraldschilly @wdjoyner @sagetrac-mvngu
Component: numerical
Author: Nathann Cohen
Reviewer: David Joyner, Minh Van Nguyen
Merged: Sage 4.1.2.alpha2
Issue created by migration from https://trac.sagemath.org/ticket/6869
The text was updated successfully, but these errors were encountered: