Lecture 6 Integer Programming (2021)
Lecture 6 Integer Programming (2021)
1
Integer Programming and LP relaxation
IP problems are usually more difficult to solve than LP problems
This is because there are many integer value combinations that
must be tested, and each combination requires a “normal” LP or
NLP solution
LP relaxation from IP is the LP which is obtained by removing all
integer constraints or constraints
E.g. Pure IP problem :
Maximize z = 3x1 + 4x2
subject to 5x1 + 8x2 ≤ 24
x1, x2 ≥ 0, x1 and x2 integer
E.g. Pure IP problem relaxed:
Maximize z = 3x1 + 4x2
subject to 5x1 + 8x2 ≤ 24
x1, x2 ≥ 0
Approach 2:
Solve the LP relaxation
Round up/down the closer feasible integer solution
x2 7x1 + 4x2= 13
1
x x x x
1 2 3
x1
2
Integer Programming Solution
Example:
Max 1200 x1 + 2000 x2 x2
ST: 6
2x1 + 6 x2 27
x2 2 5
3x1 + x2 19
x1 , x2 0 and Integer 4
Use Integer 2
Programming to
solve the problem. 1
x1
Is the IP solution 1 2 3 4 5 6 7 8
rounded up/down
Optimal LP
to get the optimal x1 = 5 7/16
solution? x2 = 2 11/16
x2
6 Round up/down?
x1 = 5
Max 1200 x1 + 2000 x2 5
x2 = 3
ST:
Round up?
2x1 + 6 x2 27 4
x1 = 6
x2 2 x2 = 3
3x1 + x2 19
3
x1 , x2 0 and Integer 2
Round down?
1
x1 = 5
x2 = 2
x1
1 2 3 4 5 6 7 8
Optimal LP
x1 = 5 7/16
x2 = 2 11/16
3
Integer Programming Solution (3)
x2
6
Optimal IP
x1 = 4
5 x2 = 3
x1
1 2 3 4 5 6 7 8
Integer Programming
Modeling
4
Case 1: Recreational Facilities Example (1)
A community council must decide which recreation facilities to construct
in its community. Four new recreation facilities have been proposed—a
swimming pool, a tennis center, an athletic field, and a gymnasium. The
council wants to construct facilities that will maximize the expected daily
usage by the residents of the community, subject to land and cost
limitations. The expected daily usage and cost and land requirements for
each facility follow:
Objective Function:
Maximize Z = 300x1 + 90x2 + 400x3 + 150x4
Constraints:
subject to:
$35,000x1 + 10,000x2 + 25,000x3 + 90,000x4 $120,000 (budget)
4x1 + 2x2 + 7x3 + 3x3 12 (acres)
x1 + x2 1 (facility)
x1, x2, x3, x4 = 0 or 1
10
5
Recreational Facilities Example (3)
11
12
6
Recreational Facilities Example (5)
13
14
7
Recreational Facilities Example (7)
15
16
8
Case 2: Investment
Stockco Company considers 4 types of investment
Available capital for investment = $ 14,000
Formulate integer programming model to maximize NPV based on
the following investments:
Investment
1 2 3 4
Type
Capital ($) 5000 7000 4000 3000
NPV ($) 16000 22000 12000 8000
SOLUTION:
xi = total capital invested for investment type - i
Maximize
z = 16 x1+ 22 x + 12 x3 + 8 x4
Subject to
5 x1 + 7 x2 + 4 x3 + 3 x4 ≤ 14
x1, x2, x3, x4 = 0, 1
17
Investment
Stockco Company considers 4 types of investment
Available capital for investment = $ 14,000
Formulate integer programming model to maximize NPV based on
the following investments:
Investment
1 2 3 4
Type
Capital ($) 5000 7000 4000 3000
NPV ($) 16000 22000 12000 8000
SOLUTION:
xi = total capital invested for investment type - i
Maximize
z = 16 x1+ 22 x + 12 x3 + 8 x4
Subject to
5 x1 + 7 x2 + 4 x3 + 3 x4 ≤ 14
x1, x2, x3, x4 = 0, 1
18
9
Development of Investment Model
Stockco Co. needs to evaluate the following “logic” constraints:
Additional constraints:
1. Three investments are exactly selected
x1+ x2+ x3+ x4 =3
2. If Investment 2 is chosen, then Investment 1 is chosen either
x1 ≥ x2
3. If Investment 1 is chosen, Investment 3 is not chosen instead
x1 + x3 ≤ 1
4. One of Investment 3 or 4 must be selected, yet neither is chosen
x3 + x4 = 1
19
Recently, the company has experienced a growth in its product demand, so it wants
to buy one or more new farms to produce more potato products. The company is
considering six new farms with the following annual fixed costs and projected
harvest:
20
10
Case 5: Fixed Charge and Facility
The company currently has the following additional available production capacity
(tons) at its three plants, which it wants to utilize:
The shipping costs ($) per ton from the farms being considered for purchase to the
plants are as below.
The company wants to know which of the six farms it should purchase to meet
available production capacity at the minimum total cost, including annual fixed
costs and shipping costs.
21
Objective Function:
Minimize Z = 18x1A + 15x1B + 12x1C + 13x2A + 10x2B + 17x2C
+ 16x3A + 14x3B + 18x3C + 19x4A + 15x4b + 16x4C
+ 17x5A + 19x5B + 12x5C + 14x6A + 16x6B + 12x6C
+ 405y1 + 390y2 + 450y3 + 368y4 + 520y5 + 465y6
22
11
Case 5: Fixed Charge and Facility
Constraints:
23
24
12
Case 5: Fixed Charge and Facility
25
26
13
Case 5: Fixed Charge and Facility
27
28
14
Case 5: Fixed Charge and Facility
29
30
15
Gandhi’s Solution
Decision Variables:
xi = total number of clothing-i produced per week
yi = 1 clothing-i is produced, yet 0 not produced
Formulation:
Max. z = 6x1 + 4x2 + 7x3 – 200 y1 - 150 y2 - 100y3
subject to
3x1 + 2x2 + 6x3 150
4x1 + 3x2 + 4x3 160
x1 M y1, x1 y1
x2 M y2,
x3 M y3
x1, x2, x3 0, and integer
y1, y2, y3 0, and binary
31
LINDO
LINDO can be used to solve pure and mixed IPs.
In addition to the optimal solution, the LINDO output also
includes shadow prices and reduced costs.
LINGO and the Excel Solver can also be used to solve IPs
32
16
LINDO : “Gandhi” Problem
Definition of variables are placed after the command “END”
Definition of 0-1 or binary variables in LINDO
INTE x
Definition of integer variables in LINDO
GIN y
Example: GANDHI in LINDO:
33
34
17
Branch and Bound
Method
35
36
18
Branch and Bound Strategy
37
38
19
Example
E.g. IP Problem:
Maximize z = 8x1 + 5x2
subject to
x1 + x2 6;
9x1 + 5x2 45;
x1, x2 ≥ 0; x1, x2 integer
Sub-problem 1 is LP relaxation
solution of original problem.
Optimal LP Solution:
x1 = 3.75 and x2= 2.25
with z = 41.25
39
1 Subproblem 2: Subproblem 1 +
Constraint x1 4
Subproblem 3: Subproblem 1 +
Constraint x1 3
Subproblem 4: Subproblem 2 +
2 Constraint x2 2
Subproblem 5: Subproblem 2 +
Constraint x2 1
40
20
Daerah Feasible untuk Sub-problem
Branching:
Process of dividing a sub-problem into
two or more sub-problems underneath
Subproblem 1 is divided by 2:
Subproblem 2: Subproblem 1 +
Constraint x1 4
(x1 value is rounded up)
Subproblem 3: Subproblem 1 +
Constraint x1 3
(x1 is rounded down)
Subproblem 2 - Optimal Solution:
z = 41, x1 = 4, x2 = 9/5 = 1.8
The optimal solution for Sub-
problem 1 has not yet produced an
integer number, and needs to be
branched again (using LIFO
concept, so Subproblem 3 is not
processed first) Feasible Region for
Subproblems 2 and 3 of Telfa Problem
41
Subproblem 2 is divided by 2:
Subproblem 4: Subproblem 2 +
Constraint x2 2
(x1 value is rounded up)
Subproblem 5: Subproblem 2 +
Constraint x2 1
(x1 value is rounded down)
42
21
The Branch and Bound Tree
Subproblem 5 is divided by 2:
43
z = 40, x1 = 5, x2 = 0
z = 37, x1 = 4, x2 = 1
44
22
The Branch and Bound Tree
1 2
45
3 4
46
23
Knapsack Problems
47
Contoh
48
24
Solving Knapsack Problems
Max z = 16x1+ 22x2 + 12x3 + 8x4
subject to
LP Relaxation:
49
50
25
Solving Knapsack Problems
51
x3 = 1
x3 = 0
Subproblem 3
Subproblem 2
z = 43.7
z = 43.3, LB=42 2
x1 =x3= 1,
7 x1 = x2=1
x3 = 0, x4 =.67 x2 = .7, x4=0
x2 = 0 x2 = 1
x4 = 0 x4 = 1
3 4
Subproblem 8 Subproblem 9 Subproblem 4 Subproblem 5
z = 38, LB=42 z= 42.85, LB=42 z = 36 z = 43.6
8 x1 = x2=1 9 x1 = x4 =1 x1 = x3=1 x1 =.6, x2=x3=1
x3 = x4 = 0 x3 = 0, x2 = .85 x2 = 0, x4 =1 x4 = 0, LB = 36
x1 = 0 x1 = 1
Subproblem 6
Subproblem 7
z = 42
LB = 42
5 x1 =0, x2=x3=1 6
Infeasible
x4 = 1, LB = 36
52
26