-
Notifications
You must be signed in to change notification settings - Fork 95
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
Visual Code Python debugging tool crashes when trying to access "Model" object attributes before optimization #26
Comments
Hello Otávio !
Currently we throw an exception when an specific property of a variable
(the solution value x) is accessed, since the debugger is probably trying
to access all properties we have this problem...
I think that the behaviour could be changed to just return None as
solution value when no optimization is performed. I'll include this change
in the next release.
Cheers,
Haroldo
…--
=============================================================
Haroldo Gambini Santos
Computing Department
Universidade Federal de Ouro Preto - UFOP
email: haroldo@ufop.edu.br
Haroldo.GambiniSantos@cs.kuleuven.be
home/research page: www.decom.ufop.br/haroldo
It has long been an axiom of mine that the little things are infinitely
the most important.
-- Sir Arthur Conan Doyle, "A Case of Identity"
On Wed, 20 Nov 2019, Otávio Augusto Silva wrote:
Consider the following code to model the maximum independent set problem to
solve the maximum clique using MIP and NetworkX:
import mip
import networkx
n = 2 ** 3
g = networkx.binomial_tree(n)
networkx.add_star(g, [i for i in range(n)])
g1 = networkx.complement(g)
model = mip.Model("Independent Set")
x = [model.add_var(var_type=mip.BINARY) for _ in range(len(g1.nodes))]
model.objective = mip.maximize(mip.xsum(x[i] for i in range(len(g1.nodes))))
for (i, j) in g1.edges:
model += x[i] + x[j] <= 1
model.optimize()
selected = [i for i in range(len(g1.nodes)) if x[i].x >= 0.99]
print(selected)
g2 = g.subgraph(selected)
If I try to access the model variables in the watch section, it gives he
following message on terminal:
Information not available, model was not optimized yet.
And then, the debugger dies. I believe this is not what should happen, some
help with this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, orunsubscribe.[AB4VZOQHN473EXM6FJ7JUZTQUXXB5A5CNFSM4JP4AJ72YY3PNVWWK3TUL52HS4D
FUVEXG43VMWVGG33NNVSW45C7NFSM4H27DLLQ.gif]
|
Thanks for the feedback, glad to see this issue being addressed! |
should be fixed in 1.6, could you please check ? |
I updated MIP and checked yesterday and the same behaviour continues |
Strange, which attribute triggered the exception ?
Em dom, 1 de dez de 2019 12:19, Otávio Augusto Silva <
notifications@github.com> escreveu:
… I updated MIP and checked yesterday and the same behaviour continues
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#26?email_source=notifications&email_token=AB4VZOQK2ZYDTE23K6WU2NDQWPIZFA5CNFSM4JP4AJ72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFRMDPQ#issuecomment-560120254>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4VZOQ3JXGR3ED2KOIFJITQWPIZFANCNFSM4JP4AJ7Q>
.
|
I'm not sure, Visual Code shows my all attributes of the object, but I can't see any because the debugger dies before anything shows up. Not sure if relevant, but the same thing happens on Jupyter notebooks, if I use the tab key to show the attributes of the object, the kernel also dies. |
The object that you tried to inspect in the debugger is a variable ? Right now (1.6) no exception is thrown while querying variable contents, so I don't know where to look |
It is, in my example code it's the |
Hi @otavio-silva , could you provide your code (or better, an small example) where it happens so that I can check if this is solved ? |
@h-g-s here's an example modelling the 0-1 Knapsack problem:
If I try to inspect the |
Hi @otavio-silva, |
Sorry for the delay, here's the info:
|
Hi @otavio-silva , just released 1.6.5. There was a case when dual information was being queried when it was not available that was fixed. Maybe this is the cause of your crash. Could you test it ? |
I just tested it @h-g-s, and it still gives the same error, sadly. |
hi @otavio-silva , just released 1.6.6 with a fix that may be related to this problem: querying the objective function without optimizing was crashing. Now it returns None if no solution is available. Could you please check again ? |
I just tested it with the new version, there's still something causing crashes. |
Consider the following code to model the maximum independent set problem to solve the maximum clique using MIP and NetworkX:
If I try to access the
model
variables in thewatch
section, it gives he following message on terminal:And then, the debugger dies. I believe this is not what should happen, some help with this?
The text was updated successfully, but these errors were encountered: