set_splitnegvars

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

void set_splitnegvars(lprec *lp, short splitnegvars);

Return Value

set_splitnegvars has no return value.

Parameters

lp

splitnegvars

Specifies 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)

Remarks

The set_splitnegvars function specifies 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;

/* 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_splitnegvars(lp, TRUE);

delete_lp(lp);
return(0);
}
``````