0% found this document useful (0 votes)
12 views82 pages

ThanhLX_VJU_OR_IP

The document provides an introduction to Integer Programming, detailing its formulation, modeling techniques, and solution methods. It covers general and standard formulations of linear integer programs, along with examples such as the minimum cost assignment problem, knapsack problem, and set covering problem. Additionally, it discusses basic modeling techniques including implicit 0-1 variables and logical implications involving binary and integer variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views82 pages

ThanhLX_VJU_OR_IP

The document provides an introduction to Integer Programming, detailing its formulation, modeling techniques, and solution methods. It covers general and standard formulations of linear integer programs, along with examples such as the minimum cost assignment problem, knapsack problem, and set covering problem. Additionally, it discusses basic modeling techniques including implicit 0-1 variables and logical implications involving binary and integer variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

.

Introduction to Integer Programming


.

Lê Xuân Thanh
Contents

1. Formulation

2. Modeling
General framework
Basic modeling techniques
Advanced modeling techniques

3. Solution method
Total unimodularity
Branch-and-bound
Formulation

Contents

1. Formulation

2. Modeling
General framework
Basic modeling techniques
Advanced modeling techniques

3. Solution method
Total unimodularity
Branch-and-bound
Formulation

General formulation of Linear Integer Programs

In words:
Optimize a linear function
subject to linear constraints on integer variables

Explicit general formulation:

max | min c1 x1 + c2 x2 + . . . + cn xn
subject to ai1 x1 + ai2 x2 + . . . + ain xn ≤ bi (i = 1, . . . , m1 )
ai1 x1 + ai2 x2 + . . . + ain xn ≥ bi (i = m1 + 1, . . . , m2 )
ai1 x1 + ai2 x2 + . . . + ain xn = bi (i = m2 + 1, . . . , m)
xj ∈ Z (j = 1, . . . , n)
Formulation

Standard formulation of Linear Integer Programs

In words:
Optimize a linear function
subject to linear constraints of ≤-type
on non-negative integer variables
Explicit standard formulation:
maximize c1 x1 + c2 x2 + . . . + cn xn
subject to a11 x1 + a12 x2 + . . . + a1n xn ≤ b1
a21 x1 + a22 x2 + . . . + a2n xn ≤ b2
...
am1 x1 + am2 x2 + . . . + amn xn ≤ bm
x1 , x2 , . . . , xn ∈ Z+
Matrix form:
max ct x
s.t. Ax ≤ b
x ∈ Zn+
Formulation

Variants

Linear Mixed Integer Programs:

max ct x + dt y
s.t. Ax + Dy ≤ b
x≥0
y ≥ 0 and integer

Linear Binary Programs:

max ct x
s.t. Ax ≤ b
x ∈ {0, 1}n
Modeling General framework

Contents

1. Formulation

2. Modeling
General framework
Basic modeling techniques
Advanced modeling techniques

3. Solution method
Total unimodularity
Branch-and-bound
Modeling General framework

General modeling framework

To translate a problem description into a formulation:


Define what appear to be necessary variables
and what are data of problem instances
Use these variables to define constraints
(so that feasible points correspond to feasible solutions)
Use these variables to define objective function

If difficulties arise:
Define additional or alternative variables and iterate
Modeling General framework

Example 1: Minimum cost assignment problem

Problem description:
n people, n jobs, each person is assigned to exactly one job
Cost cij if person i is assigned to job j
Aim: find a minimum cost assignment
Define variables: xij = 1 if person i does job j, otherwise xij = 0
Define constraints:
Each person does exactly one job

n
xij = 1 ∀i = 1, . . . , n
j=1

Each job is done by exactly one person



n
xij = 1 ∀j = 1, . . . , n
i=1

Define objective:

n ∑
n
min cij xij
i=1 j=1
Modeling General framework

Example 2: Knapsack problem

Problem description:
Budget amount b for investments in n projects
Each project j has outlay aj and expected return cj
Aim: Find a portfolio of maximum expected return
Define variables: xj = 1 if project j is selected, otherwise xj = 0
Define constraints:
The budget cannot be exceeded


n
aj xj ≤ b
j=1

Define objective:

n
max c j xj
i=1
Modeling General framework

Example 3: Set covering problem

Problem description:
m regions, n potential positions for emergency service centers
Given A = (aij )m×n , in which
aij = 1 if center j can service region i, otherwise aij = 0
Center j costs cj to install
Aim: Choose a minimum set of centers to cover all regions
Define variables: xj = 1 if center j is selected, otherwise xj = 0
Define constraints:
Each region must be serviced by at least one center

n
aij xj ≥ 1 ∀i = 1, . . . , m
j=1

Define objective:

n
min cj xj
i=1
Modeling Basic modeling techniques

Contents

1. Formulation

2. Modeling
General framework
Basic modeling techniques
Advanced modeling techniques

3. Solution method
Total unimodularity
Branch-and-bound
Modeling Basic modeling techniques

Outline

Implicit 0-1 variables

Logical implication involving binary variables

Logical implication involving integer variables


Modeling Basic modeling techniques

Implicit 0-1 variables

Setting: xi is a binary variable for all i ∈ I finite index set

Constraint Expressed by

At most one xi may be 1 xi ≤ 1

i∈I
Exactly one xi equals 1 xi = 1

i∈I
At least one xi may be 1 xi ≥ 1
i∈I
Modeling Basic modeling techniques

Application: Sudoku
Given a 9 × 9 grid (as a composition of nine 3 × 3 subgrids).
Rules:
Only digits from 1 to 9 can be filled in the grid
Each cell of the grid must be filled by exactly one digit
Each digit appears exactly once in each column, row, and 3 × 3 subgrid
Input: a partially complete grid
Objective: completely fill the grid
8 9
1 3 9
5 2 4
2 6 8
9 7 6 5
3 6 5
1 3 5
8 7 1
4 5
Modeling Basic modeling techniques

Application: Sudoku
Given a 9 × 9 grid (as a composition of nine 3 × 3 subgrids).
Rules:
Only digits from 1 to 9 can be filled in the grid
Each cell of the grid must be filled by exactly one digit
Each digit appears exactly once in each column, row, and 3 × 3 subgrid
Input: a partially complete grid
Objective: completely fill the grid
3 6 7 4 2 5 8 9 1
4 2 1 3 8 9 5 7 6
8 5 9 6 7 1 2 3 4
5 7 4 1 3 2 6 8 9
9 1 8 7 4 6 3 2 5
2 3 6 5 9 8 4 1 7
1 8 3 9 6 4 7 5 2
6 9 2 8 5 7 1 4 3

7 4 5 2 1 3 9 6 8
Modeling Basic modeling techniques

Application: Sudoku (cont.)

(1, 1)

(9, 9)

{
1 if k is filled into cell (i, j)
xijk =
0 otherwise
Modeling Basic modeling techniques

Application: Sudoku (cont.)

Modeling constraints concerning given clues:

8 9 xijk = 1 ∀(i, j, k) ∈ G
1 3 9
in which
5 2 4
2 6 8 G = {(i, j, k) | k is clue
9 7 6 5 in cell (i, j)}
3 6 5
For example:
1 3 5
8 7 1 x178 = 1
4 5
x189 = 1
{ ...
1 if k is filled into cell (i, j)
xijk = x935 = 1
0 otherwise
Modeling Basic modeling techniques

Application: Sudoku (cont.)

Modeling constraints concerning cells:

8 9
1 3 9
Cell (1, 2) for instance:
5 2 4
2 6 8 ∑
9

6
x12k = 1
9 7 5
k=1
3 6 5
1 3 5 In general:
8 7 1

9
4 5 xijk = 1 ∀i, j = 1, . . . , 9
k=1
{
1 if k is filled into cell (i, j)
xijk =
0 otherwise
Modeling Basic modeling techniques

Application: Sudoku (cont.)

Modeling constraints concerning rows:

8 9
1 3 9 Row 1 for instance:
5 2 4
For each k = 1, . . . , 9 we have
2 6 8 ∑
9
9 7 6 5 x1jk = 1
3 6 5 j=1

1 3 5 In general:
8 7 1
4 5 ∑
9
xijk = 1 ∀i, k = 1, . . . , 9
{ j=1
1 if k is filled into cell (i, j)
xijk =
0 otherwise
Modeling Basic modeling techniques

Application: Sudoku (cont.)

Modeling constraints concerning columns:

8 9
1 3 9 Column 1 for instance:
5 2 4 For each k = 1, . . . , 9 we have
2 6 8

9
9 7 6 5 xi1k = 1
3 6 5 i=1

1 3 5 In general:
8 7 1
4 5 ∑
9
xijk = 1 ∀j, k = 1, . . . , 9
{ i=1
1 if k is filled into cell (i, j)
xijk =
0 otherwise
Modeling Basic modeling techniques

Application: Sudoku (cont.)

Modeling constraints concerning blocks:


Block 2 for instance:
8 9 For each k = 1, . . . , 9 we have
1 3 9
5 2 4 ∑
2 ∑
2
x1+i,4+j,k = 1
2 6 8
i=0 j=0
9 7 6 5
3 6 5 In general:
1 3 5

2 ∑
2
8 7 1 xp+i,q+j,k = 1
4 5 i=0 j=0

{ ∀k = 1, . . . , 9, ∀(p, q) ∈ B
1 if k is filled into cell (i, j)
xijk = (B = {top left cell of each block})
0 otherwise
Modeling Basic modeling techniques

Application: Sudoku (cont.)

G = {(i, j, k) | k is already filled into cell (i, j)}, S = {1, . . . , 9},


B = {(1, 1), (1, 4), (1, 7), (4, 1), (4, 4), (4, 7), (7, 1), (7, 4), (7, 7)}

Formulation:
xijk = 1 ∀(i, j, k) ∈ G

xijk = 1 ∀i, j ∈ S
k∈S

xijk = 1 ∀j, k ∈ S
i∈S

xijk = 1 ∀i, k ∈ S
j∈S


p+2 ∑
q+2
xijk = 1 ∀k ∈ S, (p, q) ∈ B
i=p j=q

xijk ∈ {0, 1} ∀i, j, k ∈ S


Modeling Basic modeling techniques

Outline

Implicit 0-1 variables

Logical implication involving binary variables

Logical implication involving integer variables


Modeling Basic modeling techniques

Logical implication involving binary variables


Setting:
xi is a binary variable for all i ∈ I finite index set
y is a variable satisfying 0 ≤ y ≤ c
Logical implication
“if xi = 0 for all i ∈ I then y = 0”
can be exactly expressed by

y≤c xi
i∈I

Example: I = {1, 2}, c = 1 y

“If x1 = 0 and x2 = 0 then y = 0”


1
expressed by y ≤ x1 + x2 x2

i.e., excluding {(0, 0, y) | 0 < y ≤ 1} 1


from {0, 1} × {0, 1} × [0, 1]
x1
0 1
Modeling Basic modeling techniques

Corollary
Setting:
xi is a binary variable for all i ∈ I finite index set
I = I0 ⊔ I 1
y is a variable satisfying 0 ≤ y ≤ 1
Logical implication
“if xi = 0 ∀i ∈ I0 and xi = 1 ∀i ∈ I1 then y = 0
can be exactly expressed by
∑ ∑
y≤ xi + (1 − xi )
i∈I0 i∈I1

Example: I0 = {1} and I1 = {2} y

“If x1 = 0 and x2 = 1 then y = 0” 1


expressed by y ≤ x1 + (1 − x2 ) x2

i.e., excluding {(0, 1, y) | 0 < y ≤ 1} 1

from {0, 1} × {0, 1} × [0, 1] x1


0 1
Modeling Basic modeling techniques

Application: n-queen problem


Problem description:
Place n queens on a n × n chessboard so that
no two queens are on the same row, column, or diagonal

(1, 1)

(n, n)
{
1 if a queen is placed at cell (i, j),
xij =
0 otherwise.
Modeling Basic modeling techniques

Application: n-queen problem (cont.)


Problem description:
Place n queens on a n × n chessboard so that
no two queens are on the same row, column, or diagonal

T(i, j) = {(h, k) ∈ {1, . . . , n}2 | h = i or k = j or |h−i| = |k−j|}\{(i, j)}


If a queen is placed at cell (i, j),
then no queen can be placed in any cell of T(i, j)
Modeling Basic modeling techniques

Application: n-queen problem (cont.)

T(i, j) = {(h, k) ∈ {1, . . . , n}2 | h = i or k = j or |h−i| = |k−j|}\{(i, j)}

If a queen is placed at cell (i, j),


then no queen can be placed in any cell of T(i, j)

i.e., ∑
If xij = 1, then xhk = 0
(h,k)∈T(i,j)

Formulation: ∑
xhk ≤ |T(i, j)|(1 − xij )
(h,k)∈T(i,j)
Modeling Basic modeling techniques

Outline

Implicit 0-1 variables

Logical implication involving binary variables

Logical implication involving integer variables


Modeling Basic modeling techniques

Logical implication involving integer variables

Setting: a logical implication involving integer variables


Modeling framework:
xi = 1 if x = i, otherwise xi = 0
Reformulate the implication using new binary variables
Express the implication as linear constraint
Example:
“if 1 ≤ x ≤ 4 and y ∈ {1, 3, 6}, then z = 2 or 5 ≤ z ≤ 8”
Reformulate:

4 ∑
8
“if xi = 1 and y1 + y3 + y6 = 1, then z2 + zi = 1”
i=1 i=5
Linear expression:
( )

4 ∑
8
(1 − xi ) + (1 − (y1 + y3 + y6 )) ≥ 1 − z2 + zi
i=1 i=5
Modeling Advanced modeling techniques

Contents

1. Formulation

2. Modeling
General framework
Basic modeling techniques
Advanced modeling techniques

3. Solution method
Total unimodularity
Branch-and-bound
Modeling Advanced modeling techniques

Outline

Linearization of quadratic 0-1 variables

Polynomials of binary variables

Disjunctive constraints
Modeling Advanced modeling techniques

Linearization of quadratic 0-1 variables

Setting: x1 , x2 , y are binary variables constrained by y = x1 x2


Linearization:
“y = 1 if and only if x1 = 1 and x2 = 1”
can be exactly expressed by
y ≤ x1 (if y = 1 then x1 = 1)
y ≤ x2 (if y = 1 then x2 = 1)
x1 + x2 ≤ 1 + y (if x1 = 1 and x2 = 1 then y = 1)

x1
0

1
x2
Modeling Advanced modeling techniques

Outline

Linearization of quadratic 0-1 variables

Polynomials of binary variables

Disjunctive constraints
Modeling Advanced modeling techniques

Polynomials of binary variables


Setting: f(x) is a polynomial of x ∈ {0, 1}n
Transform to linear representation
Replace each x∏kj by xj (since xkj = xj for xj ∈ {0, 1})
Replace each j∈Q xj by a new variable xQ satisfying

“xQ = 1 if and only if xj = 1 ∀j ∈ Q”, and


“xQ = 0 if at least one xj = 0”

Representation 1: xQ ∈ {0, 1} satisfying


∑ ∑
xj ≤ xQ + |Q| − 1 and |Q|xQ ≤ xj
i∈Q i∈Q

Example: Consider f(x) = x21 x32 x3 with x1 , x2 , x3 ∈ {0, 1}. We have


f(x) = x1 x2 x3 =: x∗
with
x1 + x2 + x3 ≤ x∗ + 2 and 3x∗ ≤ x1 + x2 + x3
Modeling Advanced modeling techniques

Polynomials of binary variables


Setting: f(x) is a polynomial of x ∈ {0, 1}n
Transform to linear representation
Replace each x∏kj by xj (since xkj = xj for xj ∈ {0, 1})
Replace each j∈Q xj by a new variable xQ satisfying

“xQ = 1 if and only if xj = 1 ∀j ∈ Q”, and


“xQ = 0 if at least one xj = 0”

Representation 2: xQ ∈ {0, 1} satisfying



xj ≤ xQ + |Q| − 1 and xQ ≤ xj ∀j ∈ Q
i∈Q

Example: Consider f(x) = x21 x32 x3 with x1 , x2 , x3 ∈ {0, 1}. We have


f(x) = x1 x2 x3 =: x∗
with
x1 + x2 + x3 ≤ x∗ + 2 and x∗ ≤ x1 , x∗ ≤ x2 , x∗ ≤ x3
Modeling Advanced modeling techniques

Polynomials of binary variables


Setting: f(x) is a polynomial of x ∈ {0, 1}n
Transform to linear representation
Replace each x∏kj by xj (since xkj = xj for xj ∈ {0, 1})
Replace each j∈Q xj by a new variable xQ satisfying
“xQ = 1 if and only if xj = 1 ∀j ∈ Q”, and
“xQ = 0 if at least one xj = 0”
Representation 3: xQ ≥ 0 satisfying
∑ ∑
xj ≤ xQ + |Q| − 1 and xQ ≤ |Sj |xj ∀j ∈ Q
i∈Q Q∈Sj

where Sj is the collection of sets Q that contain j


Example: For f(x) = x21 x32 x3 + x1 x23 x34 with x ∈ {0, 1}4 , we have
f(x) = x1 x2 x3 + x1 x3 x4 = x123 + x134 , with
x1 + x2 + x3 ≤ x123 + 2, x1 + x3 + x4 ≤ x134 + 2,
x123 + x134 ≤ 2x1 , x123 ≤ x2 , x123 + x134 ≤ 2x3 , x124 ≤ x4
Modeling Advanced modeling techniques

Application: Idle-slot counting function

.
Definition
.
Let x = (x1 , . . . , xn ) ∈ {0, 1}n .
Component xi is an idle slot if xi = 0 and

. xu = xv = 1 for some u ∈ {1, . . . , i − 1} and v ∈ {i + 1, . . . , n}.

Examples:
x = (1, 0, 1, 0, 1): x2 and x4 are idle slots
x = (0, 1, 0, 0, 1): x3 and x4 are idle slots, x1 is not
Modeling Advanced modeling techniques

Application: Idle-slot counting function (cont.)


.
Definition
.
The function

f : {0, 1}n → Z+
x 7→ number of idle slots in x

is
. called idle-slot counting function
Examples:
x Value f(x) x Value f(x)
x1 (0, 0, 0, 0) 0 x9 (1, 0, 0, 0) 0
x2 (0, 0, 0, 1) 0 x10 (1, 0, 0, 1) 2
x3 (0, 0, 1, 0) 0 x11 (1, 0, 1, 0) 1
x4 (0, 0, 1, 1) 0 x12 (1, 0, 1, 1) 1
x5 (0, 1, 0, 0) 0 x13 (1, 1, 0, 0) 0
x6 (0, 1, 0, 1) 1 x14 (1, 1, 0, 1) 1
x7 (0, 1, 1, 0) 0 x15 (1, 1, 1, 0) 0
x8 (0, 1, 1, 1) 0 x16 (1, 1, 1, 1) 0
Modeling Advanced modeling techniques

Application: Idle-slot counting function (cont.)

Goal: IP formulation for idle-slot counting function


Linearization technique:
Express
∑ ∏ ∏
f(x) = f(v)χv (x) in which χv (x) = xj (1−xj )
v∈{0,1}n j:vij =1 j:vij =0

(in form of polynomial of binary variables)


Note that χv (x) ∈ {0, 1}, and χv (x) = 1 ⇔ x = v
Linearize f by 3 mentioned representations
Modeling Advanced modeling techniques

Example
x Value f(x) x Value f(x)
x1 (0, 0, 0, 0) 0 x9 (1, 0, 0, 0) 0
x2 (0, 0, 0, 1) 0 x10 (1, 0, 0, 1) 2
x3 (0, 0, 1, 0) 0 x11 (1, 0, 1, 0) 1
x4 (0, 0, 1, 1) 0 x12 (1, 0, 1, 1) 1
x5 (0, 1, 0, 0) 0 x13 (1, 1, 0, 0) 0
x6 (0, 1, 0, 1) 1 x14 (1, 1, 0, 1) 1
x7 (0, 1, 1, 0) 0 x15 (1, 1, 1, 0) 0
x8 (0, 1, 1, 1) 0 x16 (1, 1, 1, 1) 0

f(x) = χ6 (x) + 2χ10 (x) + χ11 (x) + χ12 (x) + χ14 (x)
in which
χ6 (x) = (1 − x1 )x2 (1 − x3 )x4
χ10 (x) = x1 (1 − x2 )(1 − x3 )x4
χ11 (x) = x1 (1 − x2 )x3 (1 − x4 )
χ12 (x) = x1 (1 − x2 )x3 x4
χ14 (x) = x1 x2 (1 − x3 )x4
Modeling Advanced modeling techniques

Example: Representation 1

f = χ6 + 2χ10 + χ11 + χ12 + χ14


(1 − x1 ) + x2 + (1 − x3 ) + x4 ≤ χ6 + 3
(1 − x1 ) + x2 + (1 − x3 ) + x4 ≥ 4χ6
x1 + (1 − x2 ) + (1 − x3 ) + x4 ≤ χ10 + 3
f = χ6 + 2χ10 + χ11 + χ12 + χ14
x1 + (1 − x2 ) + (1 − x3 ) + x4 ≥ 4χ10
χ6 = (1 − x1 )x2 (1 − x3 )x4
x1 + (1 − x2 ) + x3 + (1 − x4 ) ≤ χ11 + 3
χ10 = x1 (1 − x2 )(1 − x3 )x4
x1 + (1 − x2 ) + x3 + (1 − x4 ) ≥ 4χ11
χ11 = x1 (1 − x2 )x3 (1 − x4 )
x1 + (1 − x2 ) + x3 + x4 ≤ χ12 + 3
χ12 = x1 (1 − x2 )x3 x4
x1 + (1 − x2 ) + x3 + x4 ≥ 4χ12
χ14 = x1 x2 (1 − x3 )x4
x1 + x2 + (1 − x3 ) + x4 ≤ χ14 + 3
x1 + x2 + (1 − x3 ) + x4 ≥ 4χ14
x1 , x2 , x3 , x4 ∈ {0, 1}
χ6 , χ10 , χ11 , χ12 , χ14 ∈ {0, 1}.
Modeling Advanced modeling techniques

Example: Representation 2

f = χ6 + 2χ10 + χ11 + χ12 + χ14


(1 − x1 ) + x2 + (1 − x3 ) + x4 ≤ χ6 + 3
1 − x1 , x2 , 1 − x3 , x4 ≥ χ6
x1 + (1 − x2 ) + (1 − x3 ) + x4 ≤ χ10 + 3
f = χ6 + 2χ10 + χ11 + χ12 + χ14
x1 , 1 − x2 , 1 − x3 , x4 ≥ χ10
χ6 = (1 − x1 )x2 (1 − x3 )x4
x1 + (1 − x2 ) + x3 + (1 − x4 ) ≤ χ11 + 3
χ10 = x1 (1 − x2 )(1 − x3 )x4
x1 , 1 − x2 , x3 , 1 − x4 ≥ χ11
χ11 = x1 (1 − x2 )x3 (1 − x4 )
x1 + (1 − x2 ) + x3 + x4 ≤ χ12 + 3
χ12 = x1 (1 − x2 )x3 x4
x1 , 1 − x2 , x3 , x4 ≥ χ12
χ14 = x1 x2 (1 − x3 )x4
x1 + x2 + (1 − x3 ) + x4 ≤ χ14 + 3
x1 , x2 , 1 − x3 , x4 ≥ χ14
x1 , x2 , x3 , x4 ∈ {0, 1}
χ6 , χ10 , χ11 , χ12 , χ14 ∈ {0, 1}.
Modeling Advanced modeling techniques

Example: Representation 3

f = χ6 + 2χ10 + χ11 + χ12 + χ14


χ6 + 3 ≥ (1 − x1 ) + x2 + (1 − x3 ) + x4
χ10 + 3 ≥ x1 + (1 − x2 ) + (1 − x3 ) + x4
χ11 + 3 ≥ x1 + (1 − x2 ) + x3 + (1 − x4 )
χ12 + 3 ≥ x1 + (1 − x2 ) + x3 + x4
f = χ6 + 2χ10 + χ11 + χ12 + χ14 χ14 + 3 ≥ x1 + x2 + (1 − x3 ) + x4
χ6 = (1 − x1 )x2 (1 − x3 )x4 4x1 ≥ χ10 + χ11 + χ12 + χ14
χ10 = x1 (1 − x2 )(1 − x3 )x4 2x2 ≥ χ6 + χ14
χ11 = x1 (1 − x2 )x3 (1 − x4 ) 2x3 ≥ χ11 + χ12
χ12 = x1 (1 − x2 )x3 x4 4x4 ≥ χ6 + χ10 + χ12 + χ14
χ14 = x1 x2 (1 − x3 )x4 1 − x 1 ≥ χ6
3(1 − x2 ) ≥ χ10 + χ11 + χ12
3(1 − x3 ) ≥ χ6 + χ10 + χ14
1 − x4 ≥ χ11
x1 , x2 , x3 , x4 ∈ {0, 1}
χ6 , χ10 , χ11 , χ12 , χ14 ∈ {0, 1}.
Modeling Advanced modeling techniques

Outline

Linearization of quadratic 0-1 variables

Polynomials of binary variables

Disjunctive constraints
Modeling Advanced modeling techniques

Disjunctive constraints

Setting: x ∈ Rn satisfies 0 ≤ x ≤ u, and at x ≤ b OR ct x ≤ d


Linear representation of the disjunction:
Let M = max0≤x≤u {at x − b, ct x − d}
Introduce binary variables y1 , y2
Expression

at x − b ≤ My1
ct x − d ≤ My2
y1 + y2 = 1
y1 , y2 ∈ {0, 1}
0≤x≤u

Example: Linearly represent

1 ≤ |z| ≤ 8

in which z ∈ R
Modeling Advanced modeling techniques

Example: Linearize 1 ≤ |z| ≤ 8, z ∈ R


{ {
+ z if z > 0, − 0 if z ≥ 0,
z = z =
0 if z ≤ 0, −z if z < 0,
{ {
1 if z > 0, 1 if z < 0,
a+ = a− =
0 if z ≤ 0, 0 if z ≥ 0.

Since |z| = z+ + z− , non-linear constraint

1 ≤ |z| ≤ 8, y ∈ R

can be linearized by

z+ − z− = z
z+ + z− ≥ 1
a+ ≤ z+ ≤ 8a+
a− ≤ z− ≤ 8a−
a+ + a− = 1
z+ , z− ∈ R
a+ , a− ∈ {0, 1}
Modeling Advanced modeling techniques

Application: another formulation for Sudoku

Setting:

(1, 1)

(9, 9)

xij = value filled into cell (i, j)


Modeling Advanced modeling techniques

Application: another formulation for Sudoku (cont.)

Modeling constraints concerning given clues:


xij = gij ∀(i, j) ∈ F
8 9
1 3 9 in which
5 2 4
F = {(i, j) | cell with clue}
2 6 8
gij = clue in cell (i, j)
9 7 6 5
3 6 5 For example:
1 3 5
8 7 1
x17 = 8
4 5 x18 = 9
...
xij = value filled into cell (i, j) x93 = 5
Modeling Advanced modeling techniques

Application: another formulation for Sudoku (cont.)

On each row, different cells have different values

Row 1 for instance:


8 9
x1j ̸= x1k ∀1 ≤ j < k ≤ 9
1 3 9
5 2 4 i.e.,
2 6 8
9 7 6 5
|x1j − x1k | ≥ 1 ∀1 ≤ j < k ≤ 9
3 6 5
Note that we always have
1 3 5
8 7 1 |x1j − x1k | ≤ 8 ∀1 ≤ j < k ≤ 9
4 5
In general:

xij = value filled into cell (i, j) |xij −xik | ≥ 1 ∀i, j, k = 1, . . . , 9, j < k
Modeling Advanced modeling techniques

Application: another formulation for Sudoku (cont.)

On each column, different cells have different values

8 9
1 3 9
5 2 4
2 6 8
9 7 6 5
|xij − xkj | ≥ 1
3 6 5
∀i, j, k = 1, . . . , 9, i < k
1 3 5
8 7 1
4 5

xij = value filled into cell (i, j)


Modeling Advanced modeling techniques

Application: another formulation for Sudoku (cont.)

On each block, different cells have different values

8 9
1 3 9
5 2 4
|xp+i,q+j − xp+k,q+ℓ | ≥ 1
2 6 8
∀(p, q) ∈ B
6
9 7 5
∀i, j, k, ℓ ∈ {0, 1, 2} :
3 6 5 3i + j < 3k + ℓ
1 3 5
7 1
in which
8
B = {top left cell of each block}
4 5

xij = value filled into cell (i, j)


Modeling Advanced modeling techniques

Application: another formulation for Sudoku (cont.)

F is the set of clue cells


g(i, j) is clue inside cell (i, j)
S = {1, . . . , 9},
B = {(1, 1), (1, 4), (1, 7), (4, 1), (4, 4), (4, 7), (7, 1), (7, 4), (7, 7)}

xij = g(i, j) ∀(i, j) ∈ F


|xij − xik | ≥ 1 ∀i, j, k ∈ S, j < k
|xij − xkj | ≥ 1 ∀i, j, k ∈ S, i < k
|xp+i,q+j − xp+k,q+ℓ | ≥ 1 ∀(p, q) ∈ B,
i, j, k, ℓ ∈ {0, 1, 2} : 3i + j < 3k + ℓ
xij ∈ S ∀i, j ∈ S
Solution method Total unimodularity

Contents

1. Formulation

2. Modeling
General framework
Basic modeling techniques
Advanced modeling techniques

3. Solution method
Total unimodularity
Branch-and-bound
Solution method Total unimodularity

Outline

Motivation

Totally unimodular matrix

Applications
Solution method Total unimodularity

Motivation

Integer program (standard formulation):

(IP) max ct x s.t. Ax ≤ b, x ∈ Zn+

Linear relaxation:

(LP) max ct x s.t. Ax ≤ b, x ∈ Rn+

Feasible set P := {x ∈ Rn | Ax ≤ b, x ≥ 0} is polyhedral

.
Observation
.
If P is integral, then the optimal solution of (LP) is integral,
and
. hence the solution also solves (IP)

Question:
When P is integral?
Solution method Total unimodularity

Outline

Motivation

Totally unimodular matrix

Applications
Solution method Total unimodularity

Totally unimodular matrix

.
Definition
.
A matrix A is called totally unimodular
. every square submatrix of it has determinant 1, −1, or 0
if

Examples:
 
1 −1 0
0 1 −1 is totally unimodular
−1 0 1
 
1 1 0
0 1 1is not totally unimodular
1 0 1
Solution method Total unimodularity

Sufficient condition for total unimodularity

.
Proposition
.
A matrix A = (aij )m×n is totally unimodular if the following three
conditions hold together.
(i) aij ∈ {0, 1, −1} for all i = 1, . . . , m and j = 1, . . . , n.
(ii) At
∑mmost two nonzero entries exist on each column, i.e.,
i=1 |aij | ≤ 2 for all j = 1, . . . , n.
(iii) The set R = {1, . . . , m} of rows can be partitioned into two
subsets R1 , R2 such that each column j ∈ {1, . . . , n}
containing two nonzero entries satisfies
∑ ∑
aij − aij = 0.
. i∈R 1 i∈R2
Solution method Total unimodularity

Corollaries

.
Theorem
.
The node-edge incidence matrices of bipartite graphs
are
. totally unimodular

 
1 1 0 0 0 0 1 4
0 0 1 1 0 0
 
0 0 0 0 1 1
 
0 0 1 0 0 0
  2 5
1 0 0 1 1 0
0 1 0 0 0 1
3 6
Solution method Total unimodularity

Corollaries

.
Theorem
.
The node-arc incidence matrix of every simple directed graph
is
. totally unimodular

 
−1 −1 0 0 1 0 1 2
1 0 −1 −1 0 0
 
0 0 1 0 −1 1 
0 1 0 1 0 −1
3 4
Solution method Total unimodularity

Main theorem

Question (recall):
When P := {x ∈ Rn | Ax ≤ b, x ≥ 0} is integral?

.
Theorem
.
A matrix A ∈ Zm×n is totally unimodular if and only if the polyhedron
.{x ∈ R | Ax ≤ b, x ≥ 0} is integral for each vector b ∈ Z
n m
Solution method Total unimodularity

Outline

Motivation

Totally unimodular matrix

Applications
Solution method Total unimodularity

Application 1: Minimum cost flow problem

Given a simple directed graph G = (V, A)


Each arc (i, j) ∈ A has capacity hij and unit flow cost cij
Each node i has demand bi
Goal:
find a feasible flow satisfying all the demands at minimum cost

600
2 30 4
100
70 400
800 60
10

900 1 600 30 6 -900

50 30
600 300 600
10
60
3 400 5

x = (x12 , x13 , x24 , x25 , x34 , x35 , x45 , x46 , x56 )


= (300, 600, 300, 0, 300, 300, 300, 300, 600)
is a feasible flow of cost 108000
Solution method Total unimodularity

Application 1: Minimum cost flow problem

Variables: xij = flow on arc (i, j)


Formulation:

(MCNF) min cij xij (1)
(i,j)∈A
∑ ∑
s.t. xik − xki = bi ∀i ∈ V (2)
k∈δ + (i) k∈δ − (i)

0 ≤ xij ≤ hij ∀(i, j) ∈ A (3)

.
Proposition
.
Let Mx ≤ b, x ≥ 0 be the matrix form of the constraints of (MNCF).
Then
. the matrix M is totally unimodular.
.
Theorem
.
If bi ∈ Z for all i ∈ V and hij ∈ Z for all (i, j) ∈ A, the optimal solutions of
(MCNF)
. are integral.
Solution method Total unimodularity

Application 2: Shortest path problem

Given a simple directed graph G = (V, A)


Each arc (i, j) ∈ A has length cij
s, t are two distinguished nodes in G
Goal: find a path from s to t of minimum length

3
2 4

2 6

s 1 5 1 4 6 t

8 2

5
3 5

Path 1 − 2 − 3 − 5 − 4 − 6 is a s-t path of length 2 + 5 + 5 + 4 + 6 = 22


Solution method Total unimodularity

Application 2: Shortest path problem

Variables:
{
1 if arc (i, j) is in the shortest path from s to t
xij =
0 otherwise

IP formulation:

(SPIP ) min cij xij (4)
(i,j)∈A
∑ ∑
s.t. xsj − xjs = 1 (5)
j∈δ + (s) j∈δ − (s)
∑ ∑
xtj − xjt = −1 (6)
j∈δ + (t) j∈δ − (t)
∑ ∑
xij − xji = 0 ∀i ∈ N\{s, t} (7)
j∈δ + (i) j∈δ − (i)

xij ∈ {0, 1} ∀(i, j) ∈ A (8)


Solution method Total unimodularity

Application 2: Shortest path problem

LP relaxation:

(SPLP ) min cij xij
(i,j)∈A
∑ ∑
s.t. xsj − xjs = 1
j∈δ + (s) j∈δ − (s)
∑ ∑
xtj − xjt = −1
j∈δ + (t) j∈δ − (t)
∑ ∑
xij − xji = 0 ∀i ∈ N\{s, t}
j∈δ + (i) j∈δ − (i)

0 ≤ xij ≤ 1 ∀(i, j) ∈ A (9)

.
Theorem
.
The optimal solutions of the linear program (SPLP ) are integral, hence
.any optimal solution of (SPLP ) is also an optimal solution of (SPIP ).
Solution method Branch-and-bound

Contents

1. Formulation

2. Modeling
General framework
Basic modeling techniques
Advanced modeling techniques

3. Solution method
Total unimodularity
Branch-and-bound
Solution method Branch-and-bound

B&B method in 2D: an example

Input: a knapsack and


two item types

Weight Value
Type 1 3 kg 3$
Type 2 5 kg 4$

Constraints:
at most 4 items
at most 15 kg
Objective: bring
maximum value
Solution method Branch-and-bound

B&B method in 2D: an example

x1 = number of items of type 1 Input: a knapsack and


x2 = number of items of type 2 two item types

Weight Value
max 3x1 + 4x2 Type 1 3 kg 3$
subject to Type 2 5 kg 4$
x1 + x2 ≤ 4
Constraints:
3x1 + 5x2 ≤ 15
at most 4 items
x1 , x2 ∈ Z+ at most 15 kg
Objective: bring
maximum value
Solution method Branch-and-bound

B&B method in 2D: an example

x1 = number of items of type 1 x2


x2 = number of items of type 2

4
max 3x1 + 4x2
3
subject to
2
x1 + x2 ≤ 4
3x1 + 5x2 ≤ 15 1
x1 , x2 ∈ Z+
0 1 2 3 4 5 x1
Solution method Branch-and-bound

B&B method in 2D: an example

LP relaxation x2

4
max 3x1 + 4x2
3
subject to
x1 + x2 ≤ 4 2 (2.5, 1.5)
3x1 + 5x2 ≤ 15 1
Z
Z
x1 , x2 ∈ + R
Z
0 1 2 3 4 5 x1
Solution method Branch-and-bound

B&B method in 2D: an example

(P1 ) max 3x1 + 4x2


subject to
x1 + x2 ≤ 4 x2
3x1 + 5x2 ≤ 15
x1 ≤ ⌊2.5⌋
4
x1 , x2 ∈ R
3
2
(P2 ) max 3x1 + 4x2
subject to 1
x1 + x2 ≤ 4
0 1 2 3 4 5 x1
3x1 + 5x2 ≤ 15
x1 ≥ ⌈2.5⌉
x1 , x2 ∈ R
Solution method Branch-and-bound

B&B method in 2D: an example

(P1 ) max 3x1 + 4x2 x2


subject to
x1 + x2 ≤ 4
4
3x1 + 5x2 ≤ 15
x1 ≤ ⌊2.5⌋ 3
(2, 95 )
x1 , x2 ∈ R 2
(3, 1)
1 opt = 13

(P2 ) max = 13
0 1 2 3 4 5 x1
at (x1 , x2 ) = (3, 1) ∈ Z2
Solution method Branch-and-bound

B&B method in 2D: an example

(P1.1 ) max 3x1 + 4x2


subject to
x1 + x2 ≤ 4 x2
3x1 + 5x2 ≤ 15
x1 ≤ ⌊2.5⌋
x2 ≤ ⌊1.8⌋ 4
x1 , x2 ∈ R
3
(P1.2 ) max 3x1 + 4x2
2
subject to
(3, 1)
x1 + x2 ≤ 4 1 opt = 13
3x1 + 5x2 ≤ 15
x1 ≤ ⌊2.5⌋
0 1 2 3 4 5 x1
x2 ≥ ⌈1.8⌉
x1 , x2 ∈ R

(P2 ) max = 13
at (x1 , x2 ) = (3, 1) ∈ Z2
Solution method Branch-and-bound

B&B method in 2D: an example

x2

(P1.2.1 ) max 3x1 + 4x2


subject to 4
x1 + x2 ≤ 4
3x1 + 5x2 ≤ 15 3
x1 ≤ 1
2
x2 ≥ 2
(3, 1)
x1 , x2 ∈ R 1 opt = 13

(P2 ) max = 13
0 1 2 3 4 5 x1
at (x1 , x2 ) = (3, 1) ∈ Z2
Solution method Branch-and-bound

B&B method in 2D: an example

x2

(P1.2.1.1 ) max = 12
4
at (x1 , x2 ) = (0, 3) ∈ Z2 (0, 3)
3 opt = 12

(P1.2.1.1 ) max = 11
2
at (x1 , x2 ) = (1, 2) ∈ Z2 (1, 2)
(3, 1)
opt = 11
1 opt = 13
(P2 ) max = 13
at (x1 , x2 ) = (3, 1) ∈ Z2 0 1 2 3 4 5 x1
Solution method Branch-and-bound

B&B method in 2D: an example

x2

4
max = 13 3
2
at (x1 , x2 ) = (3, 1) ∈ Z 2
(3, 1)
1 opt = 13

0 1 2 3 4 5 x1
Solution method Branch-and-bound

Branch-and-bound method

Initialization: z∗ := −∞, B & B(P0 )


Procedure B & B(Pk )
1: Consider the continuous relaxation Rk of Pk
2: if Rk is infeasible then return
3: Calculate an optimal solution xk of Rk and its value zk
4: if zk ≤ z∗ then return
5: if xk is integer then
6: z∗ := zk ; s∗ := xk
7: else
8: Choose a variable xki ̸∈ N
9: P′k := Pk + {xi ≥ ⌊xki ⌋ + 1}
10: P′′k := Pk + {xi ≤ ⌊xki ⌋}
11: B & B(P′k )
12: B & B(P′′k )
13: end if
Thanks

Thank you for your attention!

You might also like