Вы находитесь на странице: 1из 31

Intro to Integer Programming

MSCI 603 Section 1


Instructor: Mehrdad Pirnia
Up to now
 We have focused on linear programming with continuous
variables only

 We can expand our modelling capabilities by using integer


or binary variables

2
Intro to Integer Programming
 Same as Linear Programs, but with the addition of integer
requirements

 Types of integer variables:


 General integer: 0, 1, 2, 3, …
 Binary: 0 or 1

 Types of integer programs:


 Pure integer: All variables integer and ≥ 0
 Mixed integer: Some variables restricted to be integer
 Binary: All variables either 0 or 1

3
Example 1:
 Solve the problem graphically:

max z  x1  4 x2
s.t. 6 x1  5 x2  30
 x1  x2  3
2 x1  5 x2  20
x1 , x2  0 and integer

4
Example 1: LP Relaxation Solution
x2 Constraint 1
8
Constraint 2
7
Constraint 3
6

5
LP Optimal Solution: x1 = 0.714286, x2 = 3.714286
4 OFV = 15.57143

0
0 1 2 3 4 5 6 7 8 9 10 11 12
x1
5
Example 1: Rounding the LP Solution
x2 Constraint 1
8
Constraint 2
7
Constraint 3
6 Round up:
x1 = 0.714286  1
5 x2 = 3.714286  4
Solution is infeasible!
4

3 Round down:
x1 = 0.714286  0
2 x2 = 3.714286  3
OFV = 12
1 But is this the optimal all-integer solution?
0
0 1 2 3 4 5 6 7 8 9 10 11 12
x1
6
Example 1: Optimal IP Solution
x2 Constraint 1
8
Constraint 2
7
Constraint 3
6

5
IP Optimal Solution: x1 = 2, x2 = 3
4 z(IP) = 14

3
Recall: z(LP) = 15.57143
2

0
0 1 2 3 4 5 6 7 8 9 10 11 12
x1
7
Relationship between IP and LP
 LP-relaxation solution is always as good as or better than
the IP solution
 E.g. for a max problem: z(IP) ≤ z*(IP) ≤ z*(LP-relaxation)

 No sensitivity report
 Only meaningful for continuous variables
 To perform sensitivity analysis on an IP, must re-solve the
entire model with the changes in question
 IP problems are often extremely sensitive to changes in
parameters

8
Example 2: Capital Budgeting
 Your company is considering investing in several projects that have
varying capital requirements over the next four years. Faced with
limited capital each year, management would like to select the most
profitable projects. The estimated net present value for each project, the
capital requirements, and the available capital over the four-year period
are shown below. Determine the projects that you should invest in to
maximize the net present value of the capital budgeting projects.
Total Capital
Project 1 Project 2 Project 3 Project 4
Available
Present Value $90000 $40000 $10000 $37000

Year 1 Cap Rqmt $15000 $10000 $10000 $15000 $40000

Year 2 Cap Rqmt $20000 $15000 $10000 $50000

Year 3 Cap Rqmt $20000 $20000 $10000 $40000

Year 4 Cap Rqmt $15000 $5000 $4000 $10000 $35000

9
Modeling Techniques
 Logical Constraints
a) Of projects 1, 3, and 4, no more than one can be selected
(mutually exclusive)

b) Of projects 1, 3, and 4, exactly one must be selected

c) Project 4 cannot be selected unless project 3 is also selected


(if project 4 is selected then project 3 must be selected)
(conditional or prerequisite)

d) Project 4 is a anti-requisite for Project 3

10
Example 3: Fixed Charge Problem
 Remington Manufacturing wants to figure out the optimal
way to set up their production based on the following
information.
Hours Required by
Operation Product 1 Product 2 Product 3 Hrs Available
Machining 2 3 6 600
Grinding 6 3 4 300
Assembly 5 6 2 400
Unit Profit $48 $55 $50
Setup Cost $1000 $800 $900

11
Example 4: Set Covering Problem
 There are six cities in the district. The county’s fire department
must determine where to build fire stations. They want to build
the minimum number of fire stations needed to ensure that at
least one fire station is within 15 minutes (driving time) of each
city. The times (in minutes) required to drive between the cities
are shown below.
City 1 City 2 City 3 City 4 City 5 City 6
City 1 0 10 20 30 30 20
City 2 10 0 25 35 20 10
City 3 20 25 0 15 30 20
City 4 30 35 15 0 15 25
City 5 30 20 30 15 0 14
City 6 20 10 20 25 14 0

12
Either-Or Constraints
 Given two conditions of the form
 f1(x1, x2, x3, …, xn) ≤ 0
 f2(x1, x2, x3, …, xn) ≤ 0

 Introduce a new variable and a constant:


 y = 1 if f2(x1, x2, x3, …, xn) ≤ 0 is true; 0 otherwise
 M, a very large number

 Add these constraints to the model:


 f1(x1, x2, x3, …, xn) ≤ My
 f2(x1, x2, x3, …, xn) ≤ M(1 – y)

13
Example 5: Job Sequencing
 A company must complete three jobs. The amounts of processing time
(in minutes) required are shown below. A job cannot be processed on
machine j unless for all i < j the job has completed its processing on
machine i. Once a job begins its processing on machine j, the job
cannot be preempted on machine j. The flow time for a job is the
difference between its completion time and the time at which the job
begins its first stage of processing.
Machine
Job 1 2 3 4
1 20 - 25 30
2 15 20 - 18
3 - 35 28 -

 Formulate an IP whose solution can be used to minimize the average


flow time of the three jobs

14
Knapsack Problems
 An IP with only one constraint is called a knapsack problem

 Problem Setting:
 n items to be packed into one knapsack
 Knapsack capacity = W
 Each item has “weight” wi and benefit bi

 Goal:
 Pack the knapsack such that the total benefit is maximized

15
Solution Methodologies: IP vs LP
 Linear Programs:
 Solution methods are fast and efficient
 Can handle thousands of variables
 Solvability is not highly dependent on problem formulation

 Integer Programs:
 No solution method that performs consistently well on all
problems
 Problems with hundreds of variables can be difficult to solve
 Solvability is highly dependent on problem formulation

16
LP-Relaxation Solution
 Rounding the LP-relaxation solution gives either:
 Infeasible IP solution
 Feasible, but non-optimal, IP solution
 (Optimal IP solution, sometimes….if you’re lucky)

 But LP-relaxation is much easier to solve…


 Can we “enrich” the formulation so that LP-relaxation solution
is integral?

17
Branch-and-Bound: Concept
 Divide and conquer!
 The IP problem is divided into smaller and smaller subproblems until
these subproblems are conquered

 Branching (dividing):
 Partitions the entire set of feasible solutions into smaller and smaller
subsets

 Fathoming (conquering):
 Discards a particular subset when:
 The LP-relaxation solution is integral
 The LP-relaxation problem is infeasible
 The bound indicates that the subset cannot contain the optimal solution

18
Branch-and-Bound:
Bounds and Incumbent Solutions
 The initial LP-relaxation solution (solution at node 0) will
give the best bound for the IP problem
 Max problem: best upper bound
 Min problem: best lower bound

 An incumbent solution is the integer feasible solution that


provides the best known objective function value
 Max problem: provides a lower bound
 Min problem: provides an upper bound

19
Example 1: Using Branch-and-Bound
 Use Branch-and-Bound to solve the following problem:

max z  5 x1  8 x2
s.t. x1  x2  6
5 x1  9 x2  45
x1 , x2  0 and integer

20
Example 1: Node 0

x1  x2  6
z = 41.25
x1 = 2.25, x2 = 3.75

5 x1  9 x2  45

21
Example 1: Nodes 1 & 2 (Branch on x2)

Subproblem 2: x2 ≥ 4

Subproblem 1: x2 ≤ 3

Lecture 11: Branch-and-Bound 22


Example 1: Nodes 3 & 4 (Branch on x1)

Subproblem 3: x1 ≤ 1

Subproblem 4: x1 ≥ 2
Infeasible

Fathomed Subproblem 1

23
Example 1: Nodes 5 & 6
(Branch on x2, again)

Subproblem 6: x2 ≥ 5

Subproblem 5: x2 ≤ 4

Fathomed Subproblem 1

24
Summary of Branch-and-Bound
For each iteration:
 Branching:
 Choose an unfathomed subproblem
 Choose variable xi with non-integer value xi * in the LP solution
of the subproblem
 Create two new subproblems by adding either xi  xi  or
*

xi  xi*  to each subproblem

 Bounding:
 Solve the new subproblems and record their LP solutions
 Based on the LP values, update the incumbent, and the lower
and upper bounds for z*(IP), if necessary
25
Summary of Branch-and-Bound
(continued)
 Fathoming:
 For each new subproblem, apply the three fathoming tests
below. Discard the subproblems that are fathomed.
 Fathoming tests (fathom if any of these are true):
 LP-optimal value of the subproblem worse than the current incumbent
 Subproblem is infeasible
 Optimal solution of the subproblem is integral

 Optimality test:
 If there are no unfathomed subproblems remaining, then the
current incumbent is the optimal solution (if there is no
incumbent, then IP is infeasible)
 Else, perform another iteration

26
B&B on other problem types
 The previous example was a pure integer problem

 For Mixed Integer Problems (MIP)


 Branch only on integer-restricted variables

 For Binary Integer Problems (BIP)


 Branching on binary variable xi will give two subproblems, one
with xi = 0 and the other with xi = 1

27
One more Branch-and-Bound Example

min z  12 x1  11x2
s.t. 4 x1  7 x2  28
5 x1  4 x2  20
x1 , x2  0 and integer

 Use the branch-and-bound algorithm to solve this problem,


branching on x1 first.

28
B&B example:

z = 52.42…
x1 = 1.47, x2 = 3.16

29
NODE 0
Min z = 12x1 + 11x2
s.t. 4x1 + 7x2 ≥ 28
5x1 + 4x2 ≥ 20
x1, x2 ≥ 0

x1 = 1.47, x2 = 3.16, LB = 52.42


Incumbent = 55 (Node 4)

x1 ≤ x1 ≥
NODE 1 1 2 NODE 6
Min z = 12x1 + 11x2 Min z = 12x1 + 11x2
s.t. 4x1 + 7x2 ≥ 28 s.t. 4x1 + 7x2 ≥ 28
5x1 + 4x2 ≥ 20 5x1 + 4x2 ≥ 20
x1 ≤1 x1 ≥2
x1, x2 ≥0 x1, x2 ≥0

x1 = 1, x2 = 3.75, z = x1 = 2, x2 = 2.86, z =
53.25 55.43
Worse than incumbent
x2 ≤ x2 ≥
NODE 2 3 4 NODE 3
Min z = 12x1 + 11x2 Min z = 12x1 + 11x2
s.t. 4x1 + 7x2 ≥ 28 s.t. 4x1 + 7x2 ≥ 28
5x1 + 4x2 ≥ 20 5x1 + 4x2 ≥ 20
x1 ≤1 x1 ≤1
x2 ≤ 3 x2 ≥ 4
x1, x2 ≥0 x1, x2 ≥0

Infeasible x1 = 0.8, x2 = 4, z = 53.6

x1 ≤ x1 ≥
NODE 4 0 1
NODE 5
Min z = 12x1 + 11x2 Min z = 12x1 + 11x2
s.t. 4x1 + 7x2 ≥ 28 s.t. 4x1 + 7x2 ≥ 28
5x1 + 4x2 ≥ 20 5x1 + 4x2 ≥ 20
x1 ≤1 x1 ≤1
x2 ≥ 4 x2 ≥ 4
x1 ≤0 x1 ≥1
x1, x2 ≥0 x1, x2 ≥0

x1 = 0, x2 = 5, z = 55 x1 = 1, x2 = 4, z = 56
Incumbent Worse than incumbent
Next Class
 Network models

31

Вам также может понравиться