Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Integer Programming

Introduction
Divisibility Assumption of LP
➢ Recall that in LP the variables are continuous, i.e., they can assume fractional values.
(Pure) Integer Program (IP)
➢ However, in IP, the variables can assume ONLY discrete or integer values. How do you state this
requirement in an IP? See below.

Example: A 2-variable IP
Maximize 3x + 4y
Subject to 5x + 8y ≤ 24
x, y ≥ 0 and integer

2
Types of Mathematical Programming
Linear Programming (LP):
The objective and constraint functions are linear and the decision variables are continuous.
Integer Linear Programming (ILP):
One or more of the decision variables are restricted to integer values only and the functions are linear.
– Pure IP: all decision variables are integer.
– Mixed IP (MIP): some decision variables are integer, others are continuous.
– 0/1 MIP and Pure Binary (0/1): Some or all decision variables are restricted to be valued either “1” or “0”,
i.e., “x ∈{0,1}.”

3
How is an IP different than an LP?
Consider the following Integer program (IP) and its LP relaxation (i.e., an LP obtained by dropping integer
restriction on the variables).

IP LP Relaxation of IP
[integrality of variables dropped]
Maximize, ZIP = 3x + 4y Maximize, ZLP = 3x + 4y
Subject to Subject to
5x + 8y ≤ 24 5x + 8y ≤ 24
Feasible Feasible
Domain
x, y ≥ 0 x, y ≥ 0 Domain
and integer

4
The Feasible Regions of LP and IP

5
The Feasible Regions of LP and IP

Feasible points of LP Relaxation is any


point within the shaded area defined by
5x + 8y ≤ 24
x, y ≥ 0

Feasible points of IP are only discrete


points (marked as yellow circles) inside
the shaded area.
5x + 8y ≤ 24
x, y ≥ 0 and integer
x

6
Optimal solution of LP
Maximize 3x + 4y
Question 1: What is the optimal solution
of LP?
x = 4.8, y = 0, z = 14.4

Question 2: What is the optimal


solution of IP?
Will it be better (ZIP > ZLP) or worse
(ZIP < ZLP) than an LP solution?

Question 3: Can one use linear


programming to solve the integer
program?
x

7
Attempt to get IP Solution by Rounding LP solution

Solve LP (ignore integrality, i.e., solve LP


Relaxation) get x=4.8, y=0 and z =14.4

Optimal IP solution is
x=3, y=1, and z =13 Round up, get x=5, y=0,
infeasible!

x
5
Truncate, get x=4, y=0, and
Thus: Rounding the LP solution is not a z =12 (sub optimal)
safe strategy 8
Why study integer programming?
➢ The LP divisibility assumption (fractional solutions are permissible) is not always valid in practice.
➢ Binary variables allow powerful new techniques like logical constraints

9
Fixed-Charge ILP Problems
➢ A fixed-charge ILP problem is one in which a 0/1 variable, y, represents a cost that is incurred if some
other activity, x, is undertaken at a non-zero level. Commonly used to formulate production and/or
location problems.

➢ Example: If you produce a batch (size x) of product in a machine, you incur the (fixed) cost of setting the
equipment /tools before you start processing.

➢ Need to capture if setup happens (y=1) or not (y=0). in other words: if x > 0 then y = 1, & if x = 0 then
y = 0.

➢ It is implemented by adding a new constraint: x ≤ M·y (where M is a very large number, y=0/1)
➢ Can you see why this works?

10
Fixed-Charge ILP Problems
ABC Cloth Company is capable of manufacturing three types of clothing: shirts, shorts, and pants. The manufacture of
each type of clothing requires that ABC has the appropriate type of machinery available. The machinery needed to
manufacture each type of clothing must be rented at the following rates: shirt machinery, $200 per week; shorts machinery,
$150 per week; pants machinery, $100 per week.

The manufacture of each type of clothing also requires the amounts of cloth and labor shown in below Table. Each week,
150 hours of labor and 160 sq yd of cloth are available. The variable unit cost and selling price for each type of clothing are
also shown in below Table.

Formulate an optimization model whose solution will maximize ABC’s weekly profits.

Resource Requirements Revenue & Cost Information


Labour (Hrs) Cloth (Sq Yds) Sales Price ($) Variable Cost ($)
Shirt 3 4 12 6
Shorts 2 3 8 4
Pants 6 4 15 8

11
Fixed-Charge ILP Problems

12
Fixed-Charge ILP Problems

13
Binary ILP Problems with Logical Constraints
1/0 ILP problems often have logical constraints, including:

➢ Either one particular project or another particular project can be selected, but not both.

➢ The number of projects selected must be ≤, ≥, or = to some number n.

➢ If a particular project is selected, then some other particular project must also be selected.

➢ If a particular project is selected, then some other particular project cannot also be selected

14
Formulating Logical Constraints
➢ Either one particular project or another particular project must be selected, but not both.
➢ If exactly one of two projects represented by variables x1 and x2 must be selected:
x1 + x2 = 1

➢ The number of projects selected must be ≤, ≥, or = to some number n.


➢ If exactly n out of m projects must be selected:

x1 + x2 + x3 +……..+ xm-1 + xm = n
➢ If no more than n out of m projects must be selected:

x1 + x2 + x3 +……..+ xm-1 + xm ≤ n
➢ If at least n out of m projects must be selected:

x1 + x2 + x3 +……..+ xm-1 + xm ≥ n

15
Formulating Logical Constraints
➢ If a particular project is selected, then some other particular project must also be selected.
➢ A project represented by variable x1 can only be selected if a project represented by variable x2 is also selected:
x1 ≤ x2
➢ If two projects represented by variables x1 and x2 must be selected together or not at all:
x1 = x2

➢ If a particular project is selected, then some other particular project cannot also be selected.
➢ If two projects represented by variables x1 and x2 are mutually exclusive (we select one or neither, but not both):

x1 + x 2 ≤ 1

16
Formulating Logical Constraints: Examples
You have $18 000 available for investing in 6 different projects. Each project has a cost and profit as follows:
Project 1 2 3 4 5 6
Cost (‘000s) $5 $7 $4 $3 $4 $3
Profit(‘000s) $16 $22 $12 $8 $10 $15

A project is either invested in at its full cost or not at all. Formulate the ILP model that will maximize your
profit:
➢ You must invest in at least 3 different projects.
➢ You can invest in no more than 3 different projects.
➢ You must invest in exactly 3 different projects.
➢ You must invest in either project 2 or 4, but not both.
➢ If you invest in project 2, you also need to invest in project 5.
➢ If you invest in either project 1 or 2, you must invest in them both.

17
Formulating Either-Or Constraints
➢ In some ILP problems, we might have a pair of constraints where only one or the other needs to be
satisfied.
◼ If only one of the following needs to be satisfied:

f(x1, x2 ,…, xn) ≤ 0


g(x1, x2 ,…, xn) ≤ 0

we replace those constraints with:

f(x1, x2 ,…, xn) ≤ M·y


g(x1, x2 ,…, xn) ≤ M·(1-y)

where y is a 1/0 variable (it either equals 1 or it equals 0)

18
Formulating Either-Or Constraints
◼ Dorian Auto is considering manufacturing three types of autos: compact, midsize, and large. The
resources required for, and the profits yielded by, each type of car are shown in below Table. Currently,
6,000 tons of steel and 60,000 hours of labor are available. For production of a type of car to be
economically feasible, at least 1,000 cars of that type must be produced. Formulate an IP to maximize
Dorian’s profit.

19
Formulating Either-Or Constraints
Decision Variables:
x1 : number of compact cars produced
x2 : number of midsize car produced
x3 : number of large car produced

Objective Function: Maximize 2000x1 + 3000x2 + 4000x3

Constraints:
1) x1 ≤ 0 or x1 ≥ 1000
2) x2 ≤ 0 or x2 ≥ 1000
3) x3 ≤ 0 or x3 ≥ 1000
4) 1.5x1 + 3x2 + 5x3 ≤ 6000
5) 30x1 + 25x2 + 40 x3 ≤ 60000
6) x1, x2 , x3 ≥ 0; x1, x2 , x3 integer

20
Formulating Either-Or Constraints
Objective Function: Maximize 2000x1 + 3000x2 + 4000x3

Constraints:
1) x1 ≤ My1
2) 1000 - x1 ≤ M (1 - y1)
3) x2 ≤ My2
4) 1000 - x2 ≤ M (1 - y2)
5) x3 ≤ My3
6) 1000 - x3 ≤ M (1 - y3)
7) 1.5x1 + 3x2 + 5x3 ≤ 6000
8) 30x1 + 25x2 + 40 x3 ≤ 60000
9) x1, x2 , x3 ≥ 0; x1, x2 , x3 integer
10) y1,y2,y3 = 0 or 1
11) M is a large number
21
Formulating Either-Or Constraints
Objective Function: Maximize 2000x1 + 3000x2 + 4000x3

Constraints:
1) x1 ≤ My1 i.e. x1 - My1 ≤ 0
2) 1000 - x1 ≤ M (1 - y1) i.e. - x1 + My1 ≤ -1000 + M
3) x2 ≤ My2
4) 1000 - x2 ≤ M (1 - y2)
5) x3 ≤ My3
6) 1000 - x3 ≤ M (1 - y3)
7) 1.5x1 + 3x2 + 5x3 ≤ 6000
8) 30x1 + 25x2 + 40 x3 ≤ 60000
9) x1, x2 , x3 ≥ 0; x1, x2 , x3 integer
10) y1,y2,y3 = 0 or 1
11) M is a large number
22
Formulating If-Then Constraints
➢ Many applications require the use of an if-then type of constraint system where:
If f(x1, x2,…, xn) > 0 is satisfied, then g(x1, x2,…, xn) ≥ 0 must also be satisfied.

To implement that system of constraints, can we use ??


f(x1, x2,…, xn) < My (non-zero value of f forces y to be 1)
g(x1, x2,…, xn) ≥ M*(y-1) (when y is 1 it forces to satisfy g >0)
where y is a 1/0 variable

23
Either-Or and If-Then: Examples
➢ Referring back to the previous in-class problem (dealing with logical constraints), formulate the model if:
◼ You must either invest in at least one of projects 1 and 2 or no more than two of projects 3, 4, 5, and 6.
◼ If you invest in more than one of projects 1 and 2, then you can invest in no more than one of projects 3,
4, 5, and 6.

24
Variables with k possible values
➢ Suppose variable y should take one of the values d1, d2,…, dk. How to achieve that in the model?
➢ Introduce new decision variables. For i =1,…,k
1 𝑖𝑓 𝑦 𝑡𝑎𝑘𝑒𝑠 𝑣𝑎𝑙𝑢𝑒 𝑑𝑖
𝑥𝑖 = ቊ
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Then we need the following constraints:
𝑘

෍ 𝑥𝑖 = 1 (y can take only one value)


𝑖=1
𝑘

𝑦 = ෍ 𝑑𝑖 𝑥𝑖 (y should take value 𝑑𝑖 𝑖𝑓 𝑥𝑖 = 1)


𝑖=1

25
Warehouse location-allocation problem
m warehouses - cost fi of opening warehouse i
n customers - customer j has a “demand” of dj
- unit shipping cost cij of serving customer j via warehouse i.
Variables:
Let yi = 1 if warehouse i is opened
Let xij = amount of demand for customer j satisfied via warehouse i.

Minimize σ𝑖,𝑗 𝑐𝑖𝑗 𝑥𝑖𝑗 + σ𝑖 𝑓𝑖 𝑦𝑖


Subject to:
σ𝑖 𝑥𝑖𝑗 = 𝑑𝑗 for each j [customers get their demand satisfied]
0 ≤ 𝑦𝑖 ≤ 1 for all i [each warehouse is either opened or it is not (no
partial openings)]
𝑥𝑖𝑗 ≤ 𝑑𝑗 𝑦𝑖 for all i and j [no shipments are made from an empty warehouse]
𝑥𝑖𝑗 ≥ 0
26
Two key aspects of using integrality in the model
◼ Costs: we include the cost of the warehouse only if it is opened.
෍ 𝑓𝑗 𝑦𝑗
𝑗
◼ Constraints: we do not allow shipping from warehouse j if it is not opened.
𝑥𝑖𝑗 ≤ 𝑑𝑖 𝑦𝑗 for all i and j

27
Thank You !!!

You might also like