Scheduling and Timetabling, Lecture 10 Han Hoogeveen, Utrecht - - PowerPoint PPT Presentation

scheduling and timetabling lecture 10 han hoogeveen
SMART_READER_LITE
LIVE PREVIEW

Scheduling and Timetabling, Lecture 10 Han Hoogeveen, Utrecht - - PowerPoint PPT Presentation

Scheduling and Timetabling, Lecture 10 Han Hoogeveen, Utrecht University 1 Timetabling: basic problems Basic problems Just to get a feeling what is possible (polynomial time) and when the problem gets NP -hard. Useful as a subproblem (for


slide-1
SLIDE 1

Scheduling and Timetabling, Lecture 10 Han Hoogeveen, Utrecht University

1

slide-2
SLIDE 2

Timetabling: basic problems

Basic problems Just to get a feeling what is possible (polynomial time) and when the problem gets NP-hard. Useful as a subproblem (for example in a decomposition approach) Based on the paper by De Werra ‘An introduction to timetabling’ (see website) The paper ‘School Timetabling in Theory and Practice’ by Irving van Heuven van Staereling (see website) provides more background

2

slide-3
SLIDE 3

Simple class-teacher model

There are n teachers (denoted t1, . . . , tn) There are m classes (denoted c1, . . . , cm) Teacher j (j = 1, . . . , n) must meet class ci (i = 1, . . . , m) rij times Each lesson requires one slot; independent lessons can be taught simultaneously (plenty of rooms available) Everybody is always available (crucial assumption) Goal: minimize the number of slots that you need. Any suggestions for a lower bound?

3

slide-4
SLIDE 4

Solution approach

Valid lower bounds are max

j m

  • i=1

rij and max

i n

  • j=1

rij; a teacher/class can have at most one lesson at a time Hence, the maximum of the two is a valid lower bound; call this lower bound p. It is possible to construct a solution that uses a number of slots that is equal to this lower bound.

4

slide-5
SLIDE 5

Graph approach (1)

Construct a bipartite graph: teachers on the left, classes on the right Connect teacher tj with class ci with rij edges The maximum degree in the graph is equal to p Color the edges using p colors such that this coloring corresponds to a feasible solution Edges with the same color correspond to lesson taught in the same slot. How to find this coloring?

5

slide-6
SLIDE 6

Graph approach (2)

The edges with the same color form a matching, since each teacher/class has at most one lesson per slot. Theorem (König): If the maximum degree in a multi-edge bipartite graph is equal to p, then it is possible to partition the edges in p disjoint matchings. How to find such a solution?

6

slide-7
SLIDE 7

Availability is crucial

In general, the problem remains easily solvable if everybody is always available Examples of similar problems that you can deal with then

Each teacher and class have specified a maximum number of lessons that can be scheduled per day; you have to minimize the number of days. Given a number of days, assign the lessons such that each teacher and class have the same number of lessons per day (difference at most one between days)

The rostering problems become NP-hard if there are slots at which some teacher/class is not available.

7

slide-8
SLIDE 8

Timetabling with unavailabilities

Situation as before: n teachers t1, . . . , tn have to educate m classes c1, . . . , cm For each teacher/class combination the number of lessons rij is known For each teacher the slots at which he/she is available is given; similarly for each class Question: does there exist a feasible solution using a given number of timeslots q?

8

slide-9
SLIDE 9

Finding a feasible timetable in case of unavailabilities

Decision problem, no objective. You can turn it into an optimization problem (if you want to) You can solve the decision problem using Constraint Satisfaction Here you combine constraints and try to reduce domains (famous example: Sudoku) If you get stuk, then you can use a decision tree (just like a branch-and-bound tree) You can fathom a node by showing that there is no feasible solution possible.

9

slide-10
SLIDE 10

Showing infeasibility

You want to have a strong test, which can discard a node early in the tree In general you will need to look at a relaxation of the problem A relaxation results in a simpler decision problem; be sure that showing that this relaxation is infeasible implies that the

  • riginal problem has no solution

Similar to the branch-and-bound approach where you have to find an upper/lower bound by relaxing a problem Suggestions for a relaxation?

10

slide-11
SLIDE 11

Relaxing the problem

De Werra considers two relaxations that can be used here: Consider only 1 teacher (suppose this is teacher 0) Consider only 1 class (suppose this is class 0) Clearly a relaxation: if there is no timetable for this single teacher, then the full problem is infeasible (similar for the class) How to solve it? De Werra considers the subproblem of looking at a single timeslot, but this relaxation is not useful to discard nodes in the decision tree.

11

slide-12
SLIDE 12

Solving the 1-teacher problem

You must assign the classes to timeslots You only have to consider timeslots on which the teacher is available It is possible to assign a class to a timeslot only if the class is available at that time slot

12

slide-13
SLIDE 13

Formulating it as a max flow problem

The problem can be solved as an unweighted bipartite assignment problem, where you have ri0 copies of class i (one per lesson that they must get from teacher 0) Formulate it as a max flow problem Two sets of vertices: class nodes c1, . . . , cm and timeslot nodes t1, . . . , tq Add arc (ci, tk) if and only if class i is available in timeslot k Add source s and the arcs (s, ci) (i = 1, . . . , m) with capacity ri0 (at most ri0 lessons for class i) Add sink t and the arcs (ci, t) (i = 1, . . . , m) with capacity 1 (at most 1 lessons for class i per timeslot) How can you see if there is a feasible solution for the single teacher problem?

13

slide-14
SLIDE 14

Additional questions

How can you use/adapt this max flow formulation to derive characteristics of a feasible solution? How could you try to solve this problem using branch-and-price?

14

slide-15
SLIDE 15

Generating a round robin tournament

In a round robin tournament each team meets each other team once In each timeslot each team plays one match (or one team has a bye) An easy way to generate such a round robin is through the bracelet method Possible disadvantage: patterns will occur with respect to subsequent opponents Major sports competitions are now planned using ILP techniques (possibly a good subject for your presentation ...)

15

slide-16
SLIDE 16

Bracelet method

Add as many blocks as you need Opposite teams are matched The team on top has a bye

  • r plays team 2i + 2

After planning one round, shift all numbers clockwise, etc. i+2 2i 2i+1 i+1 3 2 1

❅ ❅ ❅

16

slide-17
SLIDE 17

Real-life problems

Real-life problems often have many additional constraints, which prevent a clean solution method. Local search works (almost) always well Column generation may be a good alternative. You must decide what to do with the additional constraints. Possibilities:

Add these as constraints in the master problem (only if these are linear) Include these in the pricing problem. The pricing problem should not become too difficult to solve.

See the application of using column generation to find healthy, personalized rosters.

17

slide-18
SLIDE 18

Scheduling

Goal: decide for each job (task) by which machine it is executed during which time interval such that all constraints are satisfied and some objective is minimized. Example: one (or more) mechanic has to repair a number of cars in a garage. The resulting schedule is shown as a Gantt-chart: time goes from left to right

  • ne vertical line per machine

a job is depicted as a block: the left border indicates the start time and the right border indicates the completion time.

18

slide-19
SLIDE 19

Single and parallel machine scheduling

Standard assumptions (can be different in other models) There are m machines (m can be equal to 1); together these have to carry out the work. Notation M1, . . . , Mm. Each machine is continuously available from time zero

  • nwards.

Each machine has capacity one (it can handle at most one job at a time); the completion time of one job may be equal to the start time of the next job.

19

slide-20
SLIDE 20

Jobs (1)

Standard assumptions (can be different in other models) There are n jobs (notation J1, . . . , Jn). Executing job Jj requires an uninterrupted period of length pj (processing time); preemption is not allowed, unless stated differently. The execution of job Jj should not start before its release date rj; if rj has not been specificied, then rj = 0. The execution of job Jj should be completed at or before its deadline ¯ dj; if ¯ dj has not been specificied, then ¯ dj = ∞.

20

slide-21
SLIDE 21

Jobs (2)

Job Jj cannot start before all its predecessors have been

  • completed. The precedence relations (if available) are

specified in the form of a directed acyclic graph. Job Jj can have a weight wj. Job Jj can have a due date dj; this due date indicates a preferred completion time, which is used in the objective.

21

slide-22
SLIDE 22

Notation; parameters

Jj: job j (j = 1, . . . , n). Mi: machine i (i = 1, . . . , m). pj: processing time of Jj. rj: release date of Jj; Jj cannot be started before time rj. ¯ dj: deadline of Jj; Jj should be finished at or before time ¯ dj. dj: due date of Jj; this is used to compute the objective value. wj: weight of Jj; this is used to compute the objective value. fj(t): cost function of Jj; it measures the cost of completing Jj at time t. We assume that fj is non-decreasing in t.

22

slide-23
SLIDE 23

Notation; variables

Consider a given schedule σ Cj(σ): completion time of Jj in schedule σ; Cj for short. Sj(σ): start time of Jj in schedule σ; Sj for short. If preemption is not allowed, then Cj = Sj + pj. Lj(σ) = Cj(σ) − dj: lateness of Jj in schedule σ; Lj for short. Tj(σ) = max{Lj(σ), 0}: tardiness of Jj in schedule σ; Tj for short. Uj(σ): this is an indicator function that signals whether Lj > 0 (then Uj = 1) or Lj ≤ 0 (then Uj = 0); Uj for short.

23

slide-24
SLIDE 24

Possible objectives

We always assume that the objective must be minimized. Cmax: the maximum completion time, or the time at which the last machine finishes. Also called the makespan of a schedule. Lmax: the maximum lateness. This is typically used to check how well the due dates are respected. Remark that only the maximum counts. Tmax = max{Lmax, 0}: the maximum tardiness. fmax: maximum cost. This is a generalization of Lmax.

Cj: total completion time. Here each job counts (with

equal weight).

wjCj: total weighted completion time. wjUj: the weighted number of tardy jobs.

24

slide-25
SLIDE 25

Three-field notation scheme (1)

To denote the problem, it is formulated as α|β|γ. α specifies the machine environment. Possibilities for α:

1 indicates a single machine Pm: there are m parallel, identical machines, where m is given. The jobs are divided over the machines; the processing time of Jj is equal to pj regardless of the machine. P: as above, but the number of machines is part of the input. Qm and Q: the same as Pm and P, but now each machine Mi works at a given speed si; executing job Jj by Mi requires pj/si time. Rm and R: the same as Pm and P, but now executing job Jj by Mi requires pij time; there is no relation between the pij values. J: the job shop model. Here a job consists of a number of

  • perations that must be executed in a given order; each
  • peration requires a given machine.

F: the flow shop model. This is a special case of the job shop problem, in which each job passes the machines in the same

  • rder. Such a model is typically used to model a conveyor belt.

25

slide-26
SLIDE 26

Three-field notation scheme (2)

In the second field β we denote the job characteristics. Note that due dates, weights etc., which are needed to compute the objective value, are not denoted in the second field. rj: for some jobs a release date > 0 has been specified. ¯ dj: for some jobs a deadline has been specified. prec: there are precedence constraints. qj: after the execution, Jj requires an additional operation that takes qj time units, and for which no machine capacity is required. pj = 1: unit processing times. pmtn: preemption is allowed. You can resume the job on any machine. In the third field the objective is specified.

26

slide-27
SLIDE 27

Some problems

1||Cmax: one machine, no additional features, the goal is to minimize the makespan. 1|rj|Cmax: one machine, release dates, the goal is to minimize the makespan. 1|¯ dj|Cmax: one machine, deadlines, the goal is to minimize the makespan. 1|prec|Cmax: one machine, precedence constraints, the goal is to minimize the makespan. 1|prec, rj|Cmax: one machine, both precedence constraints and release dates, the goal is to minimize the makespan. 1|prec, ¯ dj|Cmax: one machine, both precedence constraints and deadlines, the goal is to minimize the makespan.

27

slide-28
SLIDE 28

1|¯ dj|Cmax (1)

Two solution approaches Construct the schedule backwards Construct the schedule from time zero onwards (this one will follow later)

28

slide-29
SLIDE 29

Scheduling backwards (1)

Construct the schedule backwards: from right to left. Each feasible schedule that contains idle time will remain feasible if you shift the jobs to the left, such that no idle time remains, whereas the value of the objective value becomes smaller. Hence, there is no reason for idle time: the jobs are scheduled in the interval [0, pj]. Construct the schedule from right to left: you must look for a job to end at time pj; any job Jh with ¯ dh ≥ pj will do. Schedule this job and look at the next completion time for which you need a candidate.

29

slide-30
SLIDE 30

Scheduling backwards (2)

Proof of correctness. Suppose you cannot find a job Jh with ¯ dh ≥ T for some completion time T. Let S denote the set of unscheduled jobs. We have that max

j∈S

¯ dj < T =

  • j∈S

pj This shows that it is not possible to process the jobs in S such that the last one finishes before its deadline. Hence, there cannot exist a feasible schedule. How to solve 1|prec, ¯ dj|Cmax?

30

slide-31
SLIDE 31

Maximum lateness

Each job Jj has a due date dj that indicates a preferred completion time. The lateness of job Jj (notation Lj) is defined as the difference between the completion time and the due date: Lj = Cj − dj. The lateness can be negative; the tardiness Tj is defined as max{0, Lj}. Lmax measures how well due dates are obeyed. An upper bound L on Lmax defines a deadline for each job! How to solve 1||Lmax?

31

slide-32
SLIDE 32

Earliest Due Date (EDD) rule

You can construct an optimal schedule by putting the jobs in

  • rder of due date, starting with the smallest one.

Correctness proof follows from optimality of backwards scheduling rule for 1|¯ dj|Cmax. Other, very useful idea of a correctness proof: use an interchange argument. This proof concept is used (and misused) a lot!

32

slide-33
SLIDE 33

Proof based on an interchange argument

Standard approach: Consider the schedule constructed by the algorithm; call it σ. Suppose that σ is not an optimal schedule; let π denote an

  • ptimal schedule. The idea is that we show that π cannot be
  • ptimal (or is not better than σ).

Make some changes in π, which results in π′. Show that π′ is not worse than π (preferrably π′ is better than π, since you have then shown that π is not optimal, which concludes the proof). If π and π′ have the same objective value, then see to it that π′ ‘looks more like σ than π’. Continue in this way until π′ has become equal to σ. Pitfall: you should not make changes in σ and conclude that each change will make σ worse; this only proves local optimality.

33

slide-34
SLIDE 34

Proof EDD rule through an interchange argument

σ is the EDD schedule; π is an optimal schedule. Pick two consecutive jobs i and j in π that are in the wrong

  • rder (i before j, whereas di > dj. Why is this possible?

Interchange i and j in π; this yields π′. Show that Lmax(π′) ≤ Lmax(π) (up to you). The number of jobs in the wrong order has decreased, and hence after a finite number of interchanges π′ has become equal to σ, which implies that σ is an optimal schedule. How can you show that Lmax(π′) ≤ Lmax(π)?

34

slide-35
SLIDE 35

Interchanging Ji and Jj

π . . . . . . Ji Jj π′ . . . . . . Ji Jj

Figure: Sketch of the interchange

35

slide-36
SLIDE 36

Proof of Lmax(π′) ≤ Lmax(π)

Since two adjacent jobs are interchanged, nothing changes in the remainder of the schedule Job j is completed earlier in π′ than in π; hence, Lj(π′) ≤ Lj(π). What remains to be shown is that Li(π′) ≤ Lmax(π) We have that Ci(π′) = Cj(π). Since di > dj, we find that Li(π′) = Ci(π′)−di = Cj(π)−di < Cj(π)−dj = Lj(π) ≤ Lmax(π). Next problem: how to solve 1|prec|Lmax using a forward sequencing rule?

36