FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture...

43
FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By By Ersan ERSOY Ersan ERSOY ( ( Engineering Project) Engineering Project) Advisor: Advisor: Assist.Prof.Dr. Assist.Prof.Dr. Ender Ender ÖZCAN ÖZCAN

Transcript of FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture...

Page 1: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

FINAL EXAM SCHEDULER(FES)

Department of Computer EngineeringFaculty of Engineering & Architecture

Yeditepe University

By By Ersan ERSOYErsan ERSOY

((Engineering Project)Engineering Project)

Advisor:Advisor: Assist.Prof.Dr.Assist.Prof.Dr. Ender ÖZCAN Ender ÖZCAN

Page 2: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

2

Outline

• Timetabling Problem• Timetabling Markup Language (TTML)• Genetic Algorithms (GAs)• Implementation• Experiments• Conclusion & Future Work

Page 3: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

3

Timetabling Problem

• Assignment of variables (courses, exams etc.) to some specific domains (time slots, rooms, etc) based on various constraints.

• NP-complete problem.• Hard and soft constraints.

Page 4: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

4

Examination Timetabling• Represented as (V, D, C)

– V contains variables (exams),– D contains domains (time slots , rooms),– C contains constraints.

• Constraint classifications :– Edges.– Preset and exclusions.– Ordering.– Event-spread.– Capacity.

• Aim in this project is to assign exams to time slots.

Page 5: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

5

Solution Approaches

• Human based techniques. • Random search. • Simulated annealing.• Tabu search.• Evolutionary algorithms.

Page 6: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

6

Timetabling Markup Language (TTML)

• Standard representation for timetabling problems.

• Based on XML and MathML

• Consists of three parts.– Input-data.

– Output.

– Test-results.

Page 7: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

7

TTML (Cntd.)

• Input-data– Author.

– Description.

– References.

– Variables.

– Domains.

– Constraints.

• Classifiers

• Hard

• Soft

Page 8: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

8

TTML (Cntd.)

• Classifiers– Base

– Parent

• Projection– Self

– Child

– Single

Page 9: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

9

TTML (Continues)

• Supports 11 different constraint functions.– notsame

– nooverlap

– preset

– exclude

– ordering

– eventspr

– fullspr

– freespr

– chksum

– attrcomp

– resnoclash

Page 10: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

10

Genetic Algorithms (GAs)• GAs were introduced by J. Holland.

• Member of Evolutionary Algorithms (EAs)

• Simply explained as :– Set i to 0 and randomly generate an initial population (P(i))

– Do until break criteria is satisfied• Evaluate the fitness of each individual

• Select parents of the next generation from P(i) according to their fitness

• Produce new offspring by using crossover and mutation operators and put them into P(i+1),set i to i+1

Page 11: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

11

Components of GAs (Cntd.)

• Chromosomes.• Gene.• Population.• Representation

– Binary encoding.– Real value encoding.

• Initializing Population

Page 12: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

12

Components of GAs (Cntd.)

• Evaluating chromosomes – Fitness function.

• Mate Selection.– Fitness-based selection

– Rank-Based selection

– Tournament Selection

Page 13: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

13

Components of GAs (Cntd.)

• One-point Crossover

Page 14: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

14

Components of GAs (Cntd.)

• Two-point Crossover

Page 15: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

15

Components of GAs (Cntd.)

• Uniform Crossover

Page 16: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

16

Components of GAs (Cntd.)

• Mutation– Randomly alters the values of genes of a chromosome

after crossover.

• Replacement Strategy – Trans-generational Genetic Algorithms.– Steady-State Genetic Algorithms.

• Elitism

Page 17: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

17

Components of GAs (Cntd.)

• GA Parameters– Crossover probability.– Mutation probability.– Population size.

Page 18: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

18

GAs (Cntd.)

• Memetic Algorithms (MAs) – In GAs, crossover and mutation usually performs

solutions near the local optima – Memetic Algorithms (MAs) can be explained as

hybridization of GA and local search algorithms.– Gene in GAs is called meme in MAs.

Page 19: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

19

Implementation

• Three different programs are implemented.– CONFETI generates examination problem data in

TTML format.

– Final Exam Scheduler (FES) that takes problem input in TTML format and finds the optimum solution.

– FESViewer is implemented to view the output of FES

Page 20: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

20

Implementation (CONFETI)

– Java applet.

– Support generating TTML documents for examination timetabling problem.

– Consists:• Description

• Domain

• Variable

• Classifiers– Students

– Curriculum

• Base Classifiers

• Constraints

• Capable of loading TTML documents

Page 21: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

21

Implementation (FES)

– Java application

– Solves examination problems.

– Deals with different types of constraints that can be converted to TTML form by CONFETI.

Page 22: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

22

FES• Getting TTML Document and Basic Data

Structures.– Each course (variable) in TTML document stored in a

class (Variable) that contains duration (length of the exam), number students, list of hard domain slots, list of soft domain slots.

– Hard domains are initialized according to hard preset and exclude constraints.

– Soft domains are initialized according to soft preset and exclude constraints.

– This class contains a function that returns random slots according to hard and soft domain for each course.

Page 23: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

23

FES

• Getting TTML Document and Basic Data Structures.

– Each student information, student id and courses that he takes, are stored in memory after reading from input in a array of array form with a length of student number.

Page 24: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

24

FES• Getting TTML Document and Basic Data Structures..

– FES supports nine types of constraints that CONFETI supports. But it does not support every combination of these constraints. The set of constraints that FES generally does not support is:

– Constraints with parent classifiers other than Students parent classifier.

– Constraints which take two base classifiers as arguments.

– For eventspr, constraints that have compare value other than ‘<’ .

Page 25: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

25

FES

• Getting TTML Document and Basic Data Structures..

– If a preset or exclude constraint is defined to a course than, modifications are implemented on the hard and soft domains of the courses.

– If two courses must have same slot, same slot references are given to them.

Page 26: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

26

FES

• Algorithm– A Memetic algorthm is used.

– Representation • Each meme contains assigned slot number of an exam.

– Evaluating chromosomes • Fitness function

Where w i is the weight of the

constraint ci.

Page 27: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

27

FES• Algorithm

– Initializing Population • Random• With hill climbing.

– Mate Selection • Fitness-based selection

• Rank based Selection • Tournament Selection

– Crossover• One-point• Two-point• Uniform

Page 28: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

28

FES

• Mutation– Random

– Random & Swap

• Hill Climbing– Each constraint has an hill climbing function to

improve its fitness except for eventspr and some combinations.

Page 29: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

29

FES• Hill Climbing

– Pseudo code for hill climbing function of notsame • If there exits a violation between course A and B

– Set counter to 0

– While counter is less than 10

» Get a random slot for B

» if violation is improved

» return;

» Increment counter by one.

– Set counter to 0

– While counter is less than 10

» Get a random slot for A

» if violation is improved

» return;

– Increment counter by one.

Page 30: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

30

FES

• Hill Climbing

– Two hill climbing algorithm is defined• HCA1

– A chromosome is selected by using tournament selection. And hill climbing functions of all defined constraints is applied .

Page 31: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

31

FES

• Hill Climbing

– HCA2• Select a chromosome by tournament selection

– Step1. Select a constraint

– Use hill climbing function to whole chromosome

– If individual is improved go to Step1.

– Step2. Select a constraint

– Use hill climbing function to a part of chromosome

– If individual is improved go to Step2.

– Step3. Select a constraint

– Use hill climbing function to one gene of chromosome

– If individual is improved go to Step3.

Page 32: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

32

FES

• Replacement strategy – Steady-state – Trans-generational

• Other Features & User Interfaces– GA parameters, operator types, weight of constraints can

be entered.– Any time, output ( examination schedule) can be viewed

in student, department and faculty view and can be saved for examining later by FESViewer.

Page 33: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

33

Implementation(FESViewer)

• Java application.

• Displays the output of FES.

Page 34: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

34

Experiments• Experimental data

– Yeditepe University, Faculty of Engineering and Architecture, 2004 second semester, final exam data are used in the experiments.It consists of 443 courses, 1169 students

– Constraints• No students must have two exams in one slot (hard).• Students must have maximum 2 courses per day (hard).• Each section of the courses has to be assigned on the same slot (Hard).• Students have at least one free slot between two exams in a day (soft).• Also there are many preset and exclude constraints (hard or soft).

Page 35: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

35

Experiments• Experimental data

Hard constraints have a weight value of one and soft constraints except for the fourth constraint have weight value of 0.01. Fourth constraint’s weight is 0.075.

• Constant parameters

Page 36: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

36

Experiments• Variable parameters

Total of 24 different configuration

and 20 runs for each configuration is made.

Page 37: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

37

Experiments

• Results– Results are grouped by

the operator type to make compare between the types of each operator.

Page 38: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

38

Experiments

– Crossover

Page 39: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

39

Experiments– Mutation

Page 40: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

40

Experiments– Mate Selection

Page 41: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

41

Experiments– Hill Climbing

– HCA1 with two-point crossover, random mutation, and tournament selection can be best configuration.

Page 42: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

42

Conclusion & Future Work

• Experimental results show that hard constraints are easily solved. But few soft constraint violations remain.

• An early configuration is made for the algorithm by examining tests results

• In future, CONFETI and FES can be modified to support room assignments, and their constraints.

Page 43: FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)

43

Any Questions?