Hello Marc, in the callback function you can use glp_ios_terminate(tree) to stop the branch and bound search.
In the terminal listener or in the callback function you can use function glp_error to abort GLPK. You should use glp_error_hook to safely exit glp_intopt. This is the coding I use in GLPK for Java for this purpose: ... jmp_buf glp_java_env; if (setjmp(glp_java_env)) { printf "function glp_intopt failed"); } else { glp_error_hook(glp_java_error_hook, &glp_java_env); glp_intopt(...); } glp_error_hook(NULL, NULL); ... void glp_java_error_hook(void *in) { /* free GLPK memory */ glp_free_env(); /* safely return */ longjmp(*((jmp_buf*)in), 1); } Best regards Xypron -------- Original-Nachricht -------- > Datum: Mon, 10 Sep 2012 16:05:49 -0400 > Von: Marc Goetschalckx <marc.goetschal...@isye.gatech.edu> > An: GLPK help <help-glpk@gnu.org> > Betreff: [Help-glpk] Aborting a long-running algorithm in GLPK > Is there a way to safely signal a long running algorithm (glp_intopt) to > stop executing and clean up memory and to terminate operation from > outside the function call for the API. This would be similar to > pressing CTRL+C during the operation of glpsol. What I need is > different from setting the execution time limit before an long-running > operation has started. > Thanks > > -- > Marc Goetschalckx > Industrial and Systems Engineering > Georgia Institute of Technology, Atlanta, GA, USA > > > _______________________________________________ > Help-glpk mailing list > Help-glpk@gnu.org > https://lists.gnu.org/mailman/listinfo/help-glpk _______________________________________________ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk