help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Aborting a long-running algorithm in GLPK


From: glpk xypron
Subject: Re: [Help-glpk] Aborting a long-running algorithm in GLPK
Date: Tue, 11 Sep 2012 09:39:36 +0200

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 <address@hidden>
> An: GLPK help <address@hidden>
> 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
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]