这就是最优调度任务NPC吗?
我自愿编写一个程序来安排家长会。校长希望家长选择 3 个可能的约会时间(同时)拜访他们的英语和数学老师。
一旦所有家长都选择了 3 个日期时间,我就应该找出安排家长教师会议的最佳方式,以便最多数量的家长可以与两位老师会面。
(如果时间冲突,数学老师不能参加会议,家长只会和英语老师见面)
我对NP类型的问题了解不多,但是当我听到“最优”这个词时“安排”在一起,我开始怀疑......
我已经告诉校长我不能这样做,但我想知道它是否是 NP 完全的。如果是的话,假设有:
- 500 位家长
- 15 名英语老师
- 5 名数学老师
- 25 个可供选择的日期时间
可以在你奶奶的电脑上在几秒钟、几分钟或几小时内正确解决这个问题吗?
I volunteered to write a program to schedule parent-teacher conferences. The principal wants parents to select 3 possible datetimes to visit their english and math teacher (at the same time).
Once all the parents have selected 3 datetimes, I'm supposed to figure out the optimal way to schedule the parent-teacher conferences so the greatest number of parents can meet with both teachers.
(If there is a time conflict and the math teacher can't be at the conference, a parent will only meet with the english teacher)
I don't know much about NP type problems, but when I hear the word "optimal" and "schedule" together, I start to wonder...
I already told the principal I couldn't do that, but I wanted to know if it was NP complete. And if it is, assuming there are:
- 500 parents
- 15 english teachers
- 5 math teachers
- 25 datetimes to pick from
could this be solved correctly in a few seconds, minutes or hours on your grandma's computer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我对你的问题有部分答案,并且有一个模拟,可以让我尝试不同的场景。以下是我的工作(但可变)假设:
我的第二阶优化甚至没有启动,因为第一次允许每个家长的第一选择在一次会话中最多容纳 11 名家长。对于必须参加大约一半时间段且平均家长人数约为 3 人的教师来说,这一结果并不是最优的。
如果有任何表达的兴趣,我可以提供代码,因为它大约有 125 行。
Well I have a partial answer to your question and a simulation that allows me to attempt different scenarios. Here are my working (but mutable) assumptions:
My second order optimizations didn't even kick in as the first pass allowed every parent's first choice to be accommodated with a maximum of 11 parents in one session. This result was sub-optimal for the teachers who had to attend about half the time slots with a mean parent group of ~3.
Given any expressed interest I can make the code available, as it is about 125 lines.