Before generating, check that the week can fit
A timetable is only as sound as its input data. These checks help avoid searching for hours under contradictory conditions.
Check capacity and simultaneous lessons
Define teaching days, periods and breaks first. Add up each group's and teacher's lessons without counting breaks as teaching time. Twenty available periods cannot accommodate twenty-two lessons.
Then inspect required overlaps: an elective band needs several teachers and rooms available at the same time. A double period needs consecutive slots, not simply two spare periods somewhere in the week.
Separate requirements from preferences
Treat genuine unavailability as a hard constraint. Use preferences for avoiding the last period or reducing gaps where compromise is acceptable. Turning every preference into a prohibition may leave no valid solution.
Validate before generating and save a reference before adjusting. If no timetable is found, distinguish incomplete data, proven infeasibility and an unfinished search. Change one condition at a time, compute again and compare the result. Do not remove a safety requirement merely to obtain a table.