About the branch and bound method
What is branch and bound?
Branch and bound solves integer linear programs, in which some or all variables must take whole-number values. Dropping the integrality requirements gives the LP relaxation, an ordinary linear program that the simplex method solves quickly. Its optimum is at least as good as any integer solution, so it is a bound: an upper bound when maximizing, a lower bound when minimizing.
If the LP optimum gives a fractional value v to an integer variable xⱼ, the problem is split into two subproblems, one with xⱼ ≤ ⌊v⌋ and one with xⱼ ≥ ⌈v⌉. Every integer solution lies in exactly one of them, and the fractional point lies in neither. Repeating this split builds the branch and bound tree.
When is a node fathomed?
A node needs no further branching (it is fathomed) in three cases. Its LP is infeasible, so the subproblem has no solution at all. Its LP optimum is already integer where required, so it is a candidate; if it beats the best solution found so far, the incumbent, it becomes the new incumbent. Or its LP value is not better than the incumbent, so nothing below it can win: it is fathomed by bound.
When the last waiting node is fathomed, the incumbent is optimal. If no incumbent was ever found, the integer program is infeasible.
Depth-first or best bound?
The search order changes how many nodes are solved, never the optimal value. Depth-first search always continues from the deepest waiting node, so it reaches an integer solution quickly and keeps few nodes open; that early incumbent then prunes the rest of the tree. Best bound always expands the waiting node with the best LP value; it never branches a node whose value is worse than the optimum, but it may find its first incumbent late.
The branching variable matters too. First fractional takes the lowest-numbered integer variable with a fractional value, as most textbooks do. Most fractional takes the one whose fractional part is closest to 1/2. Try both rules on the same problem and compare the trees.
Why not just round the LP solution?
Rounding the LP optimum is tempting but unreliable. The rounded point can break a constraint, and even when it is feasible it can be far from the best integer solution. The result panel shows what rounding gives for your problem. Branch and bound, by contrast, proves optimality: every integer point is either examined or ruled out by a bound.
Mixed integer and 0-1 problems
In a mixed integer program only some variables must be integer. Branch and bound branches only on those; the continuous variables keep the values the LP gives them. Click a variable under the constraints to switch it between integer and continuous.
A 0-1 (binary) variable is an integer variable with the extra constraint xⱼ ≤ 1. The knapsack example uses four of them to decide which items to pack.
How this calculator works
Every LP relaxation is solved with the two-phase simplex method in exact fraction arithmetic, so there are no rounding errors and no tolerance for “almost integer” values. As in many textbooks, both children of a node are solved as soon as they are created, so every node in the tree shows its LP value. Ties between waiting nodes are broken by node number, so the same problem always gives the same tree. Problems can have up to 8 variables and 8 constraints; the search stops after 400 nodes.
Frequently asked questions
What is the LP relaxation of an integer program?
The same problem with the integrality requirements removed. Its feasible region contains every integer solution, so its optimal value bounds the integer optimum: from above for a maximization problem, from below for a minimization problem.
What does “fathomed by bound” mean?
A node is fathomed by bound when its LP value is not better than the incumbent, the best integer solution found so far. Adding bounds can only make the LP value worse, so no solution below that node can beat the incumbent and its whole subtree is skipped.
Why does my textbook get a different tree?
Trees differ when the rules differ: which waiting node is expanded next, which fractional variable is branched on, whether children are solved when they are created or when they are selected, and how ties are broken. The optimal value is always the same (when there are several optimal solutions, the one reported can differ). Switch between depth-first and best bound, and between first and most fractional, to match your course.
Does branch and bound always find the optimum?
Yes, when the feasible region of the LP relaxation is bounded: then there are finitely many integer points, and each one stays in some branch until it is examined or ruled out by a bound. Integer programming is NP-hard, though, so the tree can grow exponentially; this calculator stops after 400 nodes and reports the best solution found.
How do I enter a 0-1 (binary) variable?
Keep the variable integer and add the constraint xⱼ ≤ 1. The knapsack example does this for four items: xⱼ = 1 packs item j and xⱼ = 0 leaves it out.
What happens when the LP relaxation is unbounded?
Then the root gives no bound to compare against, and the integer program may be unbounded as well. The calculator stops and suggests adding upper bounds on the variables; with them the relaxation is bounded and the search can run.
Can I solve a mixed integer program?
Yes. Click a variable in the Integer variables row to make it continuous. Branch and bound then branches only on the integer variables, and the optimal solution may give fractional values to the continuous ones, as in the mixed example.