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, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS

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. There is no valid solution at this time. The default timeout is 0, resulting in no timeout.

Example

#include <stdio.h>
#include <stdlib.h>
#include "lpkit.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, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, get_timeout, solve, lag_solve