-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
24 lines (19 loc) · 915 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from core.chromosome import Chromosome
from core.population import Population
from core.genetic_algorithm import GeneticAlgorithm
import core.settings as settings
if __name__ == "__main__":
generation_number = 0
MAX_FITNESS = 1
population = Population(settings.POPULATION_SIZE)
population.print_population(generation_number)
while population[0].get_fitness() < MAX_FITNESS and generation_number < settings.MAX_GENERATION_NUMBER :
generation_number += 1
population = GeneticAlgorithm.evolve(population)
population.print_population(generation_number)
print(population[0].genes)
print("\n---------- all timetables ------------")
for c in settings.RAW_DATA["classes"]:
print("class : {}".format(c))
print(population[0].get_time_table(c))
print("---------------------------------------------------\n")