Algorithm for creating a school timetable

后端 未结 16 1711
暖寄归人
暖寄归人 2020-12-04 04:57

I\'ve been wondering if there are known solutions for algorithm of creating a school timetable. Basically, it\'s about optimizing \"hour-dispersion\" (both in teachers and

16条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 05:07

    UPDATE: from comments ... should have heuristics too!

    I'd go with Prolog ... then use Ruby or Perl or something to cleanup your solution into a prettier form.

    teaches(Jill,math).
    teaches(Joe,history).
    
    involves(MA101,math).
    involves(SS104,history).
    
    myHeuristic(D,A,B) :- [test_case]->D='<';D='>'.
    createSchedule :- findall(Class,involves(Class,Subject),Classes),
                      predsort(myHeuristic,Classes,ClassesNew),
                      createSchedule(ClassesNew,[]).
    createSchedule(Classes,Scheduled) :- [the actual recursive algorithm].
    

    I am (still) in the process of doing something similar to this problem but using the same path as I just mentioned. Prolog (as a functional language) really makes solving NP-Hard problems easier.

提交回复
热议问题