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

Wish to add model.interrupt()/terminate() to api #217

Open
loongmxbt opened this issue Jan 17, 2024 · 2 comments
Open

Wish to add model.interrupt()/terminate() to api #217

loongmxbt opened this issue Jan 17, 2024 · 2 comments

Comments

@loongmxbt
Copy link

In some cases, when solving a certain MIP problem, the solver may become slow. If the solver is called through an API request, it is not possible to directly stop the process using Ctrl+C. Instead, the interrupt feature of the solver itself needs to be used. Time Limit can be used to terminate models. However, if the solution time of the model ranges from 20 seconds to 1 hour, and the length of the solution time is not known in advance, it is difficult to control it through time limit.

Gurobi
https://www.gurobi.com/documentation/current/refman/py_model_terminate.html
COPT
https://guide.coap.online/copt/zh-doc/pyapiref.html#model-interrupt
Cplex
https://www.ibm.com/docs/en/icos/22.1.0?topic=users-example-complex-termination-criteria-in-callback

@FabianHofmann
Copy link
Collaborator

Thanks for raising this @loongmxbt. What do you have in mind as a command? If the model is being solved, the python shell cannot be accessed. So it would not make sense to have a model.interrrupt() call, right? Perhaps a ctrl+c call would be more suitable?

@loongmxbt
Copy link
Author

Thanks for your reply, I have now bypassed this problem through other methods.
I think this may be a feature for C/S application. If the client side send a calculation task, the server side consumes the task and begin the calculation. Thus the client side cannot terminate the task directly, the client side may send another api call to terminate cplex/gurobi and the task it self. We know sometimes the calculation may stuck at some point.
Pretty much like the repo here: https://github.com/AlexKressner/OptiDeploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants