set_timeout

Set a timeout.

void set_timeout(lprec *lp, long sectimeout);

Return Value

set_timeout has no return value.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI

sectimeout

The number of seconds after which a timeout occurs. If zero, then no timeout will occur.

Remarks

The set_timeout function sets a timeout in seconds. The solve and lag_solve functions may not last longer than this time or the routines return with a timeout. The default timeout is 0, resulting in no timeout.
If a timout occurs, but there was already an integer solution found (that is possibly not the best), then solve will return SUBOPTIMAL. If there was no integer solution found yet or there are no integers or the solvers is still in the first phase where a REAL optimal solution is searched for, then solve will return TIMEOUT.

Example

#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"

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);
  }

  set_timeout(lp, 600); /* sets a timeout of 600 seconds (10 minutes) */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_timeout, time_elapsed, solve, lag_solve