Scheduling

18
Constraint programming approach for school timetabling Stathis Grigoropoulos Timetabling & Scheduling 29-06-2012 Christos Valouxis , Efthymios Housos

description

Constraint programming

Transcript of Scheduling

Page 1: Scheduling

Constraint programming approach for school timetabling

Stathis Grigoropoulos

Timetabling & Scheduling

29-06-2012

Christos Valouxis , Efthymios Housos∗

Page 2: Scheduling

Outline

• Constraint Programming• Context/Problem• Constraints• Lower Bound estimation• Solution• Optimization• The Algorithm• Practical results• Conclusion

Page 3: Scheduling

• Consist of:– a set of variables X={x1,…,xn}

– variables’ domains Di (finite set of possible values)

– a set of constraints

Example:• X::{1,2}, Y::{1,2}, Z::{1,2}• X = Y, X Z, Y > Z

• Solution of CSP (constraint satisfaction problem)– assignment of value from its domain to every variable satisfying

all the constraints

Example:• X=2, Y=2, Z=1

Constraint Programming

Page 4: Scheduling

• A rich constraint language– Arithmetic, higher-order, logical constraints– Global constraints for natural substructures

• Specification of a search procedure– Definition of search tree to explore– Specification of search strategy

Constraint Programming

Page 5: Scheduling

Constraint Programming

• Branch and Prune– Prune: eliminate

infeasible configurations– Branch: decompose into

subproblems• Prune

– Carefully examine constraints to reduce possible variable values

• Branch– Use heuristics based on

feasibility info• Main focus:constraints

and feasibility

• Branch and Bound– Bound: eliminate

suboptimal solutions– Branch: decompose into

subproblems• Bound

– Use (linear) relaxation of problem (+ cuts)

• Branch– Use information from

relaxation• Main focus: objective

function and optimality

CP VS IP

Page 6: Scheduling

• systematic search only => no efficient• consistency only => no complete• combination of search (backtracking) with

consistency techniques• methods:

– look back (restoring from conflicts)– look ahead (preventing conflicts)

look back

Labelling order

look ahead

Constraint Programming/Constraint Propagation

Page 7: Scheduling

Context• Typical Greek High School• A number of teachers with various educational

specializations are available.• Every teacher is qualified to teach a certain number of

courses. • Every year has a number of class sections. Typically around

four class sections• The teaching days are Monday–Friday• The daily teaching hours for the students are either six or

seven. • Every class section has its own permanent room => no room

constraint• The teachers are assigned to the class sections before the

creation of the timetable• The courses are the same for all High Schools

Page 8: Scheduling

Parameters and Sets

Page 9: Scheduling

Constraints• In every class section and for each day and hour only one

teacher is teaching:

• A teacher cannot be present at more than one class section at the same instance:

• Balanced distribution of teaching hours:

– the variable ShiftT[t][d] has the value h => that teacher t at day d and at hour h is teaching in some class section.

Page 10: Scheduling

Constraints• Class section balanced weekly distribution for the teaching

load of every teacher:

• Every class section must have in the timetable the specified number of lectures by the proper teachers.

• Every teacher must have in the timetable the specified lectures for the proper class sections and working days.

• The teaching schedule of every class section must be continuous and always starting on the first hour of the day. Any non-teaching period is allowed only in the last hour of the day

Page 11: Scheduling

Quality Constraints/Objective Function• An effort should be made to respect the teacher preferences

for early in the morning or later in the day teaching hours, for all teachers(cost1= desirability of the assigned teaching hours)

• There must exist a minimum number of non-teaching hours (idle hours) in the middle of a sequence of daily teaching hours(cost2)

• Objective Function: Min(cost1 + cost2)

hours. It is calculated using the variables ShiftT of every teacher. are

• {0; 2; 5; 10; 20; 50; 100}.

Page 12: Scheduling

Lower Bound estimation• Cost2: Lower

Bound = 0• Cost1: relaxation

and minimum cost matching

• Gabow's algorithm

For optimum solution

Page 13: Scheduling

Solution• ILOG solver library• Searching systematically through all the possible

assignments of values to variables• Solution is found when values have been assigned to all the

variables ProgrC• Trick

– Assign the teachers first, they affect the quality of the solution!– sequentially for all teacher, a graph and minimum cost matching!

• After the definition of a single ShiftD[d][h], check variables ProgrC that are afected

• CP framework is allowed to further search for better solutions by adding a new artificial constraint to the problem that basically

• forces the CP system to suggest solutions with improved cost at all times• BUT still, search space to big

Page 14: Scheduling

Optimization

• Space reduction search strategies– If the best solution up to this point does contain idle hours and the term cost1

is equal or very close to the lower bound of cost1, the search is allowed to proceed only to areas where the total idle hours of the current solution are reduced beyond the ones of the best solution

– When during the search the total idle hours of the current solution are greater than the idle hours of the best solution, the search stops investigating this area of solutions, because a solution with less idle hours is always more desirable

• Local Search– for 1 and 2 days restrict the variables to find optimal solution

Page 15: Scheduling

The Algorithm

Page 16: Scheduling

Results

• Solved the teacher, class timetable with the same formulation

Page 17: Scheduling

Conclusion

• CP can be very efficient in timetabling problems• CP + Local Search = Good• Would be nice to see CP + Column Generation• Would be nice to see CP + IP

Page 18: Scheduling

Thank You!

• Questions?