w6_timetabling.ppt

advertisement
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
Operational Research & Management
Operations Scheduling
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
2
Topic 1
Reservation Systems without Slack
(Interval Scheduling)
Operational Research & Management
Operations Scheduling
Reservation without Slack

Reservation system with m machines, n jobs

Release date rj (integer), due date dj (integer), weight wj

No slack

Can we accept all jobs? Do we need all machines?
p j  d j  rj
If accepted, job starts at time rj
objective1: Maximize number of jobs processed
OR
objective2: Minimize number of machines needed for all jobs
Operational Research & Management
Operations Scheduling
4
ILP Problem Formulation
e.g. at car-rental: hi pj

Integer Program

Fixed time periods, assume H periods

Binary variables xij (=1 if job j assigned to i th machine, 0 otherwise)
Job requiring
processing in
period l
Jl ={j| rj l  dj }
m
n
 w x
max
i 1 j 1
m
x
i 1
ij
x
jJ l
ij
ij ij
 1, j  1, ..., n
 1, i  1, ..., m,
l  1, ..., H
Exercise 1: How to adapt model for: do all jobs, but on a
minimum number of machines
Operational Research & Management
Operations Scheduling
5
Maximizing value of processed jobs
m

In general max
n
 w x
i 1 j 1

is NP-hard (when both pj and wij free)
Two special cases with exact algorithms
–

ij ij
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
Operational Research & Management
Operations Scheduling
6
Case 2: Identical Weights and Machines

Mj = {1,2,…,m} with wij = 1

objective: maximize #jobs taken
Pm | rj , d j , p j  d j  rj | U j

(No time decomposition, but still) an exact, simple algorithm:
–
Dispatch jobs, tentatively, in order of increasing release date
r1  r2  ...  rn
–
when next job has no machine while being earlier completed,
select it at the expense of the later completed scheduled job
Operational Research & Management
Operations Scheduling
7
Algorithm (case 2: Identical Weights and Machines)

Step 1
–

// J as set of accepted jobs
Step 2
–

Set J =  and j = 1
If available at time rj assign job j to a machine, include j in J, go to Step 4
Step 3
–
( rk  pk )
Of scheduled job set J, select j* with latest finish C j*  max
kJ
–
If C j  rj  p j  C j * 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
Operational Research & Management
Operations Scheduling
8
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
9
Summary
Reservation Systems without Slack
Maximize # of jobs processed:
Minimize # of machines needed:
simple algorithm
simple algorithm
Topic 2
Reservation Systems with Slack
Operational Research & Management
Operations Scheduling
Reservation with Slack
p j  d j  rj

Now allow slack
(time slots)

Considering three cases with identical machines
and objective: maximize #jobs
Case 0.
All processing times pj = 1
Case 1.
All processing times pj = p  2 , identical weights
Case 2.
General processing times, weights wj
Operational Research & Management
(trivial solution)
Operations Scheduling
11
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
12
Barriers Algorithm



Barriers Algorithm (again open, whether this algorithm is exact!)
Barrier
Slot
number
Release
time
–
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
Operational Research & Management
Operations Scheduling
13
Earliest Deadline with Barriers

Selects machine h for job in (k+1)th slot
m
k  1 multiple of m

h
otherwise
(k  1) mod m

Compute the starting time
  max t1 , t2 , t3 , t4 
Operational Research & Management
Operations Scheduling
14
Computing the Starting Time

 is defined as the earliest time that the next job can start

Claim:
  max t1 , t2 , t3 , t4 
t1  max S (1),..., S (k )
Minimum
release date
of jobs left
0
k 1  m

t3  
S (k  1  m)  p otherwise
t4  max r : (k  1, r )  Lb 
Operational Research & Management
Operations Scheduling
15
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 d j '    p

Otherwise, job j ’ is a ‘crisis job’ and one calls upon the
Crisis Routine

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
Operational Research & Management
Operations Scheduling
16
Barriers Algorithm: an example (all pj=10)
Jobs
1
2
3
4
rj
0
2
5
5
dj
20
30
19
30
d 3  19
1
Machine 1
Crisis job
3
Pull job (d2 > d3)
2
Machine 2
0
Operational Research & Management
10
20
30
Operations Scheduling
17
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}

Include new barrier: (l, r*) = (2,5)  Lb

Restart with updated list Lb from scratch (with extra wait command)
(min. release date r* = r3= 5)
Crisis job
M1
M2
Now at k=2, wait till
1
3
1
2
3
2
Pull job (d2 > d3)
0
10
Operational Research & Management
20
  t4  5
4
Optimal schedule
0

10
20
Operations Scheduling
18
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
19
Defining priority indices

yik := # 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
e.g., I j  ( p j /w j )* M j

// increases in parameters p j /w j , M j
Priority index gi k j of using machine i for job j in interval [k, k+pj]

e.g., gikj  max y i ,k 1 ,y i ,k  2 ,...,y i ,k  p j
Operational Research & Management

Operations Scheduling
20
Algorithm
1: - Calculate both priority indices Ij and yik
- 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
21
Summary
Reservation Systems with Slack
Equal processing times:
General processing times :
Barrier algorithm
Composite dispatching rule
Topic 3
Timetabling with Tooling Constraints
Operational Research & Management
Operations Scheduling
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
23
Why Timetabling = Node coloring
Example: all jobs take one time unit
jobs
Tool 1
Tool 2
Tool 3
Tool 4
1
1
1
0
1
2
0
1
0
0
3
0
1
1
1
4
1
0
0
1
5
1
0
1
1
1
7
2
6
0
0
1
0
7
1
0
0
0

Job = node;

Jobs need same tool  arc
between nodes

6
3
5
4
Operational Research & Management
Makespan <= H time units ?
 Can graph be colored
with  H colors ?
Operations Scheduling
24
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
26
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
27
Example book
Nodes
Degree
1
5
2
2
3
5
4
4
5
5
6
2
7
3
1
7
2
6
3
5
Operational Research & Management
4
Operations Scheduling
28
Example book
Saturation + Degree in uncolored subgraph = Degree original graph
Nodes
Degree sub
Saturation
1
4
1
2
2
0
3
4
1
4
3
1
5
-
6
1
1
7
2
1
1
7
2
6
3
5
Operational Research & Management
4
Operations Scheduling
29
Example book
Nodes
Degree sub
Saturation
1
3
2
2
1
1
3
-
4
2
2
5
-
6
0
2
7
2
1
1
7
2
6
3
5
Operational Research & Management
4
Operations Scheduling
30
Example book
Nodes
Degree sub
Saturation
1
-
2
0
2
3
-
4
1
3
5
-
6
0
2
7
1
2
1
7
2
6
3
5
Operational Research & Management
4
Operations Scheduling
31
Example book
Nodes
Degree sub
Saturation
1
-
2
0
2
3
-
4
-
5
-
1
6
0
2
7
0
3
Result 4 colors
7
2
e.g.
7: blue
2: red or green
6
3
5
Operational Research & Management
6: yellow or green
4
Operations Scheduling
32
Worse: a reverse method
Nodes
Degree sub
1
5
2
2
3
5
4
4
5
5
4
6
2
7
3
11
77
22
66
33
5
Operational Research & Management
44
Operations Scheduling
33
Example of Timetabling with tools

For solution: see previous node coloring example.
jobs
Tool 1
Tool 2
Tool 3
Tool 4
1
1
1
0
1
2
0
1
0
0
3
0
1
1
1
4
1
0
0
1
5
1
0
1
1
6
0
0
1
0
7
1
0
0
0
Job 1: yellow
Job 3: blue
Job 7: blue
Job 4: green
Job 5: red
Job 2: red or green
Job 6: yellow or green
Operational Research & Management
Operations Scheduling
34
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
35
Example

Suppose now we have a reservation system
Job

pj
1
2
2
3
3
1
rj
0
2
3
dj
2
5
4
Here we transform to time-tabling:
Job 1 must
be processed
in time [0,2]
Job 2 must
be processed
in time [2,5]
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
Operational Research & Management
Operations Scheduling
36
Other example

Adjusted example of Timetabling with tools
jobs
Tool 1
Tool 2
Tool 3
Tool 4

1
1
1
0
1
2
0
1
0
0
3
1
1
1
1
4
11
0
0
1
5
1
0
1
1
6
0
0
1
0
7
1
0
0
0
4
0
1
1
0
5
1
1
1
0
6
1
0
0
0
7
0
0
1
0
Rearrange and rename tools
jobs
Tool 3 1
Period
Tool 4 2
Period
Tool 1 3
Period
Period
Tool 2 4
1
0
1
1
1
Operational Research & Management
2
0
0
0
1
3
1
1
1
1
Operations Scheduling
37
Summary
Timetabling with Tooling Constraints
Node Coloring heuristic
Topic 4
Timetabling with Resource Constraints
Operational Research & Management
Operations Scheduling
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
39
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
40
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
41
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
–
Cmax (FF) 
Know that
Operational Research & Management
17
Cmax (OPT)  2
10
Operations Scheduling
42
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 (3016=1806)
–
We then assign jobs two at a time to next 3 intervals (7012=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
43
First Fit Decreasing (FFD)

An improvement of FF:

Order jobs in decreasing order first
Cmax (FFD) 
11
Cmax (OPT)  4
9

Know that

FF and FFD can be extended to different release dates
R = 12
6 jobs of size 6, 4, 4, 4, 3, 3
Operational Research & Management
Operations Scheduling
44
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
45
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
Planning Check-in Desks
period
desk 1
desk 2
desk 3
desk 4
desk 5
desk 6
desk 7
desk 8
desk 9
desk 10
desk 11
1
2
3
4
5
6
7
flight 1
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
flight 3
flight 8
flight 6
flight 4
flight 9
flight 2
flight 7
flight 5
flight 10
rj = # desks required during (given) time-interval I(j) for flights j=1,2,..n
Optimization Problem
- Minimize total #desks R* for all flight-desk -assignments
Distinguishing feature:
- Assigned desks must be adjacent
Operational Research & Management
Operations Scheduling
47
Algorithm: Earliest Release Date or First-Fit
(analogous to algorithm for minimum #machines, topic 1 )
flight
starting period
ending periode
# desks required
d\t
1
2
3
4
1
1
1
1
d\t
1
2
3
4
1
1
1
1
2
1
1
1
2
1
1
1
Operational Research & Management
1
1
3
3
3
1
1
1
2
4
3
3
3
1
1
1
2
4
2
3
3
2
2
3
5
1
3
4
6
2
4
5
7
1
5
7
9
3
5
3
3
4
2
6
3
3
4
7
8
5
4
3
3
2
6
4
3
3
7
4
5
5
5
9
Flight 5
4does not fit
8
9
5
5
5
5
5
5
Operations Scheduling
48
Another Example
Scheduling flights (j=1,2,..8) in 30 min. periods (t=1,2,..9)
Data:
flights desks
j
r j
SAS
2
KLM 3
CAN 3
AF
4
ALIT 3
BA
4
NW
1
LH
1
A feasible, but non-optimal solution:
periods
I(j)
2-4
2-3
1-5
1-1
4-4
6-8
5-8
8-9
Period t =1 2 3
desk 1
SAS
2
3
KLM
4
5
6 CAN
7
8
9
10 AF
11
12
4
5
6
7
8 9=T
LH
BA
LH
ALIT
NW
Find better solutions with R < 11!
Operational Research & Management
Operations Scheduling
49
First attempt
1
2 3
SAS
1
2
3
KLM
4 AF
5
6 CAN
7
8
9
4
5
6
SASNW
7
8
LH
NW
9
ALIT
BA
BA
Define R(t) as sum of rj’s over jobs j with tI(j)
Then R* >= max t R(t) (a lower bound called Rlow)
Operational Research & Management
Operations Scheduling
50
Optimal Assignment with R*=8 desks
period> 1 2 3
1 AF KLM
2
3
4
SAS
5
6 CAN
7
8
9
4
5
6
8
LH
9
ALIT
NW
BA
Here Rlow=8 and
Operational Research & Management
7
R* = Rlow
Operations Scheduling
51
Question: Always R* = Rlow ?
j 1
2
3
4
5
6
7
8
9
10
r(j) 4
4
3
2
5
7
1
1
1
1
I(j) 1-1 1-1 2-2 2-2 4-4 5-5 1-3 3-4 2-4 2-4
r\t
1
1
2
3
4
5
6
7
8
9
10
11
1
2
4
11
10
3
10
3
9
4
4
9
5
5
11
6
1
2
2
7
6
7
5
8
12
R(t)
3
11
1
2-5
9
9
5
8
9
9
Is R* = Rlow ?
Exercise 2: find a schedule using only #desk-rows 9=Rlow
Operational Research & Management
Operations Scheduling
52
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
desks
df
flight f
dg
flight g
1
af
Operational Research & Management
ag
bf
bg
period
Operations Scheduling
55
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
56
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
min D
N

r n( j ,t )
N

r n( j ,t )
r y j, t, r  D
j , t  I (j )
y j, t, r  1
j , t  I (j )
no overlap?
r ,  t
Exercise 4: model the missing constraint-set
Hint: similar to the technique used in the RCSP model
Operational Research & Management
Operations Scheduling
57
With n(j,t) desks for a flight
t
d 4
 4
4

Static

Dynamic (8 possible shapes)
4
4
4
4
4
4
4
4
or
Operational Research & Management
4
4
4
4
4
4
4
4
4
4
4
4
4
4
or
4
4
4
4
4
4
4
4
or …
Operations Scheduling
58
Download