Skip to contents

A step of the miprgr_native implementation. No other function in the package calls it. See the file header for the source the module follows.

Usage

miprgr_branch_and_bound(
  A,
  b,
  c,
  integer_vars,
  maximise = TRUE,
  prune = TRUE,
  max_nodes = 5000,
  solver = "simplex"
)

Arguments

A

Passed to miprgr_solve_relaxation.

b

Passed to miprgr_solve_relaxation.

c

A vector; its length is taken.

integer_vars

Coerced to integer by the body, with as.integer.

maximise

A flag; the body branches on it. Defaults to TRUE.

prune

A flag; the body branches on it. Defaults to TRUE.

max_nodes

Coerced to integer by the body, with as.integer. Defaults to 5000.

solver

Passed to miprgr_solve_relaxation. Defaults to "simplex".

Value

A list with estimate, value, x, feasible, nodes, pruned, pruning, max_list_length, root_bound, truncated, method, note.

Examples

# maximise 5 x1 + 4 x2 subject to 6 x1 + 4 x2 <= 24, x1 + 2 x2 <= 6, integer x
A <- matrix(c(6, 4, 1, 2), 2, byrow = TRUE)
r <- miprgr_branch_and_bound(A, b = c(24, 6), c = c(5, 4), integer_vars = c(1, 2))
c(r$value, r$x)
#> [1] 20  4  0