210 likes | 467 Views
FYP Progress Presentation. Genetic Algorithm (GA). Presented By:. Oluwaseun Akintimehin. Project Goals. Develop / apply a GA search algorithm to a basic timetable scenario. Visually display results and incorporate low level user interface.
E N D
FYP Progress Presentation Genetic Algorithm (GA) Presented By: Oluwaseun Akintimehin
Project Goals • Develop / apply a GA search algorithm to a basic timetable scenario. • Visually display results and incorporate low level user interface. • Define full New Engineering Building (NEB) timetabling model and fitness criteria. • Test a range of scenarios and verify correctness. • Define limitations of the system.
Develop / apply a GA search algorithm to a basic timetable scenario. • Develop a series of diagrams illustrating each project phase. • Define a basic timetabling problem. • Develop a solution to the timetabling problem. • Apply GA search algorithm to the timetabling solution.
A Basic Timetabling Problem A program is asked to read the following input data, and to generate a suitable fitness without taking into account the GA process. • Number of Modules: 8 • Number of Staffs: 8 • Number of Groups: 2 • Number of Room: 3 • Number of Periods: 12(4 for each room) • Number of Days: 1
1 1 1 2 2 3 2 1 3 1 3 2 4 2 4 2 5 2 5 2 6 3 6 1 7 3 7 1 8 3 8 1 Rules Module Group Staff Nos. Hours
Limits • A staff can not give more than one lecture at the same time period. • Teaching group can not learn more subjects at the same time period. • Room can be devoted to only one module in the same time. • Module can not be assigned time period different from the times stated. • Group and staff should be assigned to the right module based on the rules.
Solution For Timetabling Problem • Initialise variables according to problem definition. • Mmax = 8 //Max value of Modules • Gmax = 2 //Max value of Groups • Smax = 8 //Max value of Staffs • Rmax = 3 //Max value of Rooms • Tmax = 4 //Max value of Time periods • F = Fitness
for(r=1 to r=Rmax) { for(t=1 to t=tmax) { cell[r,t,m] = RandomNumb(1 to Mmax) cell[r,t,g] = RandomNumb(1 to Gmax) cell[r,t,s] = RandomNumb(1 to Smax) } } Module is represented as 1 in three dimensional array Group is represented as 2 in three dimensional array Staff is represented as 3 in three dimensional array
E.g. cell[1,1,1] represents the value of m where r =1and t =1. cell[3,2,3] represents the value of s where r = 3 and t = 2.
1 1 1 2 2 3 2 1 3 1 3 2 4 2 4 2 5 2 5 2 6 3 6 1 7 3 7 1 8 3 8 1 • Rules • Modules Groups Staff Nos. Hours cell(ref)[m,g] allows the checking the group with respect to the module. cell(ref)[m,s] allows the checking the staff with respect to the module. nh(ref)[m] allows the checking of the number of hours assigned to the module.
Run first test to see that the right module, group and staff are assigned according to the problem definition. Increment fitness as applicable. • for(r=1 to r=Rmax) • { • for(t=1 to t=Tmax • { • F = 2 (default) • cell[r,t,1] = m • if(cell[r,t,2] |= cell(ref) [m,g] • tempFit = 1 • if(cell[r,t,3] |= cell(ref)[m,3] • tempFit = 1 • else • tempFit = 0 • } • F = F + tempFit • }
Run second test to make sure the modules are assigned the right number of hours. Increment or decrement fitness according the difference in error. • for(r=1 to r=Rmax) • { • for(t=1 to t=Tmax) • { • Diff = | Nh[r,t,m] – Nh(ref)[m] | • tempFit = Diff • Fit = Fit + tempFit • } • F = F + Fit • }
Run test to prevent group and staff clashes between time periods. • for(t=1 to t=Tmax) • { • for(r=1 to r=Rmax) • { • for(s=r+1 to s=Rmax) • { • if(cell[r,t,2] = cell[s, t, 2] • tempFit++ • F=tempFit • } • } • } • The same code will be used for testing the staff (cell[r,t,3]).
1, 2, 2 5, 2, 3 2, 1, 2 4, 3, 1 6, 3, 2 1,2, 1 3, 3, 5 5, 1, 5 8, 3, 2 1, 1, 1 5, 2, 5 2, 3, 2 7, 1, 4 4, 3, 4 3, 2, 3 4, 2, 4 6, 3, 6 1, 1, 1 3, 1, 3 5, 2, 5 8, 3, 8 7, 3, 7 4, 2, 4 3, 1, 3 1, 1, 1 5, 3, 5 2, 3, 2 4, 2, 4 6, 3, 6 1, 1, 1 3, 1, 3 5, 2, 5 8, 1, 8 7, 2, 7 4, 2, 4 3, 1, 3 • The following are different scenarios of the timetable and their fitness. • Scenario 1 • Scenario 4 • Fitness = 0 • Scenario 2 Fitness = 24 Fitness = 6 Fitness = 6