Algorithm for computing timetable given restrictions

坚强是说给别人听的谎言 提交于 2019-12-05 06:08:18

Staying on genetic algorithms, I don't think the fitness function for this would be very complex, quite the opposite.

You basically just check your candidate solution (whatever the encoding) for each of the constraints (you only have 5) and assign a weight to them so that when a constraint is not satisfied the weight is added to a total score that could represent fitness.

In such a scenario you just minimize the fitness function (because best fitness possible is 0, meaning all the constraints are satisfied) and let the GA crunch the numbers.

The encoding will take a bit of figuring out, but once that's done it should be straightforward, unless I am missing something, of course :)

A very restricted version of this problem is NP-Complete.

Consider the case when exactly one student can take a paper.

Now for a given time slot (say the paper is taught all day), you can construct a 3-partite graph, with Rooms, Papers and Students, with an edge between a paper and a student if that student wants to take it. Also add edges between a paper and it's possible rooms.

We now see that the 3 Dimensional matching problem is an instance of your problem: you need to pick a non-overlapping (student, paper, room) combination for that particular timeslot.

You are probably better off with some heuristics for the general problem. Sorry, I can't help you there.

Hope that helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!