You are on page 1of 30

Chapter 6

Integer Programming

Lecturer: Assoc. Prof. HO THANH PHONG

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Integer Programming

• A problem that is a LP except that the variables are required to


be integers, is called an Integer Program (IP)

• If only some of the variables must be integers, it is called a


Mixed Integer Program (MIP)

• If it contains only binary (0-1) variables it is called a Binary


Integer Program (BIP): pure BIP or mixed BIP problems.

Operations Research – Deterministic Model 2 Assoc. Prof. Hồ Thanh Phong


Properties of Integer Programming
• Type of Problems: Making “yes-or-no” type decisions

• Build a factory?
• Make Or Buy ?
• Doing a project or Not doing ?
• Fixed-Charge Problems
• Set Covering Problem

• Logical constraints

• Either-Or Constraints.
• If-Then Constraints

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Prototype Example:
California Manufacturing Company
• The California Manufacturing Company is a diversified company
with several factories and warehouses throughout California, but none
yet in Los Angeles or San Francisco.
• A basic issue is whether to build a new factory in Los Angeles or San
Francisco, or perhaps even both. Management is also considering
building at most one new warehouse, but will restrict the choice to a
city where a new factory is being built. Means that: building
warehouse in the city new factory built.
• There are two special points:
- Mutually exclusive alternatives: at most one warehouse
- Contingent decision: building warehouse in the city new factory built.

Objective: find the feasible combination of alternatives


that maximizes the net present value.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


• Formulating the model

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Prototype Example
Objective function: Max. Net Present Value Z

𝑀𝑎𝑥 𝑍 = 9𝑥1 + 5𝑥2 + 6𝑥3 + 4𝑥4


Subject to:

6𝑥1 + 3𝑥2 + 5𝑥3 + 2𝑥4 ≤ 10 1 : Resource availability


𝑥3 + 𝑥4 ≤ 1 (2) : Mutual Exclusive decision
𝑥3 ≤ 𝑥1 (3): Contingent decision, decision 3 depend decision 1
𝑥4 ≤ 𝑥2 (4): Contingent decision, decision 4 depend decision 2

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


6
Prototype Example

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


7
Mô hình LINGO
MAX = 9*x1 + 5*x2 + 6*x3 + 4*x4;
6*x1 + 3*x2 + 5*x3 + 2*x4 <= 10;
X3 + x4 <=1;
x3 - x1 <= 0;
x4 - x2 <= 0;
@BIN(x1);
@BIN(x2);
@BIN(x3);
@BIN(x4);
Solution:
Global optimal solution found.
Objective value: 14.00000
Variable Value Reduced Cost
X1 1.000000 -9.000000
X2 1.000000 -5.000000
X3 0.000000 -6.000000
X4 0.000000 -4.000000

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Some Other Applications
• Investment Analysis
• Should we make a certain fixed investment?
• Site Selection
• Should a certain site be selected for the location of a new
facility?
• Designing a Production and Distribution Network
• Should a certain plant remain open? Should a certain site be
selected for a new plant? Should a distribution center remain
open? Should a certain site be selected for a new distribution
center? Should a certain distribution center be assigned to
serve a certain market area?

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Some Other Applications

• Dispatching Shipments
• Should a certain route be selected for a truck? Should a
certain size truck be used? Should a certain time period for
departure be used?
• Scheduling Interrelated Activities
• Should a certain activity begin in a certain time period?
• Scheduling Asset Divestitures
• Should a certain asset be sold in a certain time period?
• Airline Applications:
• Should a certain type of airplane be assigned to a certain
flight leg? Should a certain sequence of flight legs be
assigned to a crew?

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Modelling Either-Or constraint

• Assume there are two constraints


2𝑥1 + 3𝑥2 ≤ 10 (1) and 𝑥1 −4𝑥2 ≤ 5 (2) and only one must hold.
Let M > 0 is a very large positive number, we want:
2𝑥1 + 3𝑥2 ≤ 10 2𝑥1 + 3𝑥2 ≤ 10 + 𝑀
Either ൜ Or ൜
𝑥1 −4𝑥2 ≤ 5 + 𝑀 𝑥1 −4𝑥2 ≤ 5

We introduce a new auxiliary variable y (either 0 or 1), we have:

2𝑥1 + 3𝑥2 ≤ 10 + 𝑀𝑦 (1)



𝑥1 −4𝑥2 ≤ 5 + 𝑀 1 − 𝑦 (2)

If y = 0, (1) hold, y = 1, (2) hold.


Modelling K out of N constraints

• Assume there are N constraints


𝑓 𝑥1 , 𝑥2 … 𝑥𝑛 ≤ 𝑏1 (1)
𝑓 𝑥1 , 𝑥2 … 𝑥𝑛 ≤ 𝑏2 (2)
...
𝑓 𝑥1 , 𝑥2 … 𝑥𝑛 ≤ 𝑏𝑁 (N)
Requirement: There are only K constraint hold.
Use big M and binary 𝑦𝑖 :
𝑓 𝑥1 , 𝑥2 … 𝑥𝑛 ≤ 𝑏1 + 𝑀𝑦1 (1)
𝑓 𝑥1 , 𝑥2 … 𝑥𝑛 ≤ 𝑏2 + 𝑀𝑦2 (2)
...
𝑓 𝑥1 , 𝑥2 … 𝑥𝑛 ≤ 𝑏𝑁 + 𝑀𝑦𝑁 (N) and add one more const. (N+1)
𝑁

෍ 𝑦𝑖 = 𝑁 − 𝐾 (N + 1)
𝑖=1
One value is chosen (function with N possible values)
Modeling Fixed-Charge Problems

If a product is produced, must incur a fixed setup cost C2 and a


variable cost.
Cost = C1x + C2
→The problem is non-linear.
x – quantity of product to be manufactured
x = 0 → cost = 0;
x > 0 → cost = C1x + C2
→How to model it? Using an indicator variable y
y = 1 → x is produced; y = 0 → x is not produced (x ≤ My)
Objective function becomes → Min (C1x + C2y)
Additional Constraint → x ≤ My; M is very large number.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Wyndor Glass Co. (original version)
• Two new products have been developed: Door and
WindowsWyndor has three production plants
– Production of the Door utilizes Plants 1 and 3
– Production of the Window utilizes Plants 2 and 3

• Objective is to find the optimal mix of these two new products.

Production Time Used for Each Unit Produced

Plant Doors Windows Available Per Week

1 1 hour 0 hour 4 hour


2 0 hour 2 hour 12 hour

3 3 hour 2 hour 18 hour

Unit Profit $300 $500

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh


15Phong
Wyndor Glass Co. with Setup Costs
(Variation 1)
Suppose that two changes are made to the original Wyndor
problem:
1.For each product, producing any units requires a substantial
one-time setup cost for setting up the production facilities.
2.The production runs for these products will be ended after
one week, so D and W in the original model now represent
the total number of doors and windows produced,
respectively, rather than production rates. Therefore, these
two variables need to be restricted to integer values.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Model Formulation
Let D = Number of doors to produce,
W = Number of windows to produce,
y1 = 1 if perform setup to produce doors; 0 otherwise,
y2 = 1 if perform setup to produce windows; 0 otherwise .

Maximize P = 300D + 500W – 700y1 – 1,300y2


subject to:
Original Constraints:
Plant 1: D≤4
Plant 2: 2W ≤ 12
Plant 3: 3D + 2W ≤ 18
Produce only if Setup:
Doors: D ≤ My1
Windows: W ≤ My2
and
D ≥ 0, W ≥ 0, y1 and y2 are binary.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Lingo model and POM model
LINGO Model
MAX = 300*D + 500*W - 700*Y1 - 1300*Y2; Variable Value Reduced Cost
D <= 4 ; D 0.000000 -300.0000
W 6.000000 -500.0000
2*W <= 12;
Y1 0.000000 700.0000
3*D + 2*W <= 18; Y2 1.000000 1300.000
D <= 10000*Y1;
W <= 10000 * Y2;
@BIN(Y1);
@BIN(Y2);
@GIN(D);
@GIN(W);

POM Model
Wyndor Glass Co. with Mutually Exclusive Products
(Variation 2)

Suppose that now the only change from the original Wyndor
problem is:
• The two potential new products (doors and windows) would
compete for the same customers. Therefore, management
has decided not to produce both of them together.
• At most one can be chosen for production,
so either D = 0 or W = 0, or both.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Model Formulation
Let D = Number of doors to produce,
W = Number of windows to produce,
y1 = 1 if produce doors; 0 otherwise,
y2 = 1 if produce windows; 0 otherwise.
Maximize P = 300D + 500W
subject to
Original Constraints:
Plant 1: D≤4
Plant 2: 2W ≤ 12
Plant 3: 3D + 2W ≤ 18
Auxiliary variables must =1 if produce any:
Doors: D ≤ My1
Windows: W ≤ My2
Mutually Exclusive: y1 + y2 ≤ 1
and
D ≥ 0, W ≥ 0, y1 and y2 are binary.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Wyndor Glass Co. with Either-Or Constraints
(Variation 3)

Suppose that now the only change from the original Wyndor
problem is:
• The company has just opened a new plant (plant 4) that is
similar to plant 3, so the new plant can perform the same
operations as plant 3 to help produce the two new products
(doors and windows).
• However, management wants just one of the plants to be
chosen to work on these new products. The plant chosen
should be the one that provides the most profitable product
mix.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Data for Wyndor with Either-Or Constraints
(Variation 3)

Production Time Used for Production Time


Each Unit Produced (Hours) Available
Plant Doors Windows per Week (Hours)
1 1 0 4
2 0 2 12
3 3 2 18
4 2 4 28
Unit Profit $300 $500
Model Formulation
Let D = Number of doors to produce,
W = Number of windows to produce,
y = 1 if plant 4 is used; 0 if plant 3 is used
Maximize P = 300D + 500W
subject to:
Plant 1: D≤4
Plant 2: 2W ≤ 12
Plant 3: 3D + 2W ≤ 18 + My
Plant 4: 2D + 4W ≤ 28 + M(1 – y)
and
D ≥ 0, W ≥ 0, y is binary.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Applications of Binary Variables
• Making “yes-or-no” type decisions
• Build a factory?
• Manufacture a product?
• Do a project?
• Assign a person to a task?
• Fixed costs
• If a product is produced, must incur a fixed setup cost.
• If a warehouse is operated, must incur a fixed cost.
• Either-or constraints
• Production must either be 0 or ≥ 100.
• Subset of constraints
• meet 3 out of 4 constraints.

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Some special Integer Programming problems
• The Knapsack Problem (Bài toán xếp túi hành lý-ba-lô)
There are n things, thing j has profit pj. and weight wj, the bag weight is W. Select
thing through binary variable xj = 0 (not selecting) and và xj =1 (selecting).
Maximize σ𝑛𝑗=1 𝑝𝑗 𝑥𝑗
Subject to: σ𝑛𝑗=1 𝑤𝑗 𝑥𝑗 ≤ 𝑊

• Set Covering Problem (Bài toán tập bao phủ)


• Some devices will be installed. Each device covers an area. We need to
identify minimum number of devices to satisfy requirement. Example:
installing network of phone, network of pipeline water…

• Set Partitioning Problem


• The Traveling Salesman Problem

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Southwestern Airways Crew Scheduling

• Southwestern Airways needs to assign crews to cover all its


upcoming flights.
• We will focus on assigning 3 crews based in San Francisco
(SFO) to 11 flights.

Question: How should the 3 crews be assigned 3 sequences


of flights so that every one of the 11 flights is covered?

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Data for the Southwestern Airways Problem
Feasible Sequence of Flights (pairings)
Flights Leg 1 2 3 4 5 6 7 8 9 10 11 12
1. SFO–LAX 1 1 1 1
2. SFO–DEN 1 1 1 1
3. SFO–SEA 1 1 1 1
4. LAX–ORD 2 2 3 2 3
5. LAX–SFO 2 3 5 5
6. ORD–DEN 3 3 4
7. ORD–SEA 3 3 3 3 4
8. DEN–SFO 2 4 4 5
9. DEN–ORD 2 2 2
10. SEA–SFO 2 4 4 5
11. SEA–LAX 2 2 4 4 2
Cost, $1,000s 2 3 4 6 7 5 7 8 9 9 8 9

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


Model Formulation
Let xj = 1 if flight sequence (pairing) j is assigned to a crew; 0 otherwise. (j = 1, 2, … , 12).
Minimize Cost = 2x1 + 3x2 + 4x3 + 6x4 + 7x5 + 5x6 + 7x7 + 8x8 + 9x9 + 9x10 + 8x11 + 9x12

subject to
pairings
Flight 1 covered: x1 + x4 + x7 + x10 ≥ 1
Flight 2 covered: x2 + x5 + x8 + x11 ≥ 1
: :
Flight 11 covered: x6 + x9 + x10 + x11 + x12 ≥ 1
Three Crews: x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 ≤ 3
and
xj are binary (j = 1, 2, … , 12).

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


•Minimize Cost = 2x1 + 3x2 + 4x3 +6x4 +7x5 +5x6 +7x7 +8x8 + 9x9 + 9x10 + 8x11 + 9x12
subject to:
x1 + x4 + x7 + x10 ≥ 1 ; Flight 1: SFO–LAX
x2 + x5 + x8 + x11 ≥ 1 ; Flight 2: SFO–DEN
x3 + x6 + x9 + x12 ≥ 1 ; Flight 3: SFO–SEA
x4 + x7 + x9 + x10 + x12 ≥ 1 ; Flight 4: LAX-ORD
x1 + x6 + x10 + x11 ≥ 1 ; Flight 5: LAX-SFO
x4 + x5 + x9 ≥ 1 ; Flight 6: ORD-DEN
x7 + x8 + x10 + x11 + x12 ≥ 1; Flight 7: ORD-SEA
x2 + x4 + x5 + x9 ≥ 1 ; Flight 8: DEN-SFO
x5 + x8 + x11 ≥ 1 ; Flight 9: DEN-ORD
x3 + x7 + x8 + x12 ≥ 1 ; Flight 10: SEA-SFO
x6 + x9 + x10 + x11 + x12 ≥ 1; Flight 11: SEA-LAX
σ12
𝑗=1 𝑥𝑗 = 3 (three crew)

Operations Research – Deterministic Model Assoc. Prof. Hồ Thanh Phong


LINGO Model
Min = 2*x1 + 3*x2 + 4*x3 +6*x4 +7*x5 +5*x6 +7*x7 +8*x8 + 9*x9
+ 9*x10 + 8*x11 + 9*x12 ;
!subject to: ;
x1 + x4 + x7 + x10 >=1 ; ! Flight 1: SFO-LAX ;
x2 + x5 + x8 + x11 >=1 ; ! Flight 2: SFO-DEN;
x3 + x6 + x9 + x12 >=1 ; ! Flight 3: SFO-SEA;
x4 + x7 + x9 + x10 + x12 >=1 ; !Flight 4: LAX-ORD ;
x1 + x6 + x10 + x11 >=1 ; ! Flight 5: LAX-SFO;
x4 + x5 + x9 >=1 ; !Flight 6: ORD-DEN;
x7 + x8 + x10 + x11 + x12 >=1; !Flight 7: ORD-SEA;
x2 + x4 + x5 + x9 >=1 ; !Flight 8: DEN-SFO;
x5 + x8 + x11 >=1 ; !Flight 9: DEN-ORD;
x3 + x7 + x8 + x12 >=1 ; !Flight 10: SEA-SFO;
x6 + x9 + x10 + x11 + x12 >=1; !Flight 11: SEA-LAX ;
x1 + x2 + x3 +x4 +x5 +x6 +x7 +x8 + x9 + x10 + x11 + x12 = 3 ;

Solutions:
x3=1, x4 =1, x11=1; otherwise xij=0

You might also like