set_var_branch

Specifies, for the specified variable, which branch to take first in branch-and-bound algorithm.

int set_var_branch(lprec *lp, int column, short branch_mode);

Return Value

set_var_branch 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_file, read_LP, read_mps, read_MPS

column

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

branch_mode

Specifies, for the specified variable, which branch to take first in branch-and-bound algorithm.
Can by any of the following values:

BRANCH_CEILING (0) Take ceiling branch first
BRANCH_FLOOR (1) Take floor branch first
BRANCH_AUTOMATIC (2) Algorithm decides which branch being taken first
BRANCH_DEFAULT (3) Use the branch mode specified with set_floor_first

Remarks

The set_var_branch function specifies which branch to take first in branch-and-bound algorithm. This can influence solving times considerably. Depending on the model one rule can be best and for another model another rule.
The default is BRANCH_DEFAULT (3). BRANCH_DEFAULT (3) means that the branch mode specified with set_floor_first function must be used.

Example

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

int main(void)
{
  lprec *lp;

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

  set_var_branch(lp, 1, BRANCH_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, get_var_branch, set_floor_first, get_floor_first, set_varweights, get_varpriority