Lecture 20: Timetabling with Operator Constraints © J. Christopher Beck 2008

advertisement
Lecture 20:
Timetabling with Operator
Constraints
© J. Christopher Beck 2008
1
Outline


Adding Operator/Tooling Constraints
Graph coloring



Heuristics – Brelaz
Example 9.5.2
Minimizing Timetabling Costs


Algorithm 9.5.4
Example 9.5.5
© J. Christopher Beck 2008
2
Readings


P Ch 9.5
Questions


Graph coloring &
Brelaz
9.9, 9.10
© J. Christopher Beck 2008
3
People are Different

So far we have been
assuming that we have W
people that are all equivalent


Any set of Wj people could do
activity j
Obviously this isn’t true in many
applications

E.g., Medical or language specialties
© J. Christopher Beck 2008
4
Operator or Tool Constraints

The operator has to have specific skills
to do the activity


A specific tool is needed


Able to speak French, certified accountant
1/8” drill bit, refrigerator truck
If two activities require the same
operator or tool, they cannot be done at
the same time
© J. Christopher Beck 2008
5
Restricted Problem



Assume some set of specific people are
needed to do each activity
All activities have a duration of 1
Problem is still hard

Equivalent to the graph coloring problem

Aka “node coloring”, “vertex coloring”
© J. Christopher Beck 2008
6
Graph Coloring

Color each node such that


No two connected nodes have the same
color
Use the minimum number of colors
© J. Christopher Beck 2008
7
Mapping from Graph Coloring
to Timetabling



Nodes are activities
Arcs mean the
activities require the
same operator
Colors are time slots

Minimizing the
number of colors is
minimizing makespan

why?
© J. Christopher Beck 2008
Modeling!
8
Constraint Programming for
Graph Coloring

Remember CP

Make heuristic decisions


Color a node
Propagate


Remove that color from the domain of nodes
connected to the node you just colored
(This level of propagation is called “forward
checking”)
© J. Christopher Beck 2008
9
CP for GC
“Domain”
© J. Christopher Beck 2008
10
CP for GC Algorithm

Step 0: Propagate






Remove the color from all neighbors nodes
Color nodes with singleton domains
Step 1: Pick a node and color it
Step 2: Propagate
If a domain is empty, undo last color
and assign a different color, goto 2
Else goto 1
© J. Christopher Beck 2008
11
Variable and Value Ordering
Heuristics

How do you pick a node (variable) to
color next?



Smallest domain first
Maximum forward degree
How do you pick a color (value) for that
node?


Randomly
Lexicographically
Order colors and assign the lowest possible

© J. Christopher Beck
2008
12
2
Brelaz Heuristic


Choose node with smallest 2
domain
Break ties with maximum forward
degree


3
2
3
Forward degree: # arcs to uncolored
nodes
Choose colors lexicographically
© J. Christopher Beck 2008
13
Example 9.5.2


Schedule 7 one-hour meetings in 4
hours
Represent as a GC problem and use CP
with Brelaz heuristic
meeting
1
2
3
4
5
6
7
Gary
1
0
0
1
1
0
1
Hamilton
1
1
1
0
0
0
0
Izak
0
0
1
0
1
1
0
Reha
1
0
1
1
1
0
0
© J. Christopher Beck 2008
14
Example 9.5.2


Schedule 7 one-hour meetings in a
minimum number of hours
Represent as a GC problem and use CP
with Brelaz heuristic
meeting
1
2
3
4
5
6
7
Gary
1
0
0
1
1
0
1
Hamilton
1
1
1
0
0
0
0
Izak
0
0
1
0
1
1
0
Reha
1
0
1
1
1
0
0
© J. Christopher Beck 2008
15
Other Examples To Look At


Example 9.5.3
OPL project mapgr.prj

On ECF and Pinedo CDROM
© J. Christopher Beck 2008
16
A More
General Problem


There is a “slot cost”, c’jt, if activity j is
assigned to slot t
There is a “changeover cost”, (ai,aj), if
ai and aj are scheduled close together



See Algorithm 9.5.4!
(ai,aj) = 5 * max(0, 3 - |slot(ai) – slot(aj)|)
(ai,aj) = 0, if ai and aj don’t conflict
Objective is to minimize the sum of all
slot and changeover costs
© J. Christopher Beck 2008
17
And Another One:
Multilingual Call Centre


Assign calls to minimize makespan?
Can this be represented as a GC
problem?
Calls Language Calls Language
Person
Languages
1
English
7
German
Alex
English, French, German
2
Korean
8
Russian
Barbara German, Russian, Korean
3
Korean
9
Polish
Charles Serbo-Croatian, Polish
4
French
10
Mandarin
David
Korean, French, Polish
5
Russian
11
French
Ellen
Mandarin, Russian, English
6
Polish
12
Russian
© J. Christopher Beck 2008
18
Modeling is VERY Important


Remember back to Lec 13 on CP
If you have some solution technique
(CP, GC, IP, …) an extremely important
step is trying to fit your problem to the
technique


What do the nodes, arcs, colors represent?
Is this a useful representation?
© J. Christopher Beck 2008
19
Download