Unable to stop run
AnsweredHi,
I'm trying to stop a run (since the model takes too long to solve and the solution doesn't improve), but I want to keep whatever solution the model finds so far. However, when I click the stop button, I receive the following error:
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
File ~\.conda\envs\sofi_dev\lib\site-packages\ipykernel\iostream.py:502, in OutStream.write(self, string)
498 content = {'name':self.name, 'text':data}
499 self.session.send(self.pub_thread, 'stream', content=content,
500 parent=self.parent_header, ident=self.topic)
--> 502 def write(self, string: str) -> int:
503 """Write to current stream after encoding if necessary
504
505 Returns
(...)
509
510 """
512 if not isinstance(string, str):
KeyboardInterrupt:
Exception ignored in: 'gurobipy.logcallbackstub'
Traceback (most recent call last):
File "C:\Users\Sergio\.conda\envs\sofi_dev\lib\site-packages\ipykernel\iostream.py", line 502, in write
def write(self, string: str) -> int:
KeyboardInterrupt:
What is interesting is that I've been able to stop runs before from one computer, but now on other computers is not stopping. Could you please help figure out if there is anything I should install or adjust in the settings?
Thank you,
Sofia
-
Hi Sofia,
What is interesting is that I've been able to stop runs before from one computer, but now on other computers is not stopping.
What exactly do you mean by stopping here? Do you mean pressing "CTRL+C" or are you using some 3rd party software to execute Gurobi and press the "STOP" buttom from the GUI of the 3rd party software? Note that it not possible to retrieve any solution information if you just cancel the optimization by "CTRL+C". It is also possible that the 3rd party software does not correctly terminate Gurobi, such that it cannot terminate gracefully and all solution information is lost.
You should try setting a TimeLimit for all your optimization runs. This way, you avoid situations where the optimization would run too long. You could also implement an own callback where you check for the current mipgap and/or runtime and terminate the optimization process. Note that you have to compute the current mipgap on your own using the best obj and best bound information in a a callback and applying the formula given in MIPGap.
Best regards,
Jaromił0 -
Hi Jaromił,
What I mean is to stop the run by clicking on the stop button of the Jupiter Lab window. When I've done it in this computer that works, it tops the optimization process and provides the corresponding results. I just would like to know why can I do this on one computer and not on another ones.
In the meantime, I'll take a look at the alternatives you provided.
Thank you,
Sofia
0 -
Hi Sofia,
What I mean is to stop the run by clicking on the stop button of the Jupiter Lab window. When I've done it in this computer that works, it tops the optimization process and provides the corresponding results. I just would like to know why can I do this on one computer and not on another ones.
There are many possibilities what may be causing the different behavior. Different software version, different OS, the exact moment at which you press the "stop button". In general, it is not guaranteed that you can retrieve information from Gurobi after killing a running process in a 3rd party software.
Best regards,
Jaromił-1
Please sign in to leave a comment.
Comments
3 comments