17
© J. Christopher Beck 2005 1 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

Embed Size (px)

Citation preview

Page 1: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 1

Lecture 19: Timetabling with Operator Constraints

Page 2: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 2

Outline Adding Operator/Tooling

Constraints Graph coloring

Heuristics – Brelaz Example 9.5.2

Minimizing Timetabling Costs Algorithm 9.5.4 Example 9.5.5

Page 3: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 3

People are Different

So far we have been assuming that we have Wpeople 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

Page 4: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 4

Operator or Tool Constraints

The operator has to have specific skills to do the activity Able to speak French, certified accountant

A specific tool is needed 1/8” drill bit, refrigerator truck

If two activities require the same operator or tool, they cannot be done at the same time

Page 5: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 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”

Page 6: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 6

Graph Coloring

Color each node such that No two connected nodes have the

same color Use the minimum number of colors

Page 7: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 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

Page 8: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 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”)

Page 9: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 9

CP for GC

“Domain”

Page 10: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 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

Page 11: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 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

Page 12: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 12

Brelaz Heuristic

Choose node with smallestdomain

Break ties with maximum forward degree Forward degree: # arcs to uncolored

nodes Choose colors lexicographically

3

2

3

2

2

Page 13: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 13

Example 9.5.2

Schedule 7 one-hour meetings in 4 hours

Represent as a GC problem and use CP with Brelaz heuristicmeeting

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

Page 14: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 14

Other Examples To Look At

Example 9.5.3 OPL project mapgr.prj

On ECF and Pinedo CDROM

Page 15: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 15

A MoreGeneral 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 E.g., (ai,aj) = 5 * |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

See Algorithm 9.5.4!

Page 16: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 16

And Another One:Multilingual Call Centre

Assign calls to minimize makespan? Can this be represented as a GC

problem?Person Languages

Alex English, French, German

Barbara

German, Russian, Korean

Charles

Serbo-Croatian, Polish

David Korean, French, Polish

Ellen Mandarin, Russian, English

Calls

Language

1 English

2 Korean

3 Korean

4 French

5 Russian

6 Polish

Calls

Language

7 German

8 Russian

9 Polish

10 Mandarin

11 French

12 Russian

Page 17: © J. Christopher Beck 20051 Lecture 19: Timetabling with Operator Constraints

© J. Christopher Beck 2005 17

Modeling is VERY Important

Remember back to Lec11 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?