set_semicont

Set the type of the variable. semi-continuous or not.

unsigned char set_semicont(lprec *lp, int column, unsigned char must_be_sc);

Return Value

set_semicont 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_sc

TRUE (1) if the variable must be semi-continuous, FALSE (0) if not.

Remarks

The set_semicont function defines if a variable is semi-continuous or not. By default, a variable is not semi-continuous. The argument must_be_sc defines what the status of the variable becomes.
Note that a semi-continuous variable must also have a lower bound to have effect. This because the default lower bound on variables is zero, also when defined as semi-continuous, and without a lower bound it has no point to define a variable as such. The lower bound may be set before or after setting the semi-continuous status. See semi-continuous variables for a description about semi-continuous 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_lowbo(lp, 1, 2.0);
  set_semicont(lp, 1, TRUE); /* sets variable 1 to semi-continuous */

  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_semicont, set_lowbo