NDresevic / timetable-generator

Timetable generator for university schedule implemented in Python using genetic algorithms.
184 stars 59 forks source link

Pre allocation #4

Closed hitman26422 closed 2 years ago

hitman26422 commented 2 years ago

Hi you have done a great job, i have a question like how to preallocate some classes manually then process the rest of slots using the above code where i need to enter the prealloacted slots in the code. Please help me my email:mersalnaveen264@gmail.com Thanks in advance ! contact me

NDresevic commented 2 years ago

Hi,

I am not sure I completely understood you, why would you preallocate and then add those allocations again when running the algorithm?

If you only want to preallocate some classes at the beginning, i.e. to not have a randomly assigned schedule in the first iteration then you need to modify how the initial population is generated -> https://github.com/NDresevic/timetable-generator/blob/master/scheduler.py#L10 If that initial preallocation is fixed and you are sure to have those classes in the specified places, you should change the schedule matrix you are giving to the genetic algorithm to fill in. So, you should change the algorithm to just disregard the fixed allocations and work on the free ones the same way as before. I think you should change variables 'free', 'filled', and 'matrix' to reflect your setup without some slots. If you just want to prioritize your allocation but not make it a hard constraint, you should modify the cost function to penalize more the allocations that violate your desired allocation. You can do that by changing the 'hard_constraints_cost' method (https://github.com/NDresevic/timetable-generator/blob/master/costs.py#L126).

I am not sure if this helped, but please let me know of further questions. I also wrote to your email.

Kind regards, Nevena

hitman26422 commented 2 years ago

im doing timetable generation for my department so there is a requirement like filling the classes before where common other department subjects comes in where we cannot assign it to the algorithm as it belongs to different department . Anyways thanks i have found a solution with another code.

Thanks for the help, Much appreciated !

with regards, Naveen