put_abortfunc
Sets a abort routine.
void put_abortfunc(lprec *lp, abortfunc newabort,
void *aborthandle);
Return Value
put_abortfunc has no return value.
Parameters
lp
Pointer to previously created lp model. See return value of
make_lp, copy_lp, read_lp,
read_lp_file, read_LP, read_mps, read_MPS
newabort
The abort routine.
typedef int WINAPI abortfunc(void *lp, void *userhandle);
WINAPI is only applicable when lp_solve is compiled as windows dll.
aborthandle
A parameter that will be provided to the abort routine.
Remarks
The put_abortfunc function sets a abort routine.
When set, the abort routine is called regularly. The user can do whatever he
wants in this routine. For example check if the user pressed abort. The return
value of this routine must be FALSE (0) or TRUE (1). If TRUE (1), then lp_solve
aborts the solver and returns with an appropriate code. The abort routine can
be cleared by specifying NULL as abort routine.
The default is no abort routine (NULL).
Example
#include <stdio.h>
#include <stdlib.h>
#include "lpkit.h"
int abortfunction(void *lp, void *userhandle)
{
int doabort = FALSE;
/* do something */
return(doabort);
}
int main(void)
{
lprec *lp;
/* Create a new LP model */
lp = make_lp(0, 0);
if(lp == NULL) {
fprintf(stderr, "Unable to create new LP model\n");
return(1);
}
put_abortfunc(lp, abortfunction, NULL);
solve(lp);
delete_lp(lp);
return(0);
}
lp_solve API reference
See Also make_lp, copy_lp,
read_lp, read_lp_file, read_LP, read_mps,
read_MPS, put_logfunc
|