set_int

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

unsigned char set_int(lprec *lp, int column, unsigned char must_be_int);

Return Value

set_int returns TRUE (1) if the operation was successful. A return value of FALSE (0) indicates an error.

Parameters

lp

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

column

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

must_be_int

TRUE (1) if the variable must be integer, FALSE (0) if not.

Remarks

The set_int function defines if a variable must be integer or not. Default a variable is not integer. The argument must_be_int defines what the status of the variable becomes. 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. See integer variables for a description about integer variables.

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, 2);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  set_int(lp, 1, TRUE); /* sets variable 1 to integer */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, is_int, is_binary, set_binary