get_var_branch

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

int get_var_branch(lprec *lp, int column);

Return Value

get_var_branch returns 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

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 on which the mode must be returned. It must be between 1 and the number of columns in the lp. If it is not within this range, the return value is the value of get_bb_floorfirst

Remarks

The get_var_branch function returns 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.
When no value was set via set_var_branch, the return value is the value of get_bb_floorfirst. It also returns the value of get_bb_floorfirst when set_var_branch was called with branch mode BRANCH_DEFAULT (3).

Example

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

int main(void)
{
  lprec *lp;
  int branch_mode;

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

  branch_mode = get_var_branch(lp, 1); /* will return BRANCH_FLOOR (1), the default branch mode */

  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, set_var_branch, set_bb_floorfirst, get_bb_floorfirst, set_var_weights, get_var_priority