Sets the maximum branch-and-bound depth.

void set_bb_depthlimit(lprec *lp, int bb_maxlevel);

Return Value

set_bb_depthlimit 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


Specifies the maximum branch-and-bound depth. A positive value means that the depth is absoluut. A negative value means a relative B&B depth limit. The "order" of a MIP problem is defined to be 2x the number of binary variables plus the number of SC and SOS variables. A relative value of -x results in a maximum depth of x times the order of the MIP problem.


The set_bb_depthlimit function sets the maximum branch-and-bound depth.
This is only useful if there are integer, semi-continious or SOS variables in the model so that the branch-and-bound algorithm must be used to solve them. The branch-and-bound algorithm will not go deeper than this level. When 0 then there is no limit to the depth. Limiting the depth will speed up solving time, but there is a chance that the found solution is not the most optimal one. Be aware of this. It can also result in not finding a solution at all.
The default is -50.


#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_depthlimit(lp, 10);


lp_solve API reference

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