-
Notifications
You must be signed in to change notification settings - Fork 92
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
Fix logical errors in Gurobi check #149
Conversation
9d52b76
to
9a19133
Compare
Very clean, a couple of thoughts:
>>> import mip
>>> m = mip.Model(solver_name='GRB')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/michael/git/python-mip/mip/model.py", line 84, in __init__
self.solver = mip.gurobi.SolverGurobi(self, name, sense)
AttributeError: module 'mip.gurobi' has no attribute 'SolverGurobi' |
Due to the bare |
i didn't notice that, thanks for pointing out. good to fix it :) new changes result in a bunch of types and default values of the methods of the classes being defined under the import mip
m = mip.Model('GRB')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/michael/git/python-mip/mip/model.py", line 90, in __init__
import mip.gurobi
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/Users/michael/git/python-mip/mip/gurobi.py", line 325, in <module>
class SolverGurobi(Solver):
File "/Users/michael/git/python-mip/mip/gurobi.py", line 326, in SolverGurobi
def __init__(self, model: Model, name: str, sense: str, modelp: CData = ffi.NULL):
NameError: name 'CData' is not defined |
1bef0f6
to
c7e68e2
Compare
Hi @lpsinger , thanks for your contribution ! I`m reviewing the patches. In the last modification (October 14) there are some large modifications in guroby.py in several methods. Are they necessary in your patch or it happened due to an automatic format ? If they are, it would be good perhaps to split in more patches with comments. |
@h-g-s, try suppressing whitespace changes in your diff viewer. It's not as big as a change as it looks. |
@h-g-s, the large diff is due to indenting a large portion of gurobi.py to be inside an |
The Black formatting errors were there before my PR. Would you like me to open a separate PR to clean up those formatting errors first? |
Yes, please use the black formatting and open a new PR.
… On Oct 23, 2020, at 10:40 AM, Leo Singer ***@***.***> wrote:
The Black formatting errors were there before my PR. Would you like me to open a separate PR to clean up those formatting errors first?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#149 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB4VZOSWVLFTO36MUXXJNDTSMGBT5ANCNFSM4SKDZZOA>.
|
* Fix circular import (`ImportError: cannot import name 'Model' from partially initialized module 'mip' (most likely due to a circular import)`) * Fix logic for setting `mip.gurobi.found` flag
c7e68e2
to
ea825fb
Compare
ea825fb
to
9b33783
Compare
Actually, the Black errors were introduced by me. Now fixed. |
* Fix logical errors in Gurobi check * Fix circular import (`ImportError: cannot import name 'Model' from partially initialized module 'mip' (most likely due to a circular import)`) * Fix logic for setting `mip.gurobi.found` flag * Provide useful exception if gurobi is specifically requested but cannot be found
ImportError: cannot import name 'Model' from partially initialized module 'mip' (most likely due to a circular import)
)mip.gurobi.found
flag