← Optimization theory
PART 4 · 15 Optimization theory · 04

Integer Programming

Optimizing problems where decisions must be whole numbers

Integer constraintsThe rounding trapBinary variablesKnapsack problemBranch and boundCutting planes

8/3 units?Best integer (2, 3)3.5 employees,2.4 vehicles?No such thing→ Choose from the grid points

How do you optimize problems where the decision has to be a whole number, such as the number of products, employees or vehicles? Linear programming (Ch. 02) assumes decision variables can take continuous values, so it can produce solutions with decimals, such as 2.5 units or 3.7 people.

SECTION 01

What is integer programming?

Employees

You can’t hire 3.5 people.

Delivery vehicles

You can’t deploy 2.4 vehicles.

Production equipment

You can’t buy 1.7 machines.

An optimization method that adds the condition that decision variables must be integers like this is called integer programming (IP). If the objective function and constraints stay linear and only the integer condition is added, it is linear integer programming.

SECTION 02

Why does the integer condition matter?

The optimal solution of the production planning model (Ch. 02) was x = y = 8/3. Mathematically it is a valid solution, but if products are made only as finished units, you can’t carry it out as is. Integer programming adds the following condition.

max Z = 60x + 100y   s.t.   x + 2y ≤ 8,   2x + y ≤ 8,   x, y ∈ ℤ≥0
ℤ≥0: the set of non-negative integers, including 0
010020030040060160260360120220320420180280380240LP optimum (8/3, 8/3) · $426.67Rounded (3, 3) · infeasibleBest integer (2, 3) · $420Rounded down (2, 2) · $320001122334455Units of product A, xUnits of product B, yBlack dots = integer feasible points(number = profit, $)
Figure 1. Integer feasible solutions and the rounding trap

As Figure 1 shows, the only possible solutions now are the grid points inside the feasible region. Rounding the LP solution (8/3, 8/3) to (3, 3) needs 9 hours in both processes, so it is infeasible; rounding down to (2, 2) is feasible, but its profit of $320 isn’t the best. Rounding the continuous optimal solution can’t guarantee the integer optimal solution.

SECTION 03

Finding the optimal solution in integer programming

Product A (x)Product B (y)Total profitFeasible?
04$400Feasible
23$420Feasible
32$380Feasible
40$240Feasible
14$460Infeasible (process 1: 1 + 2(4) = 9 hours)

The best integer combination is 2 of product A and 3 of product B, with Z = 60(2) + 100(3) = $420. That is slightly lower than the optimal profit of linear programming with continuous variables (about $426.67). Adding the integer condition narrows the range of solutions you can choose from, so the optimal value of an integer program can’t exceed the LP optimal value of the same problem. This difference (here, $6.67) is called the integrality gap.

SECTION 04

Three types of integer programming

① Pure integer programming

A model in which every decision variable must be an integer
Examples: production quantities, number of employees, number of vehicles

② Mixed-integer programming

A model in which some variables are integers and the rest are continuous
Example: whether to install equipment (integer) and production quantity (continuous) — Ch. 05

③ Binary integer programming

A model in which variables can only be 0 or 1
Example: 1 if a project is chosen, 0 if not

SECTION 05

Expressing selection problems with binary variables

Integer programming can also turn the choice itself into a variable. Suppose a company wants to pick some of three projects, and its total budget is $14,000.

ProjectExpected profitBudget needed
A$16,000$8,000
B$12,000$6,000
C$10,000$4,000
max Z = 16xA + 12xB + 10xC   s.t.   8xA + 6xB + 4xC ≤ 14,   xA, xB, xC ∈ {0, 1}
Amounts in thousands of dollars
010203040A + B + C (budget 18)38 · over budgetA + B (budget 14)28A + C (budget 12)26B + C (budget 10)22A (budget 8)16B (budget 6)12C (budget 4)10None chosen (budget 0)0Total profit of the 8 project combinations ($ thousands) · only budget ≤ $14,000 is feasible · purple = optimal
Figure 2. Project selection expressed with binary variables

Figure 2 lists all 8 possible combinations. Choosing A and B uses a budget of $14,000 for a profit of $28,000; A and C uses $12,000 for $26,000; B and C uses $10,000 for $22,000. Doing all three projects would need a budget of $18,000, so it is infeasible. The optimal choice is therefore A and B. This structure is called the knapsack problem, and it shows up all over: investment planning, project selection, facility location, choosing ad campaigns and more.

If you relax the integer condition (allowing any real number between 0 and 1), the optimal solution is 0.5 of A and 1 each of B and C, for a profit of $30,000. It amounts to packing C and B, which have the highest efficiency (profit/budget), first and filling the remaining budget with half of A; rounding this down to pick only B and C gives $22,000, far below the optimum ($28,000). In selection problems, the rounding trap gets even bigger.

SECTION 06

How is integer programming solved?

In linear programming you could find the optimal solution at a vertex, but in integer programming not every point in the continuous feasible region is allowed, so the computation is more complex. As the number of variables grows, the number of possible combinations explodes, and you can’t even list them all.

Branch and bound

① Relax

Temporarily drop the integer condition and solve the LP. Its value is an upper bound on the integer optimum.

② Branch

Split the problem in two on a variable that isn’t an integer (e.g. x ≤ 2 and x ≥ 3).

③ Bound

Solve each subproblem and check its objective value and feasibility.

④ Prune

Drop any subproblem that can’t beat the best integer solution found so far.

① Relaxed LP (no integers)(8/3, 8/3) · Z = 426.67 → boundx ≤ 2x ≥ 3② Subproblem x ≤ 2(2, 3) · Z = 420 · integer!③ Subproblem x ≥ 3(3, 2) · Z = 380 · integerCurrent best (incumbent) = 420380 < 420 → prune (drop)Done after two branches: integer solution 420 found under the bound 426.67; the other branch can’t do better, so it isn’t explored
Figure 3. The search tree of branch and bound

In Figure 3, the solution of the LP with the integer condition dropped has x = 8/3, which isn’t an integer, so we split into x ≤ 2 and x ≥ 3. The LP solution of the left problem, (2, 3), is already an integer, so its profit of 420 becomes the incumbent best solution; the best of the right problem (380) is smaller, so it isn’t explored further. In this way, branch and bound doesn’t blindly enumerate every integer combination; it cuts away regions that have no chance of containing the optimal solution.

Cutting plane method

This method narrows the feasible region step by step by adding extra constraints (cuts) that rule out solutions that don’t satisfy the integer condition. It adds constraints that shave off only fractional vertices without cutting away a single integer grid point, so the LP solution moves closer to an integer one. Real optimization software combines both methods with heuristics.

SECTION 07

Where integer programming is used

FieldDecision problem
Production managementDeciding how many of each product to make
Workforce managementNumber of employees and shift scheduling
LogisticsNumber of vehicles, delivery plans, route choice
InvestmentProject selection and budget allocation
Facility locationDeciding where to put distribution centers or stores
MarketingCampaign mix and allocating a limited budget
Public policyChoosing program targets and support programs

Because binary variables express whether something is chosen, they are especially useful for problems where you pick some of several alternatives or allow a decision only under certain conditions.

Sample write-up

Solving an integer programming model that restricts production to whole units with branch and bound, profit was maximized at $420 by producing 2 of product A and 3 of B. This is $6.67 lower than the LP optimal value with the integer condition relaxed (1280/3 ≈ $426.67), and (3, 3), the rounded LP solution, violated the process time constraints. In the project selection problem with a $14,000 budget, profit was maximized at $28,000 by choosing A and B.

✓ KEY TAKEAWAYS

With an integer condition, don’t round: search again among the integer solutions.


Up next: 05 Mixed-Integer Programming. We’ll look at how to handle integer and continuous variables together in one model, such as whether to install equipment and how much to produce.