8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights...

34
8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights 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

description

3  An IP is a mixed integer program (MIP) if some but not all 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 the IP is a binary IP (BIP)  Decision variables not integer-constrained are continuous decision variables Decision Variables in IP Models

Transcript of 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights...

Page 1: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

8/14/04J. Bard and J. W. Barnes

Operations Research Models and MethodsCopyright 2004 - All rights reserved

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

Page 2: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

2

Linear Integer Programming - IP

Maximize/Minimize z = c1x1 + c2x2 + + cnxn

{

}bi, i = 1,…,ms.t. ai1x1 + ai2x2 + + ainxn

0 xj uj, j = 1,…,n

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

Page 3: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

3

An IP is a mixed integer program (MIP) if some but not all 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 the IP is abinary IP (BIP)

Decision variables not integer-constrained arecontinuous decision variables

Decision Variables in IP Models

Page 4: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

4

Why study IP?(1)LP divisibility assumption (fractional

solutions are permissible) is not always valid.

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

Page 5: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

5

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 and part-timers

– 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 • Problem: Find minimum cost workforce

Page 6: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

6

Decision variables:xt = # of full-time employees that work shift tyt = # of part-time employees that work shift t

Min z = 121.6(x1 + +x6) + 51.8(y1+ +y6)

Call Center Employee IP Model

s.t. x6 + x1 + 56 y1 15

x1 + x2 + 56 y2 10...

x5 + x6 + 56 y6 35

x6 + x1 23 (x6 + x1 + y1)...

x5 + x6 23 (x5 + x6 + y6)

xt 0, yt 0, t = 1,2, …,6

Page 7: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

7

Optimal LP solutionx = [ 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!We do not know!

Page 8: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

8

How good is this solution?z

LP = 12795.2 is a lower bound on integer optimum

Hence, the rounded solution is no more than

(12916.8 – 12795.212795.2 ) 100% = 0.95%

from the optimum.

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

z*IP = 12,795.2

Optimal solution is

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

• This is not commonly true.

Page 9: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

9

Sometimes there is no “obvious” feasible solution that can be obtained by rounding

optimal LP solution

X1

X2

optimalIP solution

iso-cost line

The IP solution can be “far” from the LP rounded solutioneven when the rounded solution is feasible.

Page 10: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

10

The Days-Off Scheduling Problem

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

cj = weekly cost of pattern j per employeeri = number of required on day ixj = number of employees assigned to days-

off pattern jNote: There are 7 days-off patterns; i, j = 1,…,7

Page 11: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

11

Days-Off Mathematical Model

Minimize z = cjxj

subject to ( xj ) – xi – xi-1 ri , i = 1,…7

xj 0 and integer, j = 1,…,7; x0 = x7

7

j =17

j =1

Solve problem to get x*j

Minimum cost workforce W = x*j

7

j =1

Page 12: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

12

Compact Mathematical ModelMinimize z = cxsubject to

rx

0011111100111111001111110011111100111111000111110

⎟⎟⎟⎟⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜⎜⎜⎜⎜

x 0 and integer

Page 13: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

13

Logic ConstraintsEither-Or Constraints

Either f1(x1,…,xn) b1

or f2(x1,…,xn) b2

or both.IP formulation

y = 0 first constraint must holdy = 1 second constraint must holdOptimization process will choose the y value.

Let y {0,1}f1(x1,…,xn) b1 + My

f2(x1,…,xn) b2 + M(1 – y)

Page 14: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

14

K out of N constraints must hold

N

i =1 yi = K

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

At leastK out of Nmust besatisfied

N constraints

f1(x1,…,xn) b1

fN(x1,…,xn) bN

f1(x1,…,xn) b1 + M(1 – y1) fN(x1,…,xn) bN + M(1 – yN)

Page 15: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

15

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

Page 16: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

16

Compound Alternatives

} Region 1 constraints

} Region 2 constraints

} Region 3 constraints

y1 + y2 + y3 = 1, y1, y2, y3 {0,1}

f1(x1,…,xn) b1 + M (1 – y1)f2(x1,…,xn) b2 + M (1 – y1)f3(x1,…,xn) b3 + M (1 – y2)f4(x1,…,xn) b4 + M (1 – y2)f5(x1,…,xn) b5 + M (1 – y3)f6(x1,…,xn) b6 + M (1 – y3)

Page 17: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

17

Fixed-Charge Problemn

j =1Min fj(xj) where fj(xj) = {

kj + cjxj if xj > 00 if xj = 0

kj = set-up cost, cj = per unit cost

IP formulation:

Minn

j =1 (cjxj + kjyj )

s.t. xj Myj , j = 1,…,nyj {0,1} , j = 1,…,nxj 0 , j = 1,…,n

Page 18: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

18

Example: Warehouse Location Problem

A company has m potential warehouse sites and n customers

Data: dj : demand for customer j si : capacity (supply) of warehouse i

Decision variables: yi : build a warehouse at site i? (1 = yes, 0 = no) xij : shipment from warehouse i to customer j

Page 19: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

19

Minm

i =1

n

j =1 cijxij +

m

i =1 kiyi

s.t.m

i =1 xij = dj j = 1,…,n

n

j =1 xij siyi i = 1,…,m

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

yi {0,1}, j = 1,…,m

Satisfy each customer’sdemand

each warehouse canship no more than itssupply if it is built

Warehouse Location IP Model

Page 20: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

20

Example: Facility Location Problem (with forcing constraints)

Problem: open set of facilities & assign each customer to one facility at minimum cost.

No shipping here:Cost of assigning customers to facilities could be based on a response time (e.g., locating fire stations).

Page 21: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

21

Indices/Sets

potential facility location, j J with |J | = n customers to be served, i I with |I | = m

Datakj : cost of opening a facility at location j

cij : cost of serving customer i from facility j

Decision Variablesyj : open facility at location j (1 = yes, 0 = no)

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

Page 22: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

22

Strong Formulation

Min

s.t. xij = 1, i I Each customer assigned to exactly one facility

Forcing constraint

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

jJ

jJiI jJ

xij yj , i I, j J

xij , yj {0,1} , i I, j J

cijxij + kjyj

Page 23: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

23

Mathematically Equivalent Weak formulation

Min

s.t.

xij, yj {0,1} i I, j J

xij must be 0 for all iIif yj = 0;up to |I |xij can be 1 ifyj = 1.

{ Less computational efficiency

xij = 1, i I jJ

xij |I |yj , j JiI

jJiI jJcijxij + kjyj

Page 24: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

26

Traveling Salesman Problem (TSP)

1

4

3

2

Problem: Find minimum distance tour that starts at a city, visits every other city exactly once, and returns to the initial city

Page 25: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

27

Decision Variablesxij = 1 if tour includes arc (i, j )

= 0 otherwise Initial Formulation

Min 50x12 + 44x13+ 25x14 + . . . + 20x41 + 45x42+ 40x43

s.t. x12 + x13 + x14 = 1x21 + x31 + x41 = 1x21 + x23 + x24= 1x12 + x32 + x42= 1...x41 + x42 + x43 = 1x14 + x24 + x34

xij {0,1}, i j

This is incomplete because subtours are allowed.

= 1

1

3

2 4

Page 26: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

28

Add Subtour Elimination Constraints

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

x12 + x14 + x32 + x34 1

Disallows the “2 loop” solution.

Alternative formulation: x13 + x31 1 and x24 + x42 1

To generalize, let N = {1,…,n}, and let S N

SEC: xij |S| – 1, 2 |S| n/2(ij)S

Page 27: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

29

Example of SECLet n = 10 and S = { 2, 5, 6, 9 }.Then |S| = 4.

SEC: x25 + x26 + x29 + x52 + x56 + x59 +x62 + x65 + x69 + x92 + x95 + x96 4 – 1 =

3

In general, there exponentially many subtour elimination constraints.

2 5

6

9

Page 28: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

30

Sequencing problems with sequence-dependent set-up 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 change-over time depends on what type of IC we just tested and what we’ll test next.

Change-Over TimesIC Type

1 2 3 41 -- 10 17 152 20 -- 19 183 50 44 -- 254 45 40 20 --

IC Type

Page 29: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

31

If the order of testing is IC1 IC2 IC4 IC3 IC1 . . .

• The total change-over time for one cycle is 10 + 18 + 20 + 50 = 98

• 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)

Page 30: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

32

Graph for IC Testing Example

Dummy node

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

44

17

18

0

0

43

2

0

1

Page 31: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

33

General Piecewise Linear Approximationsf (x )j j

jju

x

(d , f )1j 1j

(d , f )2j 2j

(d , f )3j 3j

(d , f )4j 4j

(d , f )5j 5j

Given: fj(xj), 0 xj uj

Let r = number of grid pointsLet (dij, fij) be ith grid point, i = 1,…,r

Page 32: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

34

Linear Transformation for jth Variable

Let xj = i dij

and fj(xj) = i fij

where i = 1, i 0, i = 1,…,r

Not sufficient to guarantee solution is on one of the line segments.

r

i=1

r

i=1r

i=1

Page 33: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

35

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 ≤ y1

i ≤ yi-1 + yi , i = 2,…,r–1

r ≤ yr-1 y1 + y2 + · · · + yr-1 = 1

yi = 0 or 1, i = 1,...,r–1

Page 34: 8/14/04 J. Bard and J. W. Barnes Operations Research Models and Methods Copyright 2004 - All rights reserved Lecture 6 – Integer Programming Models Topics.

36

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