Specifies the branch-and-bound rule.

void set_bb_rule(lprec *lp, int bb_rule);

Return Value

set_bb_rule has no return value.



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


The branch-and-bound rule. Can by any of the following values:

NODE_FIRSTSELECT (0) Select lowest indexed non-integer column
NODE_GAPSELECT (1) Selection based on distance from the current bounds
NODE_RANGESELECT (2) Selection based on the largest current bound
NODE_FRACTIONSELECT (3) Selection based on largest fractional value
NODE_PSEUDOCOSTSELECT (4) Simple, unweighted pseudo-cost of a variable
NODE_PSEUDONONINTSELECT (5) This is an extended pseudo-costing strategy based on minimizing the number of integer infeasibilities
NODE_PSEUDORATIOSELECT (6) This is an extended pseudo-costing strategy based on maximizing the normal pseudo-cost divided by the number of infeasibilities. Effectively, it is similar to (the reciprocal of) a cost/benefit ratio

One of these values may be or-ed with one or more of the following values:

NODE_WEIGHTREVERSEMODE (8) Select by criterion minimum (worst), rather than criterion maximum (best)
NODE_BRANCHREVERSEMODE (16) In case when get_bb_floorfirst is BRANCH_AUTOMATIC, select the oposite direction (lower/upper branch) that BRANCH_AUTOMATIC had chosen.
NODE_PSEUDOCOSTMODE (64) Toggles between weighting based on pseudocost or objective function value
NODE_DEPTHFIRSTMODE (128) Select the node that has already been selected before the most number of times
NODE_RANDOMIZEMODE (256) Adds a randomization factor to the score for any node candicate
NODE_GUBMODE (512) Enables GUB mode. Still in development and should not be used at this time.
NODE_DYNAMICMODE (1024) When NODE_DEPTHFIRSTMODE is selected, switch off this mode when a first solution is found.
NODE_RESTARTMODE (2048) Enables regular restarts of pseudocost value calculations
NODE_BREADTHFIRSTMODE (4096) Select the node that has been selected before the fewest number of times or not at all
NODE_AUTOORDER (8192) Create an "optimal" B&B variable ordering. Can speed up B&B algorithm.
NODE_RCOSTFIXING (16384) Do bound tightening during B&B based of reduced cost information
NODE_STRONGINIT (32768) Initialize pseudo-costs by strong branching


The set_bb_rule function specifies the branch-and-bound rule for choosing which non-integer variable is to be selected. This rule can influence solving times considerably. Depending on the model one rule can be best and for another model another rule.


#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.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");

  set_bb_rule(lp, NODE_FIRSTSELECT);


lp_solve API reference

See Also make_lp, copy_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_bb_rule, put_bb_nodefunc