get_splitnegvars

Returns if negative variables must be split into a positive and negative part.

short get_splitnegvars(lprec *lp);

Return Value

get_splitnegvars returns if negative variables must be split into a positive and negative part. Can be any of the following values:

TRUE (1) Negative variables are split.
AUTOMATIC (2) Negative variables are only split if they are free (lower bound -infinity, up bound infinity)

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

Remarks

The get_splitnegvars function returns if negative variables must be split into a positive and negative part. The simplex algorithm can't handle negative variables. Variables are always >= 0. However there are 'tricks' to overcome this 'limitation'. One way is split the variable in two. A positive part and a negative part. The disadvantage is that the model becomes bigger resulting in slower solving times. Another way is doing a substitution of the variable into another one that is always positive. There is no extra column needed and thus solving times are not bigger then. When splitnegvars is set to AUTOMATIC then lp_solve tries to do a substitution whenever possible. When set to TRUE then lp_solve does a split if the bound is smaller than the value specified with set_negrange, else is does the substitution.
The default value is AUTOMATIC.

Example

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

int main(void)
{
  lprec *lp;
  short splitnegvars;

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

  splitnegvars = get_splitnegvars(lp); /* Will be 2 (AUTOMATIC) */

  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_splitnegvars, set_negrange, get_negrange