reservation systems timetabling

55
Operational Research & Management Operations Scheduling Reservation Systems TimeTabling 1. Reservation Systems without Slack 2. Reservation Systems with Slack 3. Timetabling with Tooling Constraints 4. Timetabling with Recourse Constraints 5. Scheduling flights at the

Upload: channery-wong

Post on 30-Dec-2015

60 views

Category:

Documents


0 download

DESCRIPTION

Reservation Systems TimeTabling. 1. Reservation Systems without Slack 2.Reservation Systems with Slack 3. Timetabling with Tooling Constraints 4.Timetabling with Recourse Constraints 5.Scheduling flights at the airport. Relation between these problems. - PowerPoint PPT Presentation

TRANSCRIPT

Operational Research & Management Operations Scheduling

Reservation SystemsTimeTabling

1. Reservation Systems without Slack

2. Reservation Systems with Slack

3. Timetabling with Tooling Constraints

4. Timetabling with Recourse Constraints

5. Scheduling flights at the airport

Operational Research & Management Operations Scheduling 2

Relation between these problems

1. Reservation Systems without Slack (timing of job is fixed)

– m Parallel machines, n jobs (fixed in time; interval scheduling)

2. Reservation Systems with Slack

– m Parallel machines, n jobs (more flexible in time)

3. Timetabling with Tooling Constraints

– Enough identical machines in parallel, n jobs, tools (only 1 of each avail.)

4. Timetabling with Resource Constraints

– Enough identical machines in parallel, n jobs, one resource

Operational Research & Management Operations Scheduling

Topic 1

Reservation Systems without Slack

(Interval Scheduling)

Operational Research & Management Operations Scheduling 4

Reservation without Slack

Reservation system with m machines, n jobs

Release date rj (integer), due date dj (integer), weight wj

No slack If accepted, job starts at time rj

Can we accept all jobs? Do we need all machines?

objective1: Maximize number of jobs processed OR

objective2: Minimize number of machines needed for all jobs

j j jp d r

Operational Research & Management Operations Scheduling 5

ILP Problem Formulation

Integer Program

Fixed time periods, assume H periods

Binary variables xij (=1 if job j assigned to i th machine, 0 otherwise)

Job requiringprocessing inperiod l

Jl ={j| rj l dj }1

1, 1, ...,

1, 1, ..., , 1, ..., l

m

iji

ijj J

x j n

x i m l H

1 1

maxm n

ij iji j

w x

Exercise 1: How to adapt model for: do all jobs, but on a minimum number of machines

e.g. at car-rental: hi pj

Operational Research & Management Operations Scheduling 6

Maximizing value of processed jobs

In general is NP-hard (when both pj and wij free)

Two special cases with exact algorithms

– each of these algorithms sorts the jobs to increasing rj

Case 1: processing times pj = 1

– decompose into separate time units

– assign in each time unit most valuable jobs first

1 1

maxm n

ij iji j

w x

Operational Research & Management Operations Scheduling 7

Case 2: Identical Weights and Machines

Mj = {1,2,…,m} with wij = 1

objective: maximize #jobs taken

(No time decomposition, but still) an exact, simple algorithm:

– Dispatch jobs, tentatively, in order of increasing release date

– when next job has no machine while being earlier completed, select it at the expense of the later completed scheduled job

nrrr ...21

| , , |j j j j j jPm r d p d r U

Operational Research & Management Operations Scheduling 8

Algorithm (case 2: Identical Weights and Machines)

Step 1

– Set J = and j = 1 // J as set of accepted jobs

Step 2

– If available at time rj assign job j to a machine, include j in J, go to Step 4

Step 3

– Of scheduled job set J, select j* with latest finish

– If do not include j in J and go to Step 4

Else delete job j* from J, assign j to freed machine & include in J

Step 4

– If j = N STOP, select next job j = j+1 and go back to Step 2

*jjjj CprC

max k kj k JC r p

* ( )

Operational Research & Management Operations Scheduling 9

Minimizing #machines used

No slack, arbitrary processing times, equal weights, infinitely many identical machines in parallel

Easily solved, as follows

– Order jobs as before to earliest release date

– Assign job 1 to machine 1

– Suppose first j-1 jobs have been assigned for processing

– Try to assign j th job to a machine i ( j-1) as already used

– If not possible assign to a new machine

Special case of node coloring problem

– Why special case? (to be discussed later..)

Operational Research & Management Operations Scheduling

Topic 2

Reservation Systems with Slack

Summary Reservation Systems without Slack

Maximize # of jobs processed: simple algorithmMinimize # of machines needed: simple algorithm

Operational Research & Management Operations Scheduling 11

Reservation with Slack

Now allow slack (time slots)

Considering three cases with identical machines

and objective: maximize #jobs

Case 0. All processing times pj = 1 (trivial solution)

Case 1. All processing times pj = p 2 , identical weights

Case 2. General processing times, weights wj

j j jp d r

Operational Research & Management Operations Scheduling 12

Case 1: Equal Processing Times

Now assume processing times all equal to some p 2

– NOTE: slack can be different

Interaction between time units

Method: Barriers algorithm

– wait for critical jobs to be released

– start the job with the earliest deadline

Slot number l = l th job to start

S(l) starting time of l th slot

Operational Research & Management Operations Scheduling 13

Barriers Algorithm

Barriers Algorithm (again open, whether this algorithm is exact!)

Barrier

– ordered pair (l, r)

– Expresses waiting constraint

Approach: Starting with a k-partial schedule

– construct a (k+1)-partial schedule

– or add a new barrier to the barrier list Lb and start over from scratch

Slotnumber

Releasetime

Operational Research & Management Operations Scheduling 14

Earliest Deadline with Barriers

Selects machine h for job in (k+1)th slot

Compute the starting time

otherwisemod)1(

of multiple 1

mk

mkmh

4321 ,,,max tttt

Operational Research & Management Operations Scheduling 15

Computing the Starting Time

is defined as the earliest time that the next job can start

Claim: 1 2 3 4max , , , t t t t

)(),...,1(max1 kSSt Minimum

release dateof jobs left

otherwise)1(

103 pmkS

mkt

bLrkrt ),1(:max4

Operational Research & Management Operations Scheduling 16

Job in (k+1)th slot, can be a crisis job

Choose for (k+1)th slot: among available jobs, j ’ with earliest dj’

The creation of (k+1)-partial-schedule is successful if

Otherwise, job j ’ is a ‘crisis job’ and one calls upon the

'jd p

Backtrack l=k, k-1, .. seeking 'pull-job' jl with dj(l) > dj'

(most recently scheduled with later deadline than job j' ) If no pull-job is found, then exclude the crisis job Otherwise:

– Add barrier (l, r*) in Lb, with r* min. release time in restricted set Jr , of jobs in part. sched. after pull job

– Start anew with the updated barrier list

Crisis Routine

Operational Research & Management Operations Scheduling 17

Barriers Algorithm: an example (all pj=10)

0 10 20 30

Machine 1

Machine 2

1

2

3

193 d

Crisis job

Pull job (d2 > d3)

Jobs 1 2 3 4

rj 0 2 5 5

dj 20 30 19 30

Operational Research & Management Operations Scheduling 18

An example (cont’d)

Slot k=3 gives crisis job j=3 with pull job 2 in slot l=2

Setup restricted set: Jr={3} (min. release date r* = r3= 5)

Include new barrier: (l, r*) = (2,5) Lb

Restart with updated list Lb from scratch (with extra wait command)

0 10 20

M 1

M 2

1

2

3

Crisis job

Pull job (d2 > d3)

0 10 20

4 5t

1 2

3 4

Optimal schedule

Now at k=2, wait till

Operational Research & Management Operations Scheduling 19

CASE 2: General processing times

Reservation with slack: processing times pj and weights wj

NP-hard

No efficient algorithm

Heuristic needed

Composite dispatching rule

– Preprocessing: determine flexibility of jobs and machines

– Dispatch least flexible job first on the least flexible machine, etc

Operational Research & Management Operations Scheduling 20

Defining priority indices

ik := # candidate jobs on machine i in time slot [k-1,k]

|Mj|= # machines suitable for job j

Priority index Ij for jobs (lower index =higher priority):

– more value | less proc. | less machines lower index Ij

Priority index gi k j of using machine i for job j in interval [k, k+pj]

. ., ( / )* // increases in parameters / , j j j j j j je g I p w M p w M

, 1 , 2 ,. ., max , ,...,jikj i k i k i k pe g g

Operational Research & Management Operations Scheduling 21

Algorithm

1: - Calculate both priority indices Ij and ik

- Order jobs according to job priority index (Ij)

- Set j = 1

2: - Among available machines and time slots assign j to the

combination <machine i , [k,k+pj] > with lowest value gikj

- Discard job j if it cannot be processed at all

3: - If j = n then STOP, otherwise go back to Step 2 with j = j+1

Operational Research & Management Operations Scheduling

Topic 3

Timetabling with Tooling Constraints

Summary Reservation Systems with Slack

Equal processing times: Barrier algorithmGeneral processing times : Composite dispatching rule

Operational Research & Management Operations Scheduling 23

Timetabling

(All given) n jobs must be processed

enough (e.g. >= n) identical machines in parallel

Minimizing Makespan

Tooling Constraints

– Set of different available tools k (say in set K ):

of each k, only one available (for use by one job at a time)

– Job j requires tools of subset Kj during its processing

Timetabling is Special Case of RCPSP :

– no precedence constraints

– Rk = 1; rjk=1 or 0 depending on k being part of Kj

Operational Research & Management Operations Scheduling 24

Why Timetabling = Node coloring

jobs 1 2 3 4 5 6 7

Tool 1 1 0 0 1 1 0 1Tool 2 1 1 1 0 0 0 0Tool 3 0 0 1 0 1 1 0Tool 4 1 0 1 1 1 0 0

7

1

4

3

2

5

6

Job = node;

Jobs need same tool arc

between nodes

Makespan <= H time units ?

Can graph be colored

with H colors ?

Example: all jobs take one time unit

Operational Research & Management Operations Scheduling 26

Heuristic for Node Coloring

Terminology

– degree of node = number of arcs connected to node

– saturation level = number of colors connected to node

Intuition

– Color high degree nodes first

– Color high saturation level nodes first

Operational Research & Management Operations Scheduling 27

Heuristic Algorithm for Node Coloring

Step 1: Order nodes in decreasing order of degree

Step 2: Use color 1 for first node

Step 3: Choose uncolored node with maximum saturation

level, breaking ties according to degree

Step 4: Color using the lowest possible color-number

Step 5: If all nodes colored, STOP;

otherwise go back to Step 3

Operational Research & Management Operations Scheduling 28

Nodes 1 2 3 4 5 6 7

Example book

7

1

4

3

2

Degree 5 2 5 4 5 2 3

5

6

Operational Research & Management Operations Scheduling 29

Nodes 1 2 3 4 5 6 7

Example book

7

1

4

3

2

Degree sub 4 2 4 3 - 1 2

5

6

Saturation 1 0 1 1 - 1 1

Saturation + Degree in uncolored subgraph = Degree original graph

Operational Research & Management Operations Scheduling 30

Nodes 1 2 3 4 5 6 7

Example book

7

1

4

3

2

Degree sub 3 1 - 2 - 0 2

5

6

Saturation 2 1 - 2 - 2 1

Operational Research & Management Operations Scheduling 31

Nodes 1 2 3 4 5 6 7

Example book

7

1

4

3

2

Degree sub - 0 - 1 - 0 1

5

6

Saturation - 2 - 3 - 2 2

Operational Research & Management Operations Scheduling 32

Nodes 1 2 3 4 5 6 7

Example book

7

1

4

3

2

Degree sub - 0 - - - 0 0

5

6

Saturation - 2 - - - 2 3

Result 4 colors

e.g.

7: blue

2: red or green

6: yellow or green

Operational Research & Management Operations Scheduling 33

Nodes 1 2 3 4 5 6 7

Worse: a reverse method

7

1

3

2

Degree 5 2 5 4 5 2 3

5

66

Degree sub 5 2 5 4 4 2 3

2

1

7

3

44

Operational Research & Management Operations Scheduling 34

Example of Timetabling with tools

For solution: see previous node coloring example.

jobs 1 2 3 4 5 6 7Tool 1 1 0 0 1 1 0 1Tool 2 1 1 1 0 0 0 0Tool 3 0 0 1 0 1 1 0Tool 4 1 0 1 1 1 0 0

Job 1: yellowJob 3: blueJob 7: blueJob 4: greenJob 5: redJob 2: red or greenJob 6: yellow or green

Operational Research & Management Operations Scheduling 35

Relation to Reservation Models

Closely related to reservation problem with zero slack and arbitrary processing times (interval scheduling)

Interval scheduling = Special case of timetabling problem

– jobs with common time periods unary (pj=1) jobs with common tools

– new color = new machine new color = extra period

– job occupies adjacent time periods (creating easy solvable color problem)

jobs occupy tools ‘that need not be adjacent’

Operational Research & Management Operations Scheduling 36

Example

Suppose now we have a reservation system

Here we transform to time-tabling:

Job 1 2 3

jp 2 3 1

jr 0 2 3

jd 2 5 4

Job 1 2 3

Tool 1 1 0 0

Tool 2 1 0 0

Tool 3 0 1 0

Tool 4 0 1 1

Tool 5 0 1 0 Toool 5

Job 1 mustbe processedin time [0,2]

Job 2 mustbe processedin time [2,5]

Operational Research & Management Operations Scheduling 37

jobs 1 2 3 4 5 6 7Tool 3 0 0 1 0 1 1 0Tool 4 1 0 1 1 1 0 0Tool 1 1 0 1 1 1 0 1Tool 2 1 1 1 0 0 0 0

Other example

Adjusted example of Timetabling with tools

Rearrange and rename tools

jobs 1 2 3 4 5 6 7Tool 1 1 0 1 1 1 0 1Tool 2 1 1 1 0 0 0 0Tool 3 0 0 1 0 1 1 0Tool 4 1 0 1 1 1 0 0

1

Period 1Period 2Period 3Period 4

Operational Research & Management Operations Scheduling

Topic 4

Timetabling with Resource Constraints

Summary Timetabling with Tooling Constraints

Node Coloring heuristic

Operational Research & Management Operations Scheduling 39

Timetabling with single resource

Unlimited number of identical machines in parallel

All n jobs must be processed

Resource constraints

– Single resource of total quantity R

– Required is a certain amount for each job

Operational Research & Management Operations Scheduling 40

Resource Constraints

One type of tool but R units of it (resource)

Job j needs Rj units of this resource

Clearly, if Rj + Rk > R then job j and k cannot be processed at the same time, etc

Applications

– scheduling a construction project (R = crew size)

– exam scheduling (R = number of seats)

Special case of RCPSP with one resource, pi 1, no precedence

Operational Research & Management Operations Scheduling 41

Special case: Bin-Packing

Assume equal processing times pj = 1

Unlimited number of machines

Minimize makespan

Equivalent to bin-packing problem

– each bin has capacity R

– item of size rj

– pack into the minimum number of bins

Operational Research & Management Operations Scheduling 42

Solving the Bin-Packing Problem

Known to be NP-hard

Many heuristics developed

First fit (FF) heuristic

– Always put an item in the first bin it fits into

– Know that 2)OPT(10

17)FF( maxmax CC

Operational Research & Management Operations Scheduling 43

Example

Assume 18 items and R = 2100

– Jobs 1-6 require 301 resources

– Jobs 7-12 require 701 resources

– Jobs 13-18 require 1051 resources

FF heuristic:

– We assign the first 6 jobs to one interval (3016=1806)

– We then assign jobs two at a time to next 3 intervals (7012=1402)

– We then assign just one of the remaining jobs to each interval

Poor performance when jobs are assigned in arbitrary order

Operational Research & Management Operations Scheduling 44

First Fit Decreasing (FFD)

An improvement of FF:

Order jobs in decreasing order first

Know that

FF and FFD can be extended to different release dates

4)OPT(9

11)FFD( maxmax CC

R = 126 jobs of size 6, 4, 4, 4, 3, 3

Operational Research & Management Operations Scheduling 45

Discussion

This chapter only considered very simple models

In practice:

– Dynamic reservation systems

– Price considerations (yield management)

– Other requirements (such as in final topic..)

Operational Research & Management Operations Scheduling

Extra Topic:Scheduling flights at the airport,

A reservation problem with no slack :

When planning check-in desks

(as adjacent tools)

Operational Research & Management Operations Scheduling 47

Planning Check-in Desks

Optimization Problem - Minimize total #desks R* for all flight-desk -assignments

Distinguishing feature: - Assigned desks must be adjacent

period 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24desk 1desk 2desk 3desk 4desk 5desk 6desk 7desk 8desk 9desk 10desk 11

flight 5 flight 10

flight 2 flight 7

flight 4 flight 9

flight 3 flight 8flight 1 flight 6

rj = # desks required during (given) time-interval I(j) for flights j=1,2,..n

Operational Research & Management Operations Scheduling 48

Algorithm: Earliest Release Date or First-Fit(analogous to algorithm for minimum #machines, topic 1 )

d\t 1 2 3 4 5 6 7 8 91 1 1 12 1 1 13 1 1 14

flight 1 2 3 4 5starting period 1 3 4 5 7ending periode 3 5 6 7 9# desks required 3 1 2 1 3

d\t 1 2 3 4 5 6 7 8 91 1 1 12 1 1 13 1 1 14 2 2 2

d\t 1 2 3 4 5 6 7 8 91 1 1 1 3 3 32 1 1 1 3 3 33 1 1 14 2 2 2

d\t 1 2 3 4 5 6 7 8 91 1 1 1 3 3 32 1 1 1 3 3 33 1 1 1 4 4 44 2 2 2

d\t 1 2 3 4 5 6 7 8 91 1 1 1 4 4 42 1 1 1 3 3 3 5 5 53 1 1 1 3 3 3 5 5 54 2 2 2 5 5 5

Flight 5 does not

fit

Operational Research & Management Operations Scheduling 49

Another Example

Scheduling flights (j=1,2,..8) in 30 min. periods (t=1,2,..9)

flights desks periods

j r j I ( j )

SAS 2 2-4KLM 3 2-3CAN 3 1-5AF 4 1-1ALIT 3 4-4BA 4 6-8NW 1 5-8LH 1 8-9

Period t =1 2 3 4 5 6 7 8 9=T desk 1 SAS LH

2 BA3 KLM456 CAN789

10 AF ALIT1112 NW

LH

Find better solutions with R < 11!

Data: A feasible, but non-optimal solution:

Operational Research & Management Operations Scheduling 50

1 2 3 4 5 6 7 8 91 SAS LH2 SASNW NW3 KLM4 AF ALIT56 CAN BA789 BA

First attempt

Define R(t) as sum of rj’s over jobs j with tI(j)Then R* >= max t R(t) (a lower bound called Rlow)

Operational Research & Management Operations Scheduling 51

period> 1 2 3 4 5 6 7 8 91 AF KLM LH2 ALIT34 SAS NW5 BA6 CAN789

Optimal Assignment with R*=8 desks

Here Rlow=8 and R* = Rlow

Operational Research & Management Operations Scheduling 52

j 1 2 3 4 5 6 7 8 9 10 11r(j) 4 4 3 2 5 7 1 1 1 1 1I(j) 1-1 1-1 2-2 2-2 4-4 5-5 1-3 3-4 2-4 2-4 2-5

r\t 1 2 3 4 51 1 11 112 10 10 63 34 15 36 2 9 97 4 58 4 69 2

10 7 711 5

12 8 8R(t) 9 9 5 9 9 Is R* = Rlow ?

Question: Always R* = Rlow ?

Exercise 2: find a schedule using only #desk-rows 9=Rlow

Operational Research & Management Operations Scheduling 55

Notation for an ILP model

Ij (= [aj .. bj ]) Check-in interval

rj # of desks required

dj Largest number of adjacent desks as occupied by j

flight f

flight g

d f

a f b fa g b g

d g

1

desks

period

Operational Research & Management Operations Scheduling 56

Exercise 3: Finish this ILP model

min D

With integer variables:

D : Total number of desks required

dj : Largest desk number assigned to flight j

With parameters:

rj : Number of desks required for the check-in process of flight j

Ij : Check-in time interval of flight j

Hint: disjunctive model, comparable to that for job-shop-scheduling

Operational Research & Management Operations Scheduling 57

An alternative ILP model

Binaries yj t r (=1 if j occupies in period t largest desk r; 0 otherwise)

Flight j require n(j,t) adjacent desks in period t

Exercise 4: model the missing constraint-set

Hint: similar to the technique used in the RCSP model

,

,

min

, ( )

1 , ( )

no overlap? ,

N

j t rr n j t

N

j t rr n j t

D

r y D j t I j

y j t I j

r t

, ,( )

, ,( )

Operational Research & Management Operations Scheduling 58

With n(j,t) desks for a flight

Static

Dynamic (8 possible shapes)

or or or …

4 4 44 4 44 4 4

4 4 44 44 4

4

4 44 4 44 4

4

44 4 44 44 4

t d