制定一个时间表,时间表 [英] Making a timetable schedule

查看:255
本文介绍了制定一个时间表,时间表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以..最近有人问我做一个时间表,他们和我一致。当我坐下来做到这一点,我意识到这是比我想象的更难。这只是一个时间表,给转移到4人的无论是白天还是晚上。

So.. someone recently asked me to make a timetable for them and I agreed. When I sat down to do it I realized it was harder than I thought. It's just a timetable to give shifts to 4 people for either day or night.

我认为是这样的:

for Monday to Saturday {
  for(i=0;i<people.length;i++){
    if (person[i].available()){
      person.worksDay()
      person is now not available.
    }
  }

  for(i=0;i<people.length;i++){
    if (person[i].available()){
      person[i].worksNight()
      person[i] is now not available.
    }
  }
}

因此​​,这算法背后的想法是,每一天,一个人被分配给一个天或夜班。一个人可用,如果他们不只是工作的转变,他们没有节假日。这对周一至周六。正如你可能会说,因为人A,B,C,D的分配是这样的(如果没有一个是在节假日除外):

So the idea behind this algorithm is that for each day, a person is assigned to a day or night shift. A person is available if they haven't JUST worked a shift and they aren't on holidays. It's for Monday to Saturday. As you can probably tell, given persons A,B,C,D the assignment would look like this (if no one is on holidays):

Mon A B
Tue C D
Wed A B
Th  C D
Fri A B
Sat C D

这工作我想,但它是一个有点明显。谁问我的人想看看不同的选择。有没有这样做呢,看的不仅仅是此选项更好的办法?还是有甚至计划,这是否适合你?

This works I guess but it's a bit obvious. The person who asked me wanted to see different options. Is there a better way about doing this to see more than just this option? Or is there even a program that does this for you?

推荐答案

我认为你应该使用遗传算法,因为:

I think you should use genetic algorithm because:

  • 这是最适合于大问题的实例。
  • 在它产生的时间减少复杂度不准确答案的价格(不是最终的最好)
  • 您可以指定约束和放大器; $ P $轻松pferences通过调整适应惩罚未满足的。
  • 您可以对计划执行的指定时间限制。
  • 溶液的质量取决于你有多少时间打算花解决方案。

  • It is best suited for large problem instances.
  • It yields reduced time complexity on the price of inaccurate answer(Not the ultimate best)
  • You can specify constraints & preferences easily by adjusting fitness punishments for not met ones.
  • You can specify time limit for program execution.
  • The quality of solution depends on how much time you intend to spend solving the program..

遗传算法的定义

遗传算法教程

级调度项目,GA

另外一起来看看:类似的问题和<一href="http://stackoverflow.com/questions/573670/which-algorithm-for-assigning-shifts-discrete-optimization-problem/4594818#4594818">another 之一

Also take a look at :a similar question and another one

这篇关于制定一个时间表,时间表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆