off the peg or made to measure! timetabling and scheduling with sa and ts. kath dowsland gower...

35
Off the peg or made to measure! Timetabling and scheduling with SA and TS. Kath Dowsland Gower Optimal Algorithms Ltd [email protected] (talk available at www.goweralg.co.uk/talks/) Bespoke tailoring High street stores ?

Post on 18-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Off the peg or made to measure!Timetabling and scheduling with SA and TS.

Kath Dowsland

Gower Optimal Algorithms Ltd

[email protected]

(talk available at www.goweralg.co.uk/talks/)

Bespoke tailoring

High street stores

?

ProblemSpecific

?

GenericGeneric

ProblemSpecific

Generic implementation.

• Easy to develop

• Solution quality OK

Problem specific implementation.

• Development effort

Change in specification

• Generic approach may need minor modification

• Problem specific approach may have to start afresh.

Main focus.

Secondary focus.

Talks / seminars

Reading widely

Solving my problem

I wonder who else is going to the Pen & Wig tonight

Blaa lblaa queueing blaa Severn Bridge blaa blaa blaa blaa blaa blaa

Blaa lblaa modelling blaa AIDS/HIV blaa blaa blaa blaa blaa blaa

Blaa lblaa timetabling blaa simulated annealing blaa blaa blaa blaa blaa blaa

Blaa lblaa nurse scheduling blaa IP model blaa blaa blaa blaa blaa blaa

Listening to your supervisors’ tales

of past research projects ????!

OR…

Overview.• Introduction• Laboratory scheduling• Examination timetabling• Nurse rostering• Conclusions

?

Problem

Lots of published results

Algorithm

Solution

Models

In an ideal world!

Lots of published results

Largest problem solved

Models

?

Problem

Either

X

?

Problem

OR

In the real world!

???

Answer:

Use a metaheuristic

• Local search based e.g. simulated annealing, tabu search, GRASP

• Population based e.g. genetic algorithm, ant colony optimisation, scatter search

Lots of published results

Local Search(minimisation).• Problem specified in terms of a solution space with an evaluation function, f, and

neighbourhood structure, N, defined on it.

• From any starting solution S find a neighbour Snew that is better in terms of f. Replace S by Snew.

• Continue until no improving neighbours exist.

• Well suited to scheduling type problems as they have a natural neighbourhood defined by changing the time (or other attribute) of an event or swapping 2 events.

• But: converges to local, rather than, global optimum.

• Simulated annealing (SA) and tabu search (TS) designed to overcome this problem by accepting ‘uphill’ moves.

• SA accepts such moves with a probability depending on the change in the evaluation function and the search time.

• At a local optimum TS accepts the ‘best’ neighbour. Some moves are classified as tabu to avoid cycling.

• For both techniques smooth, gently sloping solution landscapes are best.

A Computer Laboratory Scheduling Problem

The development of AILSA

An Intelligent Laboratory Scheduling Algorithm

The problem.

Given:

• A laboratory of known capacity, Q

• A set of m timeslots when the laboratory is available

• A set of n students together with the times when each is free to attend

Find:

• An allocation of each student to a suitable timeslot

Such that:

• The number of sessions utilised is minimised

• The capacity is not exceeded

• Spare capacity is spread evenly

Related models.

If we ignore capacity we have a set covering problem.

• Let Tj be the set of students who can attend at time j. Minimise the number of sets, Tj, needed to cover all the students.

• Large NP-hard problem.

If we know which timeslots to use we have a transportation problem.

• Let each timeslot define a supply node with available supply = Q, each student define a demand node with a demand of 1. Find a feasible allocation of demand nodes to supply nodes.

• Easy to solve using a variety of techniques (e.g. network flow, LP)

Other location type models also provide partial solutions

A local search approach.

Solution space: allocations of students to a time-slot they are free to attend

Neighbourhood move: move a student to another session

Cost:

Assumption: p =

Define the ideal occupancy as C = n/p

Cost then based on sine curve.

Occupancy

|Sin(x)|

Qn

C

0 0

Problem 1.

Search gets stuck in valleys separated by high hills.

Question 1: Can we escape intelligently?

Question 2: Even if we can escape, how do we know there is a feasible solution?

?

Causes

1. Converged towards a set of p slots that do not cover everyone.

2. No allocation of students to selected p slots satisfying capacity constraints.

Solutions

Identify when search is converging towards p slots and:

1. Include a penalty term relating to relevant constraint from set covering model into cost.

2. Solve transportation problem.

• if feasible, problem solved

• if not feasible add penalty term to drive the search away from the current set of slots.

Can also determine infeasibility by solving small set covering problems defined by the constraints identified in (1) and restarting with new p if infeasible.

Problem 2.

• Search slow to get to point of convergence.

• Cause: biased sampling.

• Solution: sample student first / slot first in alternate iterations.

?

Is it robust?

• Changes in problem size/data.

• Preferences on time-slots.

• More than one solution.

• Minimising slots for a subset of students.– Combining new objective into cost not successful.

– Solved in 2 phases.

– Solve for subset first and then add additional slots around this solution.

Problem specific information enables search to seek out several local optima

quickly and efficiently.

The Examination Timetabling Problem

The development of TISSUE

The Intelligent Scheduling System for University Exams

The problem.Given

• A set of k time slots

• A set of n exams

• Other resources (rooms, invigilators etc)

• A list of candidates for each exam

• A list of requirements (including time windows) for each exam

Find

• An allocation of exams to time-slots

Such that

• No student is timetabled to sit 2 exams at the same time

• The number of back-to-back exams (known as second order conflict) is minimised

• Other secondary objectives / constraints are taken into account.

Related model.

Vertices = set of exams set of timeslots

Edges connect:

• All pairs of timeslot vertices

• Pairs of exam vertices with a student in common

• Exam vertices to timeslot vertices at infeasible times

Objective: find a feasible colouring of G(V,E) in k or less colours.

If the only objectives are to avoid clashes and meet the time-window constraints then the problem is a graph colouring problem.

A simulated annealing approach.

Local search framework

• Solution space: allocation of exams to time-slots subject to capacity constraints

• Neighbourhood move: move one exam

• Cost: weighted cost of student clashes, second order-conflict + other objectives.

Problem:

• Failure to converge to good feasible solutions.

Lessons from previous experience. Solve in phases.• Find feasible solution first.• Then search space of feasible solutions.• Reasonable results.Sampling.• Natural sampling: select exam, then slot.• Other possibilities:

– select ‘from’ slot, then exam, then ‘to’ slot– Select ‘from’ slot, then ‘to’ slot, then exam.

020406080

100120140

1 2 3Sampling policy

Co

st

Problem.

Space of feasible solution disconnected (or very sparsely connected)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~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icate the percentage savings)

36.17 23.76 35.19

42.80

30.89

46.7736.50

20.59

Data sets

sec

on

d o

rder

co

sts

Natural

Kempe

500

1000

1500

2000

2500

Is it robust?

• Used to schedule exams at Swansea since 1992

• Produces good solutions on a range of bench-mark data

• Works well with different objectives and constraints.

The Nurse Rostering Problem

The development of CARE

Computer Aided Rostering Environment

The problem.

Objective: to produce weekly schedules of work for all nurses on each ward so that:

• minimum covering requirements are met• nurses’ preferences and requests are considered• schedules are deemed to be fair

Detail:

• The day is made up of 3 shifts: 2 7.5 hour day shifts (earlies and lates) and a longer night shift.

• Nurses work either days or nights in a given week with more days than nights comprising a week’s work.

• Different contracts give different numbers of days/nights worked e.g. (5,4), (4,3), (3,3).

• Covering requirements are given cumulatively for 3 grade-bands.

• Nurses can submit requests for days/nights on/off.

• Bank nurses can be used if cover cannot be met without.

After several consultations with the hospital we were able to put numeric values on the different non-binding constraints / secondary objectives.

Solve in 3 phases.

Phase 1: determine the number of bank nurses.

• Solve as knapsack problem:– Maximise the number of day shifts available subject to the constraint that

the number of night-shifts sacrificed is sufficiently low.

Phase 2: allocate nurses to to day/night/day-off for each day.

• See later.

Phase 3: allocate nurses on days to ‘earlies’ and ‘lates’.

• Solve as network flow problem:– Nodes represent the nurses and days/grades. Flow variables represent

working ‘earlies’. Appropriate costs and bounds ensure preference costs are optimised subject to nurses’ availability and cover constraints.

A local search approach to phase 2.

Work with shift patterns and solve in phases.

Phase 2.1: Find a feasible solutionPhase 2.2: Search space of feasible solutions

Solution space: allocation of nurses to feasible shift patternsNeighbourhood move: change pattern of a single nurseCost: total shortfall in cover or sum of preference costs depending on phase.

BUT

Both phases: valleys that are difficult to escape

?

Both phases: large plateau-like areas

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~ 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 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Phase 2.2: disconnected solution space

?

Solutions.

In phase 2.1:

a. Some deep valleys due to infeasible day-night mix – restrict moves to those that correct this.

b. Negotiate plateaux and cross mountains using chains of moves – good chains correspond to shortest paths in small graphs.

In phase 2.2:

c. Mountains, plateaux and some connection problems solved by extending a. and b. above to finding negative cost circuits so that cover is unchanged and preference cost improves.

d. Remaining connection problems avoided by crossing back into infeasible region and repeatedly oscillating through phases 2.1 and 2.2.

e. In order to ensure component likely to give good solutions, cost in phase 2.1 includes a preference element.

Search carried out as an aggressive TS with tabu lists and diversification strategies based on day/night mix

Is it robust?

Changes to specification.• Addition of nurses working both days and nights in the same week.

• Spreading of over-cover

• Constraints on number of highly paid nurses working weekends

• Introduction of team working.

All incorporated with minor changes due to ability to seek out many good local optima.

‘A general algorithm is like a size 48 coat. It can cover everybody but it doesn’t fit most people very well.’

Researching the underlying model(s)

A made-to-measure solution.

Potential benefits

• Better quality solutions

• Obtained more quickly

• and more consistently

Can also prove robust.

Conclusion.

Andanalysing the physical

problem

Reading widely

Talks / seminars

(talk available at www.goweralg.co.uk/talks/)

Social lifeTravel

The talk is based on:

K.A Dowsland,’Off-the-peg or made to measure: timetabling and scheduling with SA and TS' in Practice and Theory of Automated Timetabling II (Burke, E. and Carter, M. eds) LNCS 1408, (1997 )

The laboratory scheduling problem.

K.A.Dowsland, ‘Using simulated annealing for efficient allocation of students to practical classes’ in Applied Simulated Annealing (Vidal R.V.V. ed.) LNEMS 396, (1993) 125-150 Springer.

The examination scheduling problem.

J.M. Thompson & K.A. Dowsland ‘Variants of simulated annealing for the examination scheduling problem’ Annals of Operations Research 63 (1996) 105-128

J.M. Thompson & K.A. Dowsland ‘General cooling schedules for a simulated annealing based timetabling system’ in Practice and Theory of Automated Timetabling, (Burke E. and Ross, P. eds.), LNCS 1153 (1996) 345-363, Springer.

J.M. Thompson and K.A. Dowsland ‘A robust simulated annealing based examination timetabling system’ Comput. & Opns. Res. 25 (1998) 637-648

The nurse scheduling problem.

K.A. Dowsland ‘Nurse scheduling with tabu search and strategic oscillation’ EJOR 106 (1998) 393-407

K.A. Dowsland & JM Thompson ‘Solving a nurse scheduling problem with knapsacks, networks and tabu search’ J. Opl. Res. Soc. 51 (2000) 825-833

(talk available at www.goweralg.co.uk/talks/)

References