Skip to content

makarenk0/timetable-genetic-algorithm

Repository files navigation

timetable-genetic-algorithm

Forms a timetable for IT faculty using genetic algorithm

Conflicts which algorithm resolves:

  • Same audiences between specialties (Computer science, Software engineering, Applied math) conflict
  • Same teachers on different lessons at the same time conflict
  • Non lecture audiences problem
  • Required number of lectures/pratices (when there are more or less than required number)

If algorithm sees low/negative progress it will mutate special percentage of chromosomes (percentageOfMutations field in GeneticMachine.cs)

The input data and limitations are written in data.json file

Main rules:

  • Each subject must have one lecturer and must be listed in "Subject_lecturer" property
  • All teachers must be listed in "Teacher"
  • All audiences must be listed in "Audience"
  • All working days must be listed in "WorkingDays"
  • All subjects must be listed in "Subject"
  • All specialties must be listed in "Specialty"
  • All lessons time range must be listed in "Lessons_time"
  • All groups of special specialty must be listed in *Specialty title here*_groups"
  • Other properties are limitaions on this data

Program.cs the entry point of a program consists of lines:

GeneticMachine gen = new GeneticMachine("../../../data.json", 15);
gen.FindAnswer();

You can pass in GeneticMachine path to data file and pass a number of starting population(number of chromosomes)

Example of one generation console output:

Generation number = 0
Chromosome 1 , Likelihood: 4,0300055 % , Fitness: 20
Chromosome 2 , Likelihood: 5,757151 % , Fitness: 14
Chromosome 3 , Likelihood: 5,037507 % , Fitness: 16
Chromosome 4 , Likelihood: 4,741183 % , Fitness: 17
Chromosome 5 , Likelihood: 6,200009 % , Fitness: 13
Chromosome 6 , Likelihood: 8,060011 % , Fitness: 10
Chromosome 7 , Likelihood: 7,3272834 % , Fitness: 11
Chromosome 8 , Likelihood: 6,200009 % , Fitness: 13
Chromosome 9 , Likelihood: 8,955568 % , Fitness: 9
Chromosome 10 , Likelihood: 6,716676 % , Fitness: 12
Chromosome 11 , Likelihood: 7,3272834 % , Fitness: 11
Chromosome 12 , Likelihood: 7,3272834 % , Fitness: 11
Chromosome 13 , Likelihood: 6,200009 % , Fitness: 13
Chromosome 14 , Likelihood: 8,060011 % , Fitness: 10
Chromosome 15 , Likelihood: 8,060011 % , Fitness: 10
Average fitness: 11,875

Example of full solution search in example1.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages