help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Re: intercepting errors in glpk


From: Andrew Makhorin
Subject: [Help-glpk] Re: intercepting errors in glpk
Date: Tue, 04 Feb 2003 16:43:45 +0300

>i'm trying to detect errors while using glpk routines.
>When something is wrong, the program merely exits
>without informing me about the origin of the problem.
>There is a way to avoid this?

In case of error all glpk library routines call the routine fault,
which prints a diagnostic message and then abnormally terminates the
program. To change this default behavior you should use the routine
lib_set_fault_hook (it is not documented, so for details please see
comments given in the file glplib2.c). Note that if a fatal error
happens, independently on whether you hooked your own error handler to
prevent abnormal termination or not, *all* glpk objects become invalid,
so you cannot use, for example, LPX object(s) created before. If, in
case of fatal error, you also need to free all resources currently used
by glpk, i.e. memory and file descriptors (this is important mainly in
interactive applications), you should perform a global go to (longjmp)
from your error handler and then call the routine lib_free_env. Once
glpk environment has been freed by lib_free_env, all returns in its
initial state as if no glpk routines were called.

However, the normal way to prevent crashing is to check all data, which
are suspected to be incorrect, before passing them to glpk routines.





reply via email to

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