is_int

Gets the type of the variable. Integer or floating point.

int is_int(lprec *lp, int column);

Return Value

is_int returns TRUE (1) if the variable is set as integer, FALSE (0) otherwise.

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

column

The column number of the variable that must be checked. It must be between 1 and the number of columns in the lp.

Remarks

The is_int function returns if a variable must be integer or not. Default a variable is not integer. From the moment there is at least one integer variable in the model, the Branch and Bound algorithm is used to make these variables integer. Note that solving times can be considerably larger when there are integer variables.

Example

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

int main(void)
{
  lprec *lp;
  int integer;

  /* Create a new LP model */
  lp = make_lp(0, 2);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  integer = is_int(lp, 1); /* will return 0 since the variable is not set as integer at this point */

  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, set_int