Lecture 6 – Integer Programming Models Topics • General model • Logic constraint • Defining decision variables • Continuous vs.

Download Report

Transcript Lecture 6 – Integer Programming Models Topics • General model • Logic constraint • Defining decision variables • Continuous vs.

Lecture 6 – Integer Programming Models

Topics • General model • Logic constraint • Defining decision variables • Continuous vs. integral solution • Applications: staff scheduling, fixed charge, TSP • Piecewise linear approximations to nonlinear functions

Linear Integer Programming - IP

Maximize/Minimize z = c 1

x

1 s.t. a i1

x

1 + a i2

x

2 +    + a

in x n

+ c 2

x

2 {   = } +    + c

n x n b i

, i = 1,…,m 0 

x j

u j

, j = 1,…,n

x j

integer for some or all j =1,…,n

Decision Variables in IP Models

 An IP is a mixed integer program (MIP) if some but not all of the decision variables are integer.  If all decision variables are integer we have a pure IP.

 A binary decision variable must be 0 or 1 (a yes-no decision variable).

 If all decision variables are binary, then the IP is a binary IP ( BIP )  Decision variables that are not required to be integer-valued are continuous variables

Why study integer programming?

(1) The LP divisibility assumption (fractional solutions are permissible) is not always valid.

(2) Binary variables allow powerful new techniques like logical constraints.

Call Center Employee Scheduling

• Day is divided into 6 periods, 4 hours each • Demand/period = {15, 10, 40, 70, 40, 35} • Workforce consists of full-timers (FT) and part timers (PT) – FT = 8-hour shift, $121.6/ shift – PT = 4-hr shift, $51.8/shift • One PT = 5/6 FT • • In any period, at least 2/3 of the staff must be FT employees (this is a headcount constraint) Problem : Find minimum cost workforce

Call Center Employee IP Model

Decision variables :

x y t t

= # of full-time employees that begin the day at the start of interval t and work for 8 hours = # of part-time employees that are assigned interval t Min z = 121.6(x 1 + . . . +x 6 ) + 51.8(y 1 + . . .

+y 6 ) s.t. x 1

x x

1 5 + x 6 + 5 6 + x ...

2 + x 6 + 5 6 + 5 6

y

1

y y

2 6    15 10 35

x

1

x

5 + x ...

6 + x 6   2 3 2 3 (x (x 1 5 + x 6 + x 6 + y 1 ) + y 6 )

x t

 0, y

t

 0, t = 1,2,…,6

Optimal LP solution

x = ( 7.06, 0, 40, 12.94, 27.06, 7.94 ) y = ( 0, 3.53, 0, 20.47, 0, 0 ) z = 12,795.2 Not feasible to IP model A correction method: round continuous solution x = ( 8, 0, 40, 13, 27, 8 ) y = ( 0, 3, 0, 21, 0, 0 ) z = 12,916.8

Feasible –

Yes

, Optimal?

We do not know!

How good is this solution?

z

* LP = 12,795.2 is a

lower bound

on integer optimum Hence, the rounded solution is no more than ( 12,916.8 – 12,795.2

12,795.2

)  100% = 0.95% from the optimum.

Optimal solution is x = ( 10, 0, 40, 20, 20, 5 ) y = ( 10, 0, 0, 12, 0, 12 )

z

* IP = 12,795.2

• Here the optimal LP and IP objective functions have the same value.

• This is not commonly true.

Sometimes there is no “obvious” feasible solution that can be obtained by rounding X 2                 optimal LP solution      X 1 iso-cost line optimal IP solution The IP solution can be “far” from the LP rounded solution even when the rounded solution is feasible.

The Days-Off Scheduling Problem

Each employee works 5 days per week and is given 2 consecutive days off [ (5,7)-cycle problem]

c j r i x j

= weekly cost of pattern j per employee = number of employees required on day i = number of employees assigned to days-off pattern j Note : There are 7 days-off patterns; i, j = 1,…,7 Pattern i has days i and i + 1 off .

For example, pattern 3 would be: (Mon, Tue, off, off, Thu, Fri, Sat, Sun)  (1, 1, 0, 0, 1, 1, 1)

Days-Off Mathematical Model

Minimize

z

=

j

7  = 1

c x j j

subject to

j

7  = 1

x j

 

i x i

 1 

r i

,

i

= 1,..., 7

x j

 0 and integer, j = 1,…,7; x 0 = x 7 Solve problem to get

x

*

j

Minimum cost workforce

W

=

j

7  = 1

x

*

j

Compact Mathematical Model

Minimize z = cx subject to 0         0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0         

r x

0 and integer

Logic Constraints

Either-or constraints Either f 1 (x 1 ,…,x

n

) 

b

1 or f 2 (x 1 ,…,x

n

) 

b

2 or both IP formulation Let y  {0,1}; M = “large” number

f

1 (x 1 ,…,x

n

) 

b

1 + M y

f

2 (x 1 ,…,x

n

) 

b

2 + M (1 – y) y = 0  first constraint must hold y = 1  second constraint must hold Optimization process will choose the

y

value.

K

out of

N

constraints must hold

N constraints

f

1 (x 1 ,…,x

n

) 

b

1 

f N

(x 1 ,…,x

n

) 

b N

At least

K

out of

N

must be satisfied.

f

1 (x 1 ,…,x

n

) 

b

1 + M (1 – y 1 ) 

f N

(x 1 ,…,x

n

) 

b N

+ M (1 – y

N

)

N

S

i

=1

y i

= K

y i

 {0, 1}, i = 1,…,N

Example of

K

out of

N

Constraints

• A production system has

N

potential quality control inspection strategies.

• Management has decided that

K

of these strategies should be adopted.

Compound Alternatives (Choice constraints for one region only)

f

1 (x 1 ,…,x

n

) 

f

2 (x 1 ,…,x

n

) 

b

1 + M (1 –

b

2 + M (1 –

y

1 )

y

1 ) } Region 1 constraints

f

3 (x 1 ,…,x

n

) 

f

4 (x 1 ,…,x

n

) 

b

3 + M (1 –

b

4 + M (1 –

y

2 )

y

2 ) } Region 2 constraints

f

5 (x 1 ,…,x

n

) 

f

6 (x 1 ,…,x

n

) 

b

5 + M (1 –

b

6 + M (1 –

y

3 )

y

3 ) } Region 3 constraints

y

1 + y 2 + y 3 = 1, y 1 , y 2 , y 3  {0,1}

Min

Fixed-Charge Problem

n

j =1

h j

(x

j

), where h

j

(x

j

) = {

f j

+ c

j x j

if x

j

> 0 0 if x

j

= 0 and f

j

= setup cost, c

j

= per unit cost IP formulation : Min

n

j =1 (c

j x j

+ f

j y j

) s.t.

x j

My j

,

y j

 {0,1} ,

x j

 0, j = 1,…,n j = 1,…,n j = 1,…,n

Example: Facility Location Problem

A company has customers

m

potential warehouse sites and

n

Data :

d j

: demand for customer j

s i

: capacity (supply) of warehouse i Decision variables :

y i

: build a warehouse at site i (1 = yes, 0 = no)

x ij

: shipments from warehouse

i

to customer

j

Facility Location IP Model

Min

m

i =1

n

j =1

c ij x ij

+

m

i =1

f i y i

s.t.

m

i =1

x ij

=

d j n

j =1

x ij

s i y i

j = 1,…,n i = 1,…,m Satisfy each customer’s demand each warehouse can ship no more than its supply if it is built

x ij

 0, i = 1,…,m, j = 1,…,n

y i

 {0,1}, i = 1,…,m

Uncapacitated Facility Location Problem

Problem : Open set of facilities and assign each customer to one facility such that cost is minimized. Cost could be a function of distance from facility to customer or could be based on a response time (e.g., locating fire stations) .

Notation

Indices/Sets potential facility locations, iI with |I | = m customers, jJ with |J | = n Data

f i

: cost of opening a facility at location i

c ij

: cost of assigning customer j to facility i Decision variables

y i

: open facility at location i (1 = yes, 0 = no)

x ij

: assign customer j to location i (1 = yes, 0 = no)

Weak Formulation

Min  

c ij x ij i

I j

J

+ 

i

I f i y i

s.t.

i

I x ij

= 1, "

j

J

j

J x ij

ny i

, "

i

I

if y

i

= 0

, x ij

for all

j

J; must be 0 if y

i

= 1, up to n of the x

ij

can be 1.

x ij

 {0,1}, y

i

 {0,1} "

i

I, j

J

 Not computationally efficient

Mathematically Equivalent Strong Formulation

Min s.t.

 

c ij x ij i

I j

J

+ 

i

I f i y i

x ij i

I

= 1, "

j

J

Each customer is assigned to exactly one facility

x ij

y i

, "

i

I, j

J

Setup constraint

x ij

 {0,1} y

i

 {0,1} , "

i

I, j

J

Can assign customer j to facility i only if we open facility i.

Set Covering Problem (Airline Crew Scheduling) • 3 crews -- each must be assigned a sequence of flights that begins and ends in Dallas ( DFW ) • Each flight leg must be covered Possible tours Leg

DFW

DFW

DFW

LAX DEN SEA LAX

CHI LAX

DFW CHI

CHI

DEN SEA DEN

DEN

DFW CHI SEA

SEA

DFW LAX Cost ($10000) 1 1

2

2 2 1 2 3 3 1 2 4 4 1 2 3 4 6 5 1 3 4 2 7 6 1 3 2 5 7 1 2 3 4 7 8 1 3 2 4 8 9 1 3 4 10 11 12 1 1 2 5 5 1 3 3 3 4 5 2 2 9 4 9 4 8 5 2 9

Decision variables

x j

( j =1,…,12) assign a crew to tour j (1 = yes, 0 = no)

Formulation (set covering problem) Min 2x 1 + 3x 2 + 4x 3 + … + 8x 11 + 9x 12 s.t. x 1

x

2

x

3

x

4

x

1 +x 4 +x 5 +x 6 +x 7 +x 6 +x +x 9 7 +x 8 +x 9 +x 10 + x 10 + x 11 + x 12 + x 10 + x 12 + x 11

x

6

x

1      1 1 1 1 1 (DFW  LAX) (DFW  (DFW  (LAX  DEN) SEA) CHI) (LAX  DFW) +x 9 +x 2  +x 10 + x 11 + x 12 + … + x 12

x j

   1 = 3  (SEA  {0,1}, j = 1,…,12 LAX) (assign 3 crews) side constraint Allows “ dead heading ”; i.e., multiple crews fly on 1 leg but only 1 crew works ( all get paid ).

Traveling Salesman Problem (TSP)

1 2 4 3

Problem : Find minimum distance tour that starts at city 1, visits every other city exactly once , and returns to city 1.

Decision variables

x ij

= 1 if tour includes arc (i, j ) = 0 otherwise Initial formulation Min 50x 12 + 44x 13 + 25x 14 + . . .

+ 20x 41 + 45x 42 + 40x 43 s.t.

x

12

x

21

x

21

x

12

x x

41 14 + x 13 + x 31 + x 23 + x .

32 + x 42 + x 24 + x 14 + x 41 + x 24 + x 42 = 1 = 1 = 1 = 1 + x 43 + x 34 = 1 = 1

x ij

2  {0,1}, i 1 3 

j

4 This is incomplete because subtours are possible.

Subtour Elimination Constraints

Let S 1 = {1,3} and S 2 = {2,4} and require at least 1 arc from S 1 to S 2

x

12 + x 14 + x 32 + x 34  1 Disallows the “2 loop” solution.

Alternative formulation :

x

13 + x 31  1 and x 24 + x 42  1 To generalize, let N = {1,…,n }, and let S

N

SEC : S (

ij

) 

S x ij

 |S| – 1, 2  |S|  n/2

Example of SEC

Let

n

= 10 and

S

= { 2, 5, 6, 9 }.

Then |S | = 4.

SEC: x 25 + x 26 + x 29 + x 52 + x 56 + x 59 +

x

62 + x 65 + x 69 + x 92 + x 95 + x 96  4 – 1 = 3 6 2 5 9 In general, there are an exponential subtour elimination constraints.

number of

Sequencing problems with sequence-dependent setup times can be modeled as a TSP • Testing integrated circuits (ICs): A machine is used to test several batches of ICs of differing types.

• After each batch the machine must be reset.

• The changeover time depends on what type of IC was just tested and which type will be tested next.

IC type 1 2 3 4 1 - 20 50 45 Changeover Times IC type 2 10 - 44 40 3 17 19 - 20 4 15 18 25 --

Graph for IC Testing Example

1 0 Dummy node 0 44 17 2 0 18 3 4 Sample path : 0  1  3  2  4  0 Cost of path : 0 + 17 + 44 + 18 + 0 = 79

• If the cycle is repeated, IC1  IC3  IC2  IC4  IC1 . . .

then the total changeover time for one cycle is 17 + 44 + 18 + 45 = 124 [arc (4,1) added] .

• The goal is to sequence the testing order so that the throughput (i.e., minimize cycle time) is maximized for fixed batch sizes.

• Note that in this example, the “travel times” are not symmetric.

General Piecewise Linear Approximations

f

(

x

) (

d

,

f

) (

d

,

f

) (

d

,

f

) (

d

,

f

) (

d

4 ,

f j

)

x j

Given: f

j

(

x j

), 0 

x j

u j

Let r = number of grid points Let (d

ij

, f

ij

) be i th grid point, i = 1,…,r

u j

Linear Transformation for j

th

Variable

Let and where

x j

= S

r

i=1 

i d ij f j

(x

j

) = S

r

i=1 

i f ij

S

r

i=1 

i

= 1, 

i

 0, i = 1,…,r Not sufficient to guarantee solution is on one of the line segments.

Additional Constraints for Piecewise Linear Approximation

Requirement : No more than two 

i

can be positive ; also 

i

s must be adjacent ; i.e., 

i

and  i+1  1 ≤

y

1 

i

y

i-1 +

y i

,

i

= 2,…,

r

–1 

r

y

r-1

y

1 +

y

2 + · · · +

y

r-1 = 1

y i

= 0 or 1,

i

= 1,...,

r

–1

What You Should Know About Integer Programming

• How to convert a problem statement in an IP model.

• How to define the decision variables.

• How to convert logic statements into constraints.

• How to formulation fixed charge problems, scheduling problems, covering problems,TSP, piece-wise linear approximation to nonlinear functions.