平衡启发式(针对时间表问题)
我正在编写一个用于生成时间表的遗传算法。
目前我正在使用这两个启发式:
- 一天内讲座之间的空洞数(相关)(更少的漏洞 -> 更大的分数)
- 每个小时都有一些价值,因此对于每个时间表,我都会对讲座进行时的小时值进行求和。 (在更合适的时间进行讲座 -> 更高的分数)
我想平衡这两种启发式方法,因此算法不会偏向任何一种。实现这一目标的最佳方法是什么?
I'm writing a genetic algorithm for generating timetables.
At the moment I'm using these two heuristics:
- Number of holes between lectures in one day (related) (less holes -> bigger score)
- Each hour has some value, so for each timetable I sum values for hours when lectures are on. (lectures at more appropriate hours -> bigger score)
I want to balance these two heuristics, so the algorithm wouldn't favor neither one. What would be the best way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个非常简单的方法就是将分数相加。归根结底,您希望混合分数随着任一独立分数的上升而上升。您也可以使用乘法(根据分数的大小警惕数字溢出)。无论使用哪种方法,您都可以对各个分数进行加权,例如,
您甚至可以使权重由用户配置。
A very simple approach would simply be to add the scores together. At the end of the day, you want a blended score that goes up when either independent score goes up. You could use multiplication as well (being wary of number overflows depending on the size of your scores). With either approach you could weight the individual scores, e.g.
You could even make the weights user-configurable.
开发评分函数来评估生成的时间表的质量。您在两个启发式中已经有了这个想法。
生成一些随机时间表问题。
选择一些值来平衡这两种启发法,生成解决方案,并评估哪些看起来最好(如果您无法想出评分函数,那么就观察它)。
选择一组新的平衡权重(即围绕上次最佳选择的邻域)并重复
Develop a scoring function to evaluate the quality of generated timetables. You have the idea for that in your two heuristics.
Generate some random timetable problems.
Choose some values to balance the two heuristics, generate solutions, and evaluate which ones look best (if you can't come up with a scoring function, then eyeball it).
choose a new set of balance weightings (i.e. around a neighborhood of the best choice from last time) and repeat