Class Scheduling using Generative AI.pptx

FarhanGhafoor7 89 views 39 slides Jul 03, 2024
Slide 1
Slide 1 of 39
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39

About This Presentation

rwerwer


Slide Content

Class Schedule Using a Genetic Algorithm Presented by: Engr. Farhan Ghafoor Engr . Ghulam Qasim

Abstract Time Table Scheduling is an NP-hard problem and hence polynomial time verifiable using genetic algorithms. It a typical scheduling problem that appears to be a tedious job in every academic institute once or twice a year. In earlier days, time table scheduling was done manually with a single person or some group involved in task of scheduling it manually, which takes a lot of effort and time. Planning timetables is one of the most complex and error-prone applications. Furthermore, Timetabling is the task of creating a timetable while satisfying some constraints. There are basically two types of constraints, soft constraints and hard constraints.

Abstract Soft constraints are those if we violate them in scheduling, the output is still valid, but hard constraints are those which if we violate them; the timetable is no longer valid. The search space of a timetabling problem is too vast, many solutions exist in the search space and few of them are not feasible. Feasible solutions here mean those which do not violate hard constraints and as well try to satisfy soft constraints . We need to choose the most appropriate one from feasible solutions. Most appropriate ones here mean those which do not violate soft constraints to a greater extent. In this project hard-constraints have been taken care of strictly and it has been ensured that soft-constraints are as well followed as much as possible .

Introduction Making a class schedule is one of those NP hard problems. The problem can be solved using a heuristic search algorithm to find the optimal solution, but it only works for simple cases . For more complex inputs and requirements, finding a considerably good solution can take a while, or it may be impossible. This is where genetic algorithms come in to the game to solve the impossible problem and to make possible.

Background When you make a class schedule, you must take into consideration many requirements as follows: Number of professors No of students No of classes and classrooms Size of classroom Laboratory equipment in the classroom A nd many others etc. These requirements can be divided into several groups by their importance .

Background Hard requirements (if you break one of these, then the schedule is infeasible): A class can be placed only in a spare classroom. No professor or student group can have more then one class at a time. A classroom must have enough seats to accommodate all students. To place a class in a classroom, the classroom must have laboratory equipment (computers, in our case) if the class requires it.

Background Some soft requirements (can be broken, but the schedule is still feasible): Preferred time of class by professors. Preferred classroom by professors. Distribution (in time or space) of classes for student groups or professors. Hard and soft requirements, of course, depend on the situation.

Objects of Class Schedule P rofessor The Professor class has an ID and the name of the professor. It also contains a list of classes that a professor teaches. Students Group The  StudentsGroup  class has an ID and the name of the student group, as well as the number of students (size of group). It also contains a list of classes that the group attends. .

The Genetic Algorithm Step-1 . Test each chromosome to see how good it is at solving the problem at hand and assign a Fitness Score accordingly. The fitness score is a measure of how good that chromosome is at solving the problem to hand. Step-2 . Select two members from the current population. The chance of being selected is proportional to the chromosomes fitness. Roulette Wheel Selection is a commonly used method. Step-3 . Dependent on the Crossover rate crossover the bits from each chosen chromosome at a randomly chosen point. Step-4 . Step through the chosen chromosomes bits and flip dependent on the Mutation rate. Step-5 . Repeat step 2, 3, 4 until a new population of N members has been created. Step-6 . Keep repeating until required fitness is achieved.

Objects of Class Schedule Classroom The Room class has an ID and the name of the classroom, as well as the number of seats and information about equipment (computers). If the classroom has computers, it is expected that there is a computer for each seat. IDs are generated internally and automatically . Course The Course class has an ID and the name of the course.

Objects of Class Schedule Class CourseClass  holds a reference to the course to which the class belongs, a reference to the professor who teaches, and a list of student groups that attend the class. It also stores how many seats (sum of student groups' sizes) are needed in the classroom, if the class requires computers in the classroom, and the duration of the class (in hours).

Algorithm First of all an initial generation of chromosomes is created randomly and their fitness value is analyzed. ii. New Generations are created after this. For each generation, it performs following basic operations: First of all preserve few fittest chromosomes from the previous generation as it is. This is called Elitism and is necessary to preserve desired characteristics in the coming generations. Randomly select a pair of chromosomes from the previous generation. Roulette wheel selection method has been used here in this project. Perform crossover depending on the crossover rate which is pretty high usually. Here single point crossover has been used. Perform mutation on the more fit chromosome so obtained depending on the mutation rate which is kept pretty small usually . Now analyze the fitness of the new generation of chromosomes and order them according to fitness values. Repeat creating new generations unless chromosomes of desired fitness value i.e. fitness=1, are obtained .

Chromosome The first thing we should consider when we deal with a genetic algorithm is how to represent our solution in such a way that it is feasible for genetic operations such as crossover and mutation . Also , we should know how to specify how good our solution is. In other words, we should be able to calculate the fitness value of our solution.

Representation

Chromosome Representation Chromosomes are represented by the Schedule class, and it stores the representation of a class schedule in these two attributes:

Chromosome Representation Additionally , the chromosome should store its fitness value and the parameters which are used by genetic operations. The fitness value is stored as follows:

Chromosome Representation Chromosome parameters are declared as follows:

Fitness Function Now we need to assign a fitness value to the chromosome. For only hard requirements is done firstly to calculate the fitness of a class schedule . Each class can have 0 to 5 points. If a class uses a spare classroom, we increment its score. If a class requires computers and it is located in the classroom with them, or it doesn't require them, we increment the score of the class.

Fitness Function Now we need to assign a fitness value to the chromosome. For only hard requirements is done firstly to calculate the fitness of a class schedule . If a class is located in a classroom with enough available seats, we increment its score. If a professor has no other classes at the time, we increment the class's score once again. The last thing that we check is if any of the student groups that attend the class has any other class at the same time, and if they don't, we increment the score of the class.

Fitness Function Now we need to assign a fitness value to the chromosome. For only hard requirements is done firstly to calculate the fitness of a class schedule . If a class breaks a rule at any time-space slot that it occupies, its score is not incremented for that rule. The total score of a class schedule is the sum of points of all classes. The fitness value is calculated as   schedule_score / maximum_score and maximum_score  is  number_of_classes *5. Note: The fitness values are represented by single-precision floating point numbers (float) in the range 0 to 1.

Crossover A crossover operation combines data in the hash maps of two parents, and then it creates a vector of slots according to the content of the new hash map. A crossover 'splits' hash maps of both parents in parts of random size . The number of parts is defined by the number of crossover points (plus one) in the chromosome's parameters . Then , it alternately copies parts form parents to the new chromosome, and forms a new vector of slots .

Crossover

Crossover

Mutation A mutation operation is very simple. It just takes a class randomly and moves it to another randomly chosen slot . The number of classes which are going to be moved in a single operation is defined by the mutation size in the chromosome's parameters. Visual C++ // Performs mutation on chromosome void Mutation();  

Program Flow to Search The genetic algorithm is fairly simple. For each generation, it performs two basic operations: Randomly selects N pairs of parents from the current population and produces N new chromosomes by performing a crossover operation on the pair of parents. Randomly selects N chromosomes from the current population and replaces them with new ones. The algorithm doesn't select chromosomes for replacement if it is among the best chromosomes in the population. And, these two operations are repeated until the best chromosome reaches a fitness value equal to 1 (meaning that all classes in the schedule meet the requirement). As mentioned before, the genetic algorithm keeps track of the M best chromosomes in the population, and guarantees that they are not going to be replaced while they are among the best chromosomes .

Results

Results

Results

Results

Conclusion The process of Time Table generation has been fully automated with this software. This application can now cater to multiple colleges, universities which can rely on it for their Time Table scheduling which earlier had to be done by hand.

Evaluation Using Genetics Algorithm, a number of trade-off solutions, in terms of multiple objectives of the problem, could be obtained very easily. Moreover , each of the obtained solutions has been found much better than a manually prepared solution which is in use .

Further Work Though this application serves as a basic time table generator, there is a lot more which could be done to make this project even better in terms of consideration of soft constraints like professor giving preference to particular class . The up-gradations I look up to currently will be Classroom size considerations, lab facility consideration and multiple subject selection for faculty. I will try to bring the following up-gradations very soon . More features such as schedule print for individual faculty etc. would also be involved to make this more useful as a final product . I will try to link our project to generate time table of departments of CoE (Avionics, Electrical, Mechatronics and Software Engineering)

Q&A

Thank You

Slide Title Make Effective Presentations Using Awesome Backgrounds Engage your Audience Capture Audience Attention https://www.codeproject.com/Articles/23111/Making-a-Class-Schedule-Using-a-Genetic-Algorithm

Slide Title Product A Feature 1 Feature 2 Feature 3 Product B Feature 1 Feature 2 Feature 3