Skip to contents

BranchAndBound() solves an OptimizationProblem() whose unknowns include integers (Variable("n", integer = TRUE)) or binaries (binary = TRUE, bounds 0 and 1) by branch and bound over the continuous relaxation, the method of the Juniper solver that Optimization.jl reaches through OptimizationMOI. Each node solves the relaxation with the bounds of its branch; a node whose relaxed objective is no better than the best integer point found is pruned, and otherwise the most fractional integer unknown is branched on. It is the default for problems with integer unknowns.

Usage

BranchAndBound(
  relaxation = NULL,
  max_nodes = 1000L,
  int_tol = 1e-06,
  ctol = 1e-06
)

Arguments

relaxation

The algorithm for the relaxations; AugLag() for problems with constraints and LBFGSB() otherwise when NULL.

max_nodes

Largest number of relaxations to solve.

int_tol

Distance to the nearest integer below which a value counts as integral.

ctol

Largest constraint violation of an accepted point.

Value

An algorithm object.

Details

The relaxations are solved by local methods, so the result is the global optimum when the relaxed problem is convex (for example a convex cost with linear constraints); otherwise it is a good integer point but not guaranteed optimal.

Examples

x <- Variable("x", integer = TRUE, bounds = c(-10, 10)); y <- Variable("y")
sys <- complete(System(list(), costs = list((x - 2.6)^2 + (y - 1.3)^2), name = "intq"))
sol <- solve(OptimizationProblem(sys, list(x ~ 0, y ~ 0)), BranchAndBound())
sol$u
#>   y   x 
#> 1.3 3.0