Algorithm for scheduling timetable for student management system

I am developing the timetable module for a student management system. I am finding it difficult to design/develop it. It can be assumed that a given teacher is capable of teaching any standard whether it's primary or secondary. Can anybody please help from where to start on this,given the following constraints :

• The number of teachers for a particular subject X are less than number of classes in the school.

• All teachers should share equal workload.( This has to be calculated afresh whenever a teacher goes on leave )

• The schedule/timetable should be such that if a teacher of subject X is on leave then there should be replacement for that, I mean another teacher of the subject X should be available at that time frame.( In case multiple teachers of a given subject X are on leave then
scheduling should be efficient )

The only thing I got is to make the timetable such that given a time slot and subject X, only one class can have that subject being taught. It simply means non-overlapping permutations. I don't know if it is correct. The workload sharing problem is more difficult I guess. If details are insufficient, rather than voting it down please add comment so that I can update it.Any valuable suggestion will help

• This seems to be a question about a programming project, rather than a precise technical question. Hence I am afraid this site is not appropriate. You should check for another SE site more appropriate for a programming project and move your question there. Remember that cross-posting on several SE sites is not well received. – babou Apr 20 '15 at 17:29
• If you want equal workload... and you want that if one teacher takes leave the modified schedule should still have equal workload... then the requirements are not simultaneously satisfiable. If there are 5 teachers who all have equal workload -- each teacher is assigned to 3 slots -- and then teacher #1 takes leave, there's no way to assure equal workload at that point. Are you sure you want to require that the workload be equal? Perhaps this is an optimization problem, to reduce the inequality? If so, what metric for inequality do you want to use? – D.W. Apr 20 '15 at 23:46
• I don't understand what you mean by a schedule, and how schedule slots interact with subjects. If there was one subject, I'd assume your schedule should assign one teacher to each slot. But now suppose we have 2 subjects. Then what happens? Do we want every subject to be offered at every time slot? If not, are we free to select when each subject will/won't be offered, and is there any constraints on that (e.g., minimum number of times each subject is offered)? – D.W. Apr 20 '15 at 23:48